-
Notifications
You must be signed in to change notification settings - Fork 9
154 lines (136 loc) · 4.59 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Run e2e tests
on:
workflow_dispatch:
issue_comment:
types:
- created
env:
KUTTL_VERSION: 0.11.0
jobs:
casskop-image:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' || (
github.event.issue.pull_request &&
github.event.comment.user.login == github.repository_owner &&
contains(github.event.comment.body, '/kuttl-tests')
)
permissions:
packages: write
steps:
- id: lower-repo
shell: pwsh
run: |
"::set-output name=repository::$($env:GITHUB_REPOSITORY.ToLowerInvariant())"
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get PR branch name
id: get-branch
env:
REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" = "issue_comment" ]
then
echo ::set-output name=branch::$(gh pr view ${{ github.event.issue.number }} --repo $REPO --json headRefName --jq '.headRefName')
else
echo ::set-output name=branch::${{ github.ref_name }}
fi
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/casskop/Dockerfile
tags: ghcr.io/${{ steps.lower-repo.outputs.repository }}:${{ steps.get-branch.outputs.branch }}
push: true
install-kuttl:
needs: casskop-image
runs-on: ubuntu-latest
steps:
- name: Cache Kuttl
id: cache-kuttl
uses: actions/[email protected]
with:
path: kuttl
key: ${{ runner.os }}-kuttl-${{ env.KUTTL_VERSION }}
- name: download-kuttl
if: steps.cache-kuttl.outputs.cache-hit != 'true'
run: |
curl -L https://github.com/kudobuilder/kuttl/releases/download/v${{ env.KUTTL_VERSION }}/kubectl-kuttl_${{ env.KUTTL_VERSION }}_linux_i386 -o kuttl
kuttl-casskop:
needs: install-kuttl
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
test-name: [operations, sidecars, scaling, multi-dcs, backup-restore, nodetool]
steps:
- id: lower-repo
shell: pwsh
run: |
"::set-output name=repository::$($env:GITHUB_REPOSITORY.ToLowerInvariant())"
- name: Get PR branch name
id: get-branch
env:
REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" = "issue_comment" ]
then
echo ::set-output name=branch::$(gh pr view ${{ github.event.issue.number }} --repo $REPO --json headRefName --jq '.headRefName')
else
echo ::set-output name=branch::${{ github.ref_name }}
fi
- name: Checkout branch
uses: actions/checkout@v3
with:
ref: ${{ steps.get-branch.outputs.branch }}
- uses: rinx/[email protected]
with:
version: v5.4.0
options: --image rancher/k3s:v1.24.13-k3s1
- uses: azure/setup-helm@v1
with:
version: v3.8.1
- name: Restore Kuttl
id: cache-kuttl
uses: actions/[email protected]
with:
path: kuttl
key: ${{ runner.os }}-kuttl-${{ env.KUTTL_VERSION }}
- name: Add aws-backup-secrets with S3
if: matrix.test-name == 'backup-restore'
working-directory: test/kuttl
run: |
cat <<EOF >> backup-restore/00-createCluster.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: aws-backup-secrets
type: Opaque
stringData:
awsaccesskeyid: ${{ secrets.AWS_ACCESS_KEY_ID }}
awssecretaccesskey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
awsregion: us-west-2
EOF
cat <<EOF >> backup-restore/00-assert.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: aws-backup-secrets
EOF
- name: Run kuttl tests
run: |
chmod u+x kuttl
PATH=$PWD:$PATH
helm install casskop charts/casskop --set image.tag=${{ steps.get-branch.outputs.branch }} --set image.repository=ghcr.io/${{ steps.lower-repo.outputs.repository }}
cd test/kuttl/
kuttl test --test ${{ matrix.test-name }} --namespace default --skip-delete