-
Notifications
You must be signed in to change notification settings - Fork 12
236 lines (211 loc) · 8.82 KB
/
e2e-test.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: Windup Operator E2E Tests
on: [ pull_request,push ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
# check versions in https://github.com/kubernetes/kubernetes/releases
kubernetes_version: [ v1.25.3 ]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Setup Minikube-Kubernetes
# check version in https://github.com/manusa/actions-setup-minikube/releases
uses: manusa/[email protected]
with:
# check version in https://github.com/kubernetes/minikube/releases
minikube version: v1.28.0
kubernetes version: ${{ matrix.kubernetes_version }}
start args: --addons=ingress
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: |
mvn verify
operator-container:
name: Operator container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: maven
- name: Build container image
run: |
mvn -U -B package --file pom.xml -DskipTests \
-Dquarkus.native.container-build=true \
-Dquarkus.container-image.push=false \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=localhost:5000 \
-Dquarkus.container-image.group="" \
-Dquarkus.container-image.name=windup-operator \
-Dquarkus.container-image.tag=0.0.0 \
-P native
- name: Save container image
run: docker save -o windup-operator-container-image.tar localhost:5000/windup-operator:0.0.0
- name: Upload container image
uses: actions/upload-artifact@v3
with:
name: artifacts
path: windup-operator-container-image.tar
catalog-container:
name: Catalog container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: maven
- name: Setup OLM CLIs
run: |
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
# Opm
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-registry/releases/download/v1.26.5
curl -LO ${OPERATOR_SDK_DL_URL}/${OS}-${ARCH}-opm
chmod +x ${OS}-${ARCH}-opm && sudo mv ${OS}-${ARCH}-opm /usr/local/bin/opm
- name: Setup other tools
run: |
sudo apt-get install -y groovy
- name: Build container image
run: |
mvn -U -B package --file pom.xml -DskipTests \
-Dquarkus.native.container-build=false \
-Dquarkus.container-image.push=false \
-Dquarkus.container-image.build=false \
-Dquarkus.container-image.registry=localhost:5000 \
-Dquarkus.container-image.group="" \
-Dquarkus.container-image.name=windup-operator \
-Dquarkus.operator-sdk.bundle.package-name=windup-operator \
-Dquarkus.operator-sdk.bundle.channels=alpha \
-Dquarkus.application.version=0.0.0 \
-Dquarkus.kubernetes.image-pull-policy=if-not-present \
-Dquarkus.kubernetes.env.vars.related-image-pull-policy=IfNotPresent
groovy scripts/enrichCSV.groovy target/bundle/windup-operator/manifests/windup-operator.clusterserviceversion.yaml
- name: Init local Registry
run: |
docker run -d -p 5000:5000 --name registry registry:2
sleep 5
- name: Create bundle image
run: |
# Bundle
BUNDLE_IMAGE=localhost:5000/windup-operator-bundle:0.0.0
docker build -t $BUNDLE_IMAGE -f target/bundle/windup-operator/bundle.Dockerfile target/bundle/windup-operator
docker push $BUNDLE_IMAGE
# Catalog
CATALOG_IMAGE=localhost:5000/windup-operator-catalog:0.0.0
opm index add --bundles $BUNDLE_IMAGE --tag $CATALOG_IMAGE --use-http --build-tool docker
# Save container images
docker save -o windup-bundle-container-image.tar $BUNDLE_IMAGE
docker save -o windup-catalog-container-image.tar $CATALOG_IMAGE
- name: Upload container image
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
windup-bundle-container-image.tar
windup-catalog-container-image.tar
e2e-tests:
needs: [ operator-container, catalog-container ]
name: E2E Tests
runs-on: ubuntu-latest
strategy:
matrix:
kubernetes_version: [ v1.19.16, v1.20.15, v1.21.14, v1.22.13, v1.23.10, v1.24.4 ]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: maven
- name: Maven package
run: |
mvn package -DskipTests
- name: Load and config images
run: |
docker load -i artifacts/windup-operator-container-image.tar
docker load -i artifacts/windup-bundle-container-image.tar
docker load -i artifacts/windup-catalog-container-image.tar
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: v1.28.0
kubernetes version: ${{ matrix.kubernetes_version }}
start args: --insecure-registry "10.0.0.0/24" --addons=registry,ingress
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Minikube
run: |
# Install OLM
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.22.0/install.sh | bash -s v0.22.0
# Load images
minikube image load localhost:5000/windup-operator:0.0.0
minikube image load localhost:5000/windup-operator-bundle:0.0.0
minikube image load localhost:5000/windup-operator-catalog:0.0.0
# Push images to internal registry
docker push localhost:5000/windup-operator:0.0.0
docker push localhost:5000/windup-operator-bundle:0.0.0
docker push localhost:5000/windup-operator-catalog:0.0.0
# Pull images
docker pull quay.io/windupeng/windup-web-openshift:latest
docker pull quay.io/windupeng/windup-web-openshift-messaging-executor:latest
docker pull registry.access.redhat.com/rhscl/postgresql-10-rhel7:1
- name: Install operator
run: |
kubectl create ns mynamespace
# Create CRD
kubectl apply -f target/kubernetes/windups.windup.jboss.org-v1.yml
# Create custom catalog
kubectl create -f scripts/windup-operator.yaml
# Verify
sleep 10;
kubectl get pods -n olm --selector=olm.catalogSource=windup-catalog-source
kubectl get csv -n olm
while ! kubectl get deployment/windup-operator -n mynamespace
do
echo "Waiting for operator to be created"
sleep 5;
done
kubectl wait deployment/windup-operator --for condition=available --timeout=-1s -n mynamespace
- name: Instantiate operator
run: |
kubectl -n mynamespace apply -f scripts/windup.yaml
# Function to verify deployments
verify_deployment() {
deployment_name=$1
timeout=$2
while ! kubectl get deployment/$deployment_name -n mynamespace
do
echo "Waiting for $deployment_name to be created"
sleep 5;
done
kubectl wait deployment/$deployment_name --for condition=available --timeout=$timeout -n mynamespace || true
kubectl get deployment/$deployment_name -n mynamespace
}
# Verify DB
verify_deployment test-app-postgresql-deployment -1s
# Verify Web
verify_deployment test-app-windup-web-deployment -1s
# Verify Executor
verify_deployment test-app-windup-executor-deployment 1s
# Verify Ingress
external_ip=""
while [[ -z $external_ip ]]
do
external_ip=$(kubectl get ingress test-app-windup-web-ingress --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n mynamespace);
echo "Waiting for end point...current=$external_ip"
sleep 10;
done
echo "Windup ready to be served at: $external_ip"