-
Notifications
You must be signed in to change notification settings - Fork 102
177 lines (171 loc) · 7.35 KB
/
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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Tests
on: [push, workflow_dispatch]
jobs:
fmtcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: .go-version
cache: true
- run: |
make check-fmt
tf-fmtcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: .go-version
cache: true
- run: |
make check-tffmt
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: .go-version
cache: true
- run: make ci-test
unitTest:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: .go-version
cache: true
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: '16'
- run: npm install -g bats@${BATS_VERSION}
shell: bash
env:
BATS_VERSION: '1.8.2'
- run: bats -v
shell: bash
- run: make unit-test
build-docker-image:
outputs:
image-archive: ${{ steps.build-docker-image.outputs.image-archive }}
image-archive-file: ${{ steps.build-docker-image.outputs.image-archive-file }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: .go-version
cache: true
- name: Build operator binary and image
id: build-docker-image
run: |
export IMAGE_ARCHIVE_FILE=dist/vso.tar
make ci-build ci-docker-build docker-image-save
image_checksum="$(sha256sum ${IMAGE_ARCHIVE_FILE} | cut -f1 -d' ')"
test -n "${image_checksum}" || (echo "image checksum is empty" >&2 ; exit 1)
echo "image-archive=vault-secrets-operator-docker-$(git rev-parse --short HEAD)_${image_checksum}" >> $GITHUB_OUTPUT
echo "image-archive-file=${IMAGE_ARCHIVE_FILE}" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: ${{ steps.build-docker-image.outputs.image-archive }}
path: ${{ steps.build-docker-image.outputs.image-archive-file }}
if-no-files-found: error
integrationTest:
runs-on: ubuntu-latest
needs: [fmtcheck, test, build-docker-image]
env:
KIND_CLUSTER_NAME: vault-secrets-operator
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
kind-k8s-version: [1.22.17, 1.23.17, 1.24.12, 1.25.8, 1.26.3]
vault-version: [1.11.9, 1.12.5, 1.13.1]
# Note: The below exclude and includes are a bit awkward, but they
# allow us to exclude the combos we don't really need. We want to test
# the operator with the different k8s versions, and with the different
# vault versions, but we don't care about testing all the k8s versions
# against all the vault versions.
# Combos to exclude:
# kind-k8s-version: [1.22.17, 1.23.17, 1.24.12, 1.25.8]
# vault-version: [1.11.9, 1.12.5]
exclude:
- kind-k8s-version: 1.25.8
- kind-k8s-version: 1.24.12
- kind-k8s-version: 1.23.17
- kind-k8s-version: 1.22.17
include:
- kind-k8s-version: 1.25.8
vault-version: 1.13.1
- kind-k8s-version: 1.24.7
vault-version: 1.13.1
- kind-k8s-version: 1.23.13
vault-version: 1.13.1
- kind-k8s-version: 1.22.15
vault-version: 1.13.1
name: Integration vault:${{ matrix.vault-version }} kind ${{ matrix.kind-k8s-version }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: ${{ needs.build-docker-image.outputs.image-archive }}
path: dist
- name: Create K8s Kind Cluster
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00 # v1.5.0
with:
version: v0.17.0
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
config: test/integration/kind/config.yaml
node_image: kindest/node:v${{ matrix.kind-k8s-version }}
- name: Create kind export log root
id: create_kind_export_log_root
run: |
log_artifact_name="kind-${{ env.KIND_CLUSTER_NAME}}-$(git rev-parse --short ${{ github.sha }})-${{ matrix.kind-k8s-version }}-${{ matrix.vault-version }}-logs"
log_root="/tmp/${log_artifact_name}"
mkdir -p "${log_root}"
echo "log_root=${log_root}" >> $GITHUB_OUTPUT
echo "log_artifact_name=${log_artifact_name}" >> $GITHUB_OUTPUT
- name: Load Docker image
run:
make docker-image-load load-docker-image IMAGE_ARCHIVE_FILE=${{ needs.build-docker-image.outputs.image-archive-file }}
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: .go-version
cache: true
- name: OSS tests using Helm
env:
INTEGRATION_TESTS: true
VAULT_IMAGE_TAG: ${{ matrix.vault-version }}
run: |
make integration-test-helm SUPPRESS_TF_OUTPUT=true EXPORT_KIND_LOGS_ROOT=${{ steps.create_kind_export_log_root.outputs.log_root }}
- name: OSS tests using Kustomize
# Ideally we only need to test the latest release of OSS Vault.
if: ${{ matrix.vault-version == '1.13.0' }}
env:
INTEGRATION_TESTS: true
VAULT_IMAGE_TAG: ${{ matrix.vault-version }}
run: |
make integration-test SUPPRESS_TF_OUTPUT=true EXPORT_KIND_LOGS_ROOT=${{ steps.create_kind_export_log_root.outputs.log_root }}
- name: ENT tests using Kustomize
env:
INTEGRATION_TESTS: true
VAULT_LICENSE_CI: ${{ secrets.VAULT_LICENSE_CI }}
VAULT_IMAGE_TAG: ${{ matrix.vault-version }}-ent
run: |
make integration-test-ent SUPPRESS_TF_OUTPUT=true EXPORT_KIND_LOGS_ROOT=${{ steps.create_kind_export_log_root.outputs.log_root }}
- name: Store kind cluster logs
if: success()
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: ${{ steps.create_kind_export_log_root.outputs.log_artifact_name }}
path: ${{ steps.create_kind_export_log_root.outputs.log_root }}
- name: Store kind cluster logs failure
if: failure()
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: ${{ steps.create_kind_export_log_root.outputs.log_artifact_name }}-failed
path: ${{ steps.create_kind_export_log_root.outputs.log_root }}