-
Notifications
You must be signed in to change notification settings - Fork 762
106 lines (88 loc) · 3.51 KB
/
upgrade.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
name: upgrade
on:
push:
paths:
- "manifest_staging/charts/**"
pull_request:
paths:
- "manifest_staging/charts/**"
permissions:
contents: read
env:
BASE_RELEASE: 3.9.2
BASE_BRANCH: release-3.9
jobs:
helm_upgrade:
name: "[Helm] Upgrade test"
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
HELM_VERSION: ["3.14.1"]
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Check out code into the Go module directory
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Bootstrap e2e
run: |
mkdir -p $GITHUB_WORKSPACE/bin
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
make e2e-bootstrap KUBERNETES_VERSION=${{ env.KUBERNETES_VERSION }}
env:
KUBERNETES_VERSION: 1.24.4
- name: Deploy Helm release
run: |
make e2e-helm-upgrade-init HELM_VERSION=${{ matrix.HELM_VERSION }} BASE_RELEASE=${{ env.BASE_RELEASE }} LOG_LEVEL=DEBUG
- name: Run e2e after install
run: |
# running tests matching the base release
git clone https://github.com/open-policy-agent/gatekeeper.git -b ${{ env.BASE_BRANCH }} --sparse --depth 1 /tmp/gatekeeper-tests-${{ env.BASE_BRANCH }}
cd /tmp/gatekeeper-tests-${{ env.BASE_BRANCH }}
git sparse-checkout set test/bats
bats -t test/bats/test.bats
- name: Save logs
if: ${{ always() }}
run: |
kubectl logs -n gatekeeper-system -l control-plane=controller-manager --tail=-1 > logs-${{ matrix.HELM_VERSION }}-controller-pre-upgrade.json
kubectl logs -n gatekeeper-system -l control-plane=audit-controller --tail=-1 > logs-${{ matrix.HELM_VERSION }}-audit-pre-upgrade.json
- name: Cleanup
run: |
kubectl delete ns gatekeeper-test-playground gatekeeper-excluded-namespace || true
kubectl delete constrainttemplates --all || true
kubectl delete configs --all || true
- name: Upgrade Helm version
run: |
make docker-buildx \
IMG=gatekeeper-e2e:latest
make docker-buildx-crds \
CRD_IMG=gatekeeper-crds:latest
make e2e-build-load-externaldata-image
kind load docker-image --name kind \
gatekeeper-e2e:latest \
gatekeeper-crds:latest
make e2e-helm-upgrade \
HELM_VERSION=${{ matrix.HELM_VERSION }} \
HELM_REPO=gatekeeper-e2e \
HELM_CRD_REPO=gatekeeper-crds \
HELM_RELEASE=latest \
LOG_LEVEL=DEBUG
- name: Run e2e after upgrade
run: |
make test-e2e
- name: Save logs
if: ${{ always() }}
run: |
kubectl logs -n gatekeeper-system -l control-plane=controller-manager --tail=-1 > logs-${{ matrix.HELM_VERSION }}-controller-post-upgrade.json
kubectl logs -n gatekeeper-system -l control-plane=audit-controller --tail=-1 > logs-${{ matrix.HELM_VERSION }}-audit-post-upgrade.json
kubectl logs -n gatekeeper-system -l run=dummy-provider --tail=-1 > logs-${{ matrix.HELM_VERSION }}-dummy-provider-post-upgrade.json
- name: Upload artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: ${{ always() }}
with:
name: logs
path: |
logs-*.json