-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run tests locally provisioning in Kind #1567
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This contains the setup to run `mvn test` locally and provisioning build pods in a locally running Kind cluster. | ||
|
||
It's basically the same than `test-in-k8s.sh` but the Jenkins instance runs on the host instead of a Kind pod. | ||
|
||
`dockerhost.yaml` is a trick to allow pods to contact the Jenkins instance which runs on the host. | ||
|
||
Usage: | ||
```shell | ||
./test-local.sh KubernetesPipelineRJRTest#basicPipeline | ||
``` | ||
|
||
Note that this requires a locally running Kind cluster (defaults are ok, just `kind create cluster`). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Endpoints | ||
metadata: | ||
name: dockerhost | ||
subsets: | ||
- addresses: | ||
- ip: @GATEWAY_IP@ # this is the gateway IP in the "kind" docker network | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: dockerhost | ||
spec: | ||
clusterIP: None |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
gateway_ip=$(docker network inspect kind | jq '[.[].IPAM.Config[].Gateway][0]') | ||
sed "s/@GATEWAY_IP@/$gateway_ip/g" < dockerhost.yaml | kubectl apply -f - | ||
|
||
mvn -f ../pom.xml test -Dtest="$@" -Djenkins.host.address=dockerhost -Dhudson.TcpSlaveAgentListener.hostName=dockerhost -DconnectorHost=0.0.0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't the ip of something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the trick to let agents running in Kind to connect to the controller running in the host.