@@ -2,16 +2,15 @@ name: KinD e2e tests
22
33on :
44 push :
5- branches : [ main ]
5+ branches : [main]
66 pull_request :
7- branches : [ main ]
7+ branches : [main]
88
99concurrency :
1010 group : kind-e2e-tests-${{ github.head_ref || github.run_id }}
1111 cancel-in-progress : true
1212
1313jobs :
14-
1514 e2e :
1615 name : e2e tests
1716 runs-on : ubuntu-latest
@@ -22,84 +21,84 @@ jobs:
2221 timeout-minutes : 30
2322
2423 steps :
25- - name : Set up Go 1.18.x
26- uses : actions/setup-go@v3
27- with :
28- go-version : 1.18.x
29-
30- - name : Setup ko
31- uses : imjasonh/setup-ko@v0.4
32-
33- - name : Check out code onto GOPATH
34- uses : actions/checkout@v3
35- with :
36- path : ./src/github.com/${{ github.repository }}
37-
38- - name : Setup KinD Cluster with VMware sources.
39- working-directory : ./src/github.com/${{ github.repository }}
40- env :
41- KIND_VERSION : v0.12.0
42- run : |
43- set -x
44-
45- curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
46- chmod +x ./kind
47- sudo mv kind /usr/local/bin
48-
49- # KinD configuration.
50- cat > kind.yaml <<EOF
51- apiVersion: kind.x-k8s.io/v1alpha4
52- kind: Cluster
53- nodes:
54- - role: control-plane
55- - role: worker
56- EOF
57-
58- # Create a cluster!
59- kind create cluster --config kind.yaml
60-
61- # Build and Publish our test images to the docker daemon.
62- ./test/upload-test-images.sh
63-
64- # Build and Publish our containers to the docker daemon (including test assets)
65- export GO111MODULE=on
66- export GOFLAGS=-mod=vendor
67- ko apply -PRf config/
68-
69- # webhook readiness probe can take some time to enter ready state
70- kubectl -n vmware-sources wait --timeout=3m --for=condition=Available deploy/vsphere-source-webhook
71-
72- - name : Build vcsim image
73- working-directory : ./src/github.com/${{ github.repository }}
74- run : |
75- export GO111MODULE=on
76- echo "VCSIM_IMAGE=$(ko publish -B github.com/vmware/govmomi/vcsim)" >> $GITHUB_ENV
77-
78- - name : Run E2E tests
79- working-directory : ./src/github.com/${{ github.repository }}
80- run : |
81- set -x
82-
83- # For logstream to work.
84- export SYSTEM_NAMESPACE=vmware-sources
85- # Run the tests tagged as e2e on the KinD cluster.
86- go test -v -race -timeout=10m -tags=e2e github.com/${{ github.repository }}/test/e2e/...
87-
88- - name : Debug
89- if : ${{ always() }}
90- run : |
91- kubectl get pods --all-namespaces
92- kubectl -n vmware-sources describe pods
93- kubectl -n vmware-sources get events
94-
95- - name : Collect diagnostics
96- uses : chainguard-dev/actions/kind-diag@main
97- # Only upload logs on failure.
98- if : ${{ failure() }}
99- with :
100- cluster-resources : nodes
101- namespace-resources : pods,svc
102- artifact-name : logs
24+ - name : Set up Go 1.18.x
25+ uses : actions/setup-go@v3
26+ with :
27+ go-version : 1.18.x
28+
29+ - name : Setup ko
30+ uses : imjasonh/setup-ko@v0.6
31+
32+ - name : Check out code onto GOPATH
33+ uses : actions/checkout@v3
34+ with :
35+ path : ./src/github.com/${{ github.repository }}
36+
37+ - name : Setup KinD Cluster with VMware sources.
38+ working-directory : ./src/github.com/${{ github.repository }}
39+ env :
40+ KIND_VERSION : v0.12.0
41+ run : |
42+ set -x
43+
44+ curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
45+ chmod +x ./kind
46+ sudo mv kind /usr/local/bin
47+
48+ # KinD configuration.
49+ cat > kind.yaml <<EOF
50+ apiVersion: kind.x-k8s.io/v1alpha4
51+ kind: Cluster
52+ nodes:
53+ - role: control-plane
54+ - role: worker
55+ EOF
56+
57+ # Create a cluster!
58+ kind create cluster --config kind.yaml
59+
60+ # Build and Publish our test images to the docker daemon.
61+ ./test/upload-test-images.sh
62+
63+ # Build and Publish our containers to the docker daemon (including test assets)
64+ export GO111MODULE=on
65+ export GOFLAGS=-mod=vendor
66+ ko apply -PRf config/
67+
68+ # webhook readiness probe can take some time to enter ready state
69+ kubectl -n vmware-sources wait --timeout=3m --for=condition=Available deploy/vsphere-source-webhook
70+
71+ - name : Build vcsim image
72+ working-directory : ./src/github.com/${{ github.repository }}
73+ run : |
74+ export GO111MODULE=on
75+ echo "VCSIM_IMAGE=$(ko publish -B github.com/vmware/govmomi/vcsim)" >> $GITHUB_ENV
76+
77+ - name : Run E2E tests
78+ working-directory : ./src/github.com/${{ github.repository }}
79+ run : |
80+ set -x
81+
82+ # For logstream to work.
83+ export SYSTEM_NAMESPACE=vmware-sources
84+ # Run the tests tagged as e2e on the KinD cluster.
85+ go test -v -race -timeout=10m -tags=e2e github.com/${{ github.repository }}/test/e2e/...
86+
87+ - name : Debug
88+ if : ${{ always() }}
89+ run : |
90+ kubectl get pods --all-namespaces
91+ kubectl -n vmware-sources describe pods
92+ kubectl -n vmware-sources get events
93+
94+ - name : Collect diagnostics
95+ uses : chainguard-dev/actions/kind-diag@main
96+ # Only upload logs on failure.
97+ if : ${{ failure() }}
98+ with :
99+ cluster-resources : nodes
100+ namespace-resources : pods,svc
101+ artifact-name : logs
103102
104103 plugins :
105104 name : kn plugins
@@ -110,42 +109,41 @@ jobs:
110109 timeout-minutes : 10
111110
112111 steps :
113- - name : Set up Go 1.18.x
114- uses : actions/setup-go@v3
115- with :
116- go-version : 1.18.x
117-
118- - name : Setup ko
119- uses : imjasonh/setup-ko@v0.4
120-
121- - name : Check out code
122- uses : actions/checkout@v3
123-
124- - name : Setup KinD Cluster
125- env :
126- KIND_VERSION : v0.11.1
127- run : |
128- set -x
129-
130- curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
131- chmod +x ./kind
132- sudo mv kind /usr/local/bin
133-
134- # Create cluster with defaults
135- kind create cluster
136-
137- - name : Deploy vcsim
138- run : |
139- ko apply -PRf test/config
140- kubectl wait --timeout=1m --for=condition=Available deploy/vcsim
141- kubectl port-forward deploy/vcsim 8989:8989 &
142-
143- - name : Build plugins
144- run : |
145- go build -o kn-vsphere ./plugins/vsphere/cmd/vsphere
146-
147- - name : Test plugin
148- run : |
149- ./kn-vsphere auth create --name vsphere-credentials --username user --password pass --verify-url 127.0.0.1:8989 --verify-insecure=true
150- kubectl get secret vsphere-credentials # assert exists
151-
112+ - name : Set up Go 1.18.x
113+ uses : actions/setup-go@v3
114+ with :
115+ go-version : 1.18.x
116+
117+ - name : Setup ko
118+ uses : imjasonh/setup-ko@v0.6
119+
120+ - name : Check out code
121+ uses : actions/checkout@v3
122+
123+ - name : Setup KinD Cluster
124+ env :
125+ KIND_VERSION : v0.11.1
126+ run : |
127+ set -x
128+
129+ curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
130+ chmod +x ./kind
131+ sudo mv kind /usr/local/bin
132+
133+ # Create cluster with defaults
134+ kind create cluster
135+
136+ - name : Deploy vcsim
137+ run : |
138+ ko apply -PRf test/config
139+ kubectl wait --timeout=1m --for=condition=Available deploy/vcsim
140+ kubectl port-forward deploy/vcsim 8989:8989 &
141+
142+ - name : Build plugins
143+ run : |
144+ go build -o kn-vsphere ./plugins/vsphere/cmd/vsphere
145+
146+ - name : Test plugin
147+ run : |
148+ ./kn-vsphere auth create --name vsphere-credentials --username user --password pass --verify-url 127.0.0.1:8989 --verify-insecure=true
149+ kubectl get secret vsphere-credentials # assert exists
0 commit comments