forked from gatekeeper/gatekeeper-operator
-
Notifications
You must be signed in to change notification settings - Fork 4
85 lines (70 loc) · 2.75 KB
/
olm_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
name: OLM-Tests
on:
push:
branches:
- main
- release-[0-9]+.[0-9]+
pull_request:
branches:
- main
- release-[0-9]+.[0-9]+
jobs:
main:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download binaries
run: |
make download-binaries
- name: Verify bundle
run: |
make bundle
git diff --exit-code
- name: Create and set up K8s KinD Cluster
run: |
make test-cluster
- name: Build and Push Test Container Image and Bundle/Bundle Index Images
run: |
make build-and-push-bundle-images REPO=localhost:5000 VERSION_TAG=${GITHUB_SHA}
- name: Deploy OLM
run: |
make deploy-olm
- name: Deploy resources on KIND cluster to install Gatekeeper
run: |
make deploy-using-olm REPO=localhost:5000 VERSION_TAG=${GITHUB_SHA} NAMESPACE=mygatekeeper
for i in {1..9}; do
echo "Waiting for gatekeeper-operator-controller deployment creation (${i}/9) ..."
kubectl -n mygatekeeper get deployment gatekeeper-operator-controller && break
# Patch any ErrorPreventedResolution status, which would unnecessarily block the deployment for 10 minutes
kubectl get subscription -n mygatekeeper -l operators.coreos.com/gatekeeper-operator.mygatekeeper= -o yaml |
yq '.items[0] | .status.conditions[] |= del(select(.reason == "ErrorPreventedResolution"))' | kubectl apply -f - || true
sleep 10
done
for i in {1..6}; do
err_code=0
echo "Waiting for gatekeeper-operator-controller deployment to be available (${i}/6) ..."
kubectl -n mygatekeeper rollout status deployment/gatekeeper-operator-controller --timeout=30s && break || err_code=$?
done
[[ "${err_code}" == "0" ]] || { echo "Deployment failed to become available."; exit ${err_code}; }
- name: E2E Tests
run: |
kubectl -n mygatekeeper logs deployment/gatekeeper-operator-controller -c manager -f 2>&1 | tee operator.log &
make test-e2e NAMESPACE=mygatekeeper
- name: Debug
if: ${{ failure() }}
run: |
echo "::group:Deployments"
kubectl -n mygatekeeper get all
echo "---"
kubectl -n mygatekeeper get deployment/gatekeeper-operator-controller -o yaml
echo "::endgroup::"
echo "::group::Operator Logs"
cat operator.log
echo "::endgroup::"
echo "::group::Deployments"
kubectl -n mygatekeeper get deployments -o yaml
echo "::endgroup::"