1
name: Keycloak Operator CI
12
MAVEN_ARGS: "-B -nsu -Daether.connector.http.connectionMaxTtl=25"
13
MINIKUBE_VERSION: v1.31.2
14
KUBERNETES_VERSION: v1.24.17 # OCP 4.11
21
# Only cancel jobs for PR updates
22
group: operator-ci-${{ github.ref }}
23
cancel-in-progress: true
28
name: Check conditional workflows and jobs
29
runs-on: ubuntu-latest
31
operator: ${{ steps.conditional.outputs.operator }}
33
- uses: actions/checkout@v4
36
uses: ./.github/actions/conditional
38
token: ${{ secrets.GITHUB_TOKEN }}
41
name: Build distribution
42
if: needs.conditional.outputs.operator == 'true'
43
runs-on: ubuntu-latest
46
- uses: actions/checkout@v4
48
- name: Build Keycloak
49
uses: ./.github/actions/build-keycloak
56
runs-on: ubuntu-latest
59
- uses: actions/checkout@v4
63
run: echo "version_local=0.0.1-${GITHUB_SHA::6}" >> $GITHUB_ENV
66
uses: ./.github/actions/java-setup
68
- name: Setup Minikube-Kubernetes
69
uses: manusa/actions-setup-minikube@v2.10.0
71
minikube version: ${{ env.MINIKUBE_VERSION }}
72
kubernetes version: ${{ env.KUBERNETES_VERSION }}
73
github token: ${{ secrets.GITHUB_TOKEN }}
75
start args: --addons=ingress
77
- name: Download keycloak distribution
78
id: download-keycloak-dist
79
uses: actions/download-artifact@v3
82
path: quarkus/container
84
- name: Build Keycloak Docker images
86
eval $(minikube -p minikube docker-env)
87
(cd quarkus/container && docker build --build-arg KEYCLOAK_DIST=$(ls keycloak-*.tar.gz) . -t keycloak:${{ env.version_local }})
88
(cd operator && ./scripts/build-testing-docker-images.sh ${{ env.version_local }} keycloak custom-keycloak)
90
- name: Test operator running locally
92
./mvnw install -Poperator -pl :keycloak-operator -am \
93
-Dquarkus.kubernetes.image-pull-policy=IfNotPresent \
94
-Dkc.operator.keycloak.image=keycloak:${{ env.version_local }} \
95
-Dtest.operator.custom.image=custom-keycloak:${{ env.version_local }} \
96
-Dkc.operator.keycloak.image-pull-policy=Never
100
runs-on: ubuntu-latest
103
- uses: actions/checkout@v4
107
run: echo "version_remote=0.0.1-${GITHUB_SHA::6}" >> $GITHUB_ENV
110
uses: ./.github/actions/java-setup
112
- name: Setup Minikube-Kubernetes
113
uses: manusa/actions-setup-minikube@v2.10.0
115
minikube version: ${{ env.MINIKUBE_VERSION }}
116
kubernetes version: ${{ env.KUBERNETES_VERSION }}
117
github token: ${{ secrets.GITHUB_TOKEN }}
119
start args: --addons=ingress
121
- name: Download keycloak distribution
122
id: download-keycloak-dist
123
uses: actions/download-artifact@v3
126
path: quarkus/container
128
- name: Build Keycloak Docker images
130
eval $(minikube -p minikube docker-env)
131
(cd quarkus/container && docker build --build-arg KEYCLOAK_DIST=$(ls keycloak-*.tar.gz) . -t keycloak:${{ env.version_remote }})
132
(cd operator && ./scripts/build-testing-docker-images.sh ${{ env.version_remote }} keycloak custom-keycloak)
134
- name: Test operator running in cluster
136
eval $(minikube -p minikube docker-env)
137
./mvnw install -Poperator -pl :keycloak-operator -am \
138
-Dquarkus.container-image.build=true \
139
-Dquarkus.kubernetes.image-pull-policy=IfNotPresent \
140
-Dkc.operator.keycloak.image=keycloak:${{ env.version_remote }} \
141
-Dquarkus.kubernetes.env.vars.kc-operator-keycloak-image-pull-policy=Never \
142
-Dtest.operator.custom.image=custom-keycloak:${{ env.version_remote }} \
143
--no-transfer-progress -Dtest.operator.deployment=remote
146
name: Test OLM installation
147
runs-on: ubuntu-latest
150
- uses: actions/checkout@v4
153
uses: ./.github/actions/java-setup
155
- name: Setup Minikube-Kubernetes
156
uses: manusa/actions-setup-minikube@v2.10.0
158
minikube version: ${{ env.MINIKUBE_VERSION }}
159
kubernetes version: ${{ env.KUBERNETES_VERSION }}
160
github token: ${{ secrets.GITHUB_TOKEN }}
164
uses: redhat-actions/openshift-tools-installer@v1
170
run: sudo snap install yq
173
working-directory: operator
174
run: ./scripts/install-olm.sh
176
- name: Download keycloak distribution
177
id: download-keycloak-dist
178
uses: actions/download-artifact@v3
181
path: quarkus/container
183
- name: Arrange OLM test installation
184
working-directory: operator
186
eval $(minikube -p minikube docker-env)
187
./scripts/olm-testing.sh ${GITHUB_SHA::6}
189
- name: Deploy an example Keycloak and wait for it to be ready
190
working-directory: operator
192
kubectl apply -f src/test/resources/example-postgres.yaml
193
./scripts/check-crds-installed.sh
194
kubectl apply -f src/test/resources/example-db-secret.yaml
195
kubectl apply -f src/test/resources/example-tls-secret.yaml
196
kubectl apply -f src/test/resources/example-keycloak.yaml
197
kubectl apply -f src/test/resources/example-realm.yaml
198
# Wait for the CRs to be ready
199
./scripts/check-examples-installed.sh
201
- name: Single namespace cleanup
202
working-directory: operator
204
kubectl delete -f src/test/resources/example-postgres.yaml
205
kubectl delete -f src/test/resources/example-db-secret.yaml
206
kubectl delete -f src/test/resources/example-tls-secret.yaml
207
kubectl delete -f src/test/resources/example-keycloak.yaml
208
kubectl delete -f src/test/resources/example-realm.yaml
210
- name: Arrange OLM test installation for all namespaces
211
working-directory: operator
213
kubectl patch csv keycloak-operator.v86400000.0.0 --type merge --patch '{"spec": {"installModes": [{"type": "AllNamespaces","supported": true}]}}'
214
kubectl patch operatorgroup og --type json --patch '[{"op":"remove","path":"/spec/targetNamespaces"}]'
216
- name: Deploy an example Keycloak in a different namespace and wait for it to be ready
217
working-directory: operator
219
kubectl create ns keycloak
220
kubectl apply -f src/test/resources/example-postgres.yaml -n keycloak
221
kubectl apply -f src/test/resources/example-db-secret.yaml -n keycloak
222
kubectl apply -f src/test/resources/example-tls-secret.yaml -n keycloak
223
kubectl apply -f src/test/resources/example-keycloak.yaml -n keycloak
224
kubectl apply -f src/test/resources/example-realm.yaml -n keycloak
225
# Wait for the CRs to be ready
226
./scripts/check-examples-installed.sh keycloak
229
name: Status Check - Keycloak Operator CI
237
runs-on: ubuntu-latest
239
- uses: actions/checkout@v4
240
- uses: ./.github/actions/status-check
242
jobs: ${{ toJSON(needs) }}