-
Notifications
You must be signed in to change notification settings - Fork 79
114 lines (110 loc) · 3.91 KB
/
version_tests.yaml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: kuttl multi-version tests
on:
push:
branches:
- main
- "release/**"
paths-ignore:
- "docs/**"
- "CHANGELOG/**"
pull_request:
branches:
- main
- "release/**"
paths-ignore:
- "docs/**"
- "CHANGELOG/**"
jobs:
build_image:
name: Build image
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.parse_image_tag.outputs.image_tag }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
- name: Parse image version
id: parse_image_tag
run: echo "image_tag=$(yq eval '.images[0].newTag' config/deployments/default/kustomization.yaml)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
id: docker_build
uses: docker/build-push-action@v5
with:
file: Dockerfile
context: .
push: false
tags: k8ssandra/k8ssandra-operator:latest,k8ssandra/k8ssandra-operator:${{ steps.parse_image_tag.outputs.image_tag }}
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
outputs: type=docker,dest=/tmp/k8ssandra-k8ssandra-operator.tar
- name: Upload k8ssandra-operator image
uses: actions/upload-artifact@v4
with:
name: k8ssandra-operator
path: /tmp/k8ssandra-k8ssandra-operator.tar
run_kuttl_test:
runs-on: ubuntu-latest
needs: [build_image]
name: Run kuttl tests
strategy:
matrix:
k8s_version:
- "1.21"
- "1.22"
- "1.23"
serverVersion:
- 3.11.14
- 4.0.3
kuttl-test:
- test-cassandra-versions
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Kind kube-proxy issue workaround
run: sudo sysctl net/netfilter/nf_conntrack_max=524288
- name: Download k8ssandra-operator image
uses: actions/download-artifact@v4
with:
name: k8ssandra-operator
path: /tmp
- name: Load Docker images
run: |
docker load --input /tmp/k8ssandra-k8ssandra-operator.tar
- name: Install kuttl
run: |
make install-kuttl
- name: Create kind cluster
run: |
kind create cluster --name k8ssandra-0 --config ./test/kuttl/config/kind/w3k${{ matrix.k8s_version }}.yaml
make cert-manager
make IMG="k8ssandra/k8ssandra-operator:${{ needs.build_image.outputs.image_tag }}" kind-load-image
- name: Run kuttl test
run: |
# We are running tests against k8s 1.21
# Additional versions must be added in kind config files under ./test/config/kind
# Currently we aren't using the kuttl-test Makefile target while trying to iron out the
# release process. The following changes have been made to stay as close as possible
# to the existing behavior with kuttl tests while supporting the ability to use a release
# image tag of the operator.
SERVERVERSION=${{ matrix.serverVersion }} ./bin/kubectl-kuttl test --kind-context=k8ssandra-0 --start-kind=false --test ${{ matrix.kuttl-test }}
- name: Delete kind cluster
run: |
kind delete cluster --name k8ssandra-0