-
Notifications
You must be signed in to change notification settings - Fork 151
106 lines (92 loc) · 3.13 KB
/
e2e_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
name: e2e Tests
on:
pull_request:
branches:
- main
- 'incubation'
paths-ignore:
- 'docs/**'
- '**.adoc'
- '**.md'
- 'LICENSE'
push:
branches:
- main
- 'incubation'
paths-ignore:
- 'docs/**'
- '**.adoc'
- '**.md'
- 'LICENSE'
concurrency:
group: ${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
QUAY_ORG: ${{ secrets.QUAY_ORG}}
IMAGE_REGISTRY: quay.io
BUNDLE_IMAGE_NAME: opendatahub-operator-bundle
IMAGE_NAME: opendatahub-operator
IMAGE_TAG: pr-${{ github.event.pull_request.number }}
jobs:
kubernetes-e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY}}
username: ${{ secrets.QUAY_ID }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build Operator Bundle
run: |
# Pull the image from registry
while true
do
echo "Pulling image from Quay.io";
sleep 10
if docker pull quay.io/${{ env.QUAY_ORG }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
then
break
fi
done
# Build operator bundle image
make bundle-build -e BUNDLE_IMG=quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
-e IMG=quay.io/${{ env.QUAY_ORG }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} IMAGE_BUILDER=docker
- name: Push Operator Bundle Image
run: |
docker push quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: Setup and start KinD cluster
uses: ./.github/actions/kind
- name: Verify KinD
run: |
# export KUBECONFIG="$(kind get kubeconfig --name=kind-cluster)"
kind get clusters
kubectl get nodes -o wide
- name: Load Image in KinD cluster
run: |
kind export kubeconfig --name kind-cluster
kind load docker-image quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }} --name kind-cluster
docker exec -t kind-cluster-control-plane crictl images
- name: Deploy Operatorhub operator
id: deploy
run: |
echo Deploying Operatorhub operator
IMG=quay.io/${{ env.QUAY_ORG }}/${{ env.BUNDLE_IMAGE_NAME }}:${{ env.IMAGE_TAG }}
OPERATOR_NAMESPACE=opendatahub-operator-system
make deploy -e IMG="${IMG}" OPERATOR_NAMESPACE="${OPERATOR_NAMESPACE}"
kubectl get pods --all-namespaces
kubectl wait -n $OPERATOR_NAMESPACE pods --for=condition=Available=true --timeout=180s
- name: Run e2e tests
run: |
make e2e-test OPERATOR_NAMESPACE=opendatahub-operator-system
- name: Clean up KinD cluster
run: |
kind delete cluster --name kind-cluster