forked from IBM/varnish-operator
-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (83 loc) · 3.91 KB
/
e2e-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: end-to-end tests
on: pull_request
jobs:
end-to-end:
name: End to end tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kubernetes-version: [ "1.26", "1.25", "1.24", "1.23"]
include:
- kubernetes-version: "1.26"
kind-node: kindest/node:v1.26.3@sha256:61b92f38dff6ccc29969e7aa154d34e38b89443af1a2c14e6cfbd2df6419c66f
- kubernetes-version: "1.25"
kind-node: kindest/node:v1.25.8@sha256:00d3f5314cc35327706776e95b2f8e504198ce59ac545d0200a89e69fce10b7f
- kubernetes-version: "1.24"
kind-node: kindest/node:v1.24.12@sha256:1e12918b8bc3d4253bc08f640a231bb0d3b2c5a9b28aa3f2ca1aee93e1e8db16
- kubernetes-version: "1.23"
kind-node: kindest/node:v1.23.17@sha256:e5fd1d9cd7a9a50939f9c005684df5a6d145e8d695e78463637b79464292e66c
steps:
- name: Prep
id: prep
run: |
repo=cinple
if [[ -n "${{ secrets.DOCKERHUB_REPO }}" ]]; then
repo=${{ secrets.DOCKERHUB_REPO }}
fi
echo "DOCKERHUB_REPO=$repo" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.20
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: go mod download
- name: build images
run: |
docker build --platform linux/amd64 -f Dockerfile -t ${{ env.DOCKERHUB_REPO }}/varnish-operator:local .
docker build --platform linux/amd64 -f Dockerfile.varnishd -t ${{ env.DOCKERHUB_REPO }}/varnish:local .
docker build --platform linux/amd64 -f Dockerfile.controller -t ${{ env.DOCKERHUB_REPO }}/varnish-controller:local .
docker build --platform linux/amd64 -f Dockerfile.exporter -t ${{ env.DOCKERHUB_REPO }}/varnish-metrics-exporter:local .
- name: Create k8s Kind Cluster ${{ matrix.kubernetes-version }}
uses: helm/[email protected]
with:
version: v0.14.0
cluster_name: e2e-tests
node_image: ${{ matrix.kind-node }}
wait: 120s
- name: create namespace
run: kubectl create namespace varnish-operator
- name: load images
run: |
kind load --name e2e-tests docker-image ${{ env.DOCKERHUB_REPO }}/varnish-operator:local
kind load --name e2e-tests docker-image ${{ env.DOCKERHUB_REPO }}/varnish:local
kind load --name e2e-tests docker-image ${{ env.DOCKERHUB_REPO }}/varnish-controller:local
kind load --name e2e-tests docker-image ${{ env.DOCKERHUB_REPO }}/varnish-metrics-exporter:local
- name: install operator
id: helm
run: helm install varnish-operator --debug --namespace=varnish-operator varnish-operator --wait --set container.imagePullPolicy=Never --set container.image=${{ env.DOCKERHUB_REPO }}/varnish-operator:local
- name: run tests
id: e2e
run: go test -count=1 ./tests #-count=1 is to disable tests caching.
- name: capture logs if e2e failed
if: ${{ always() && (steps.e2e.outcome == 'failure' || steps.helm.outcome == 'failure') }}
run: |
mkdir ./kind-logs
kind export logs ./kind-logs --name e2e-tests
tar -cvf kind-e2e-logs-${{ matrix.kubernetes-version }}.tar ./kind-logs
- name: upload kind logs artifact
if: ${{ always() && (steps.e2e.outcome == 'failure' || steps.helm.outcome == 'failure') }}
uses: actions/upload-artifact@v3
with:
name: kind-e2e-logs-${{ matrix.kubernetes-version }}.tar
path: kind-e2e-logs-${{ matrix.kubernetes-version }}.tar
retention-days: 7
- name: upload e2e test logs artifact
if: ${{ always() && steps.e2e.outcome == 'failure' }}
uses: actions/upload-artifact@v3
with:
name: debug-logs-${{ matrix.kubernetes-version }}.tar
path: /tmp/debug-logs/
retention-days: 7