Keycloak

Форк
0
/
operator-ci.yml 
242 строки · 8.1 Кб
1
name: Keycloak Operator CI
2

3
on:
4
  push:
5
    branches-ignore:
6
      - main
7
      - dependabot/**
8
  pull_request:
9
  workflow_dispatch:
10

11
env:
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
15

16
defaults:
17
  run:
18
    shell: bash
19

20
concurrency:
21
  # Only cancel jobs for PR updates
22
  group: operator-ci-${{ github.ref }}
23
  cancel-in-progress: true
24

25
jobs:
26

27
  conditional:
28
    name: Check conditional workflows and jobs
29
    runs-on: ubuntu-latest
30
    outputs:
31
      operator: ${{ steps.conditional.outputs.operator }}
32
    steps:
33
      - uses: actions/checkout@v4
34

35
      - id: conditional
36
        uses: ./.github/actions/conditional
37
        with:
38
          token: ${{ secrets.GITHUB_TOKEN }}
39

40
  build:
41
    name: Build distribution
42
    if: needs.conditional.outputs.operator == 'true'
43
    runs-on: ubuntu-latest
44
    needs: conditional
45
    steps:
46
      - uses: actions/checkout@v4
47

48
      - name: Build Keycloak
49
        uses: ./.github/actions/build-keycloak
50
        with:
51
          upload-m2-repo: false
52
          upload-dist: true
53

54
  test-local:
55
    name: Test local
56
    runs-on: ubuntu-latest
57
    needs: [build]
58
    steps:
59
      - uses: actions/checkout@v4
60

61
      - name: Set version
62
        id: vars
63
        run: echo "version_local=0.0.1-${GITHUB_SHA::6}" >> $GITHUB_ENV
64

65
      - name: Setup Java
66
        uses: ./.github/actions/java-setup
67

68
      - name: Setup Minikube-Kubernetes
69
        uses: manusa/actions-setup-minikube@v2.10.0
70
        with:
71
          minikube version: ${{ env.MINIKUBE_VERSION }}
72
          kubernetes version: ${{ env.KUBERNETES_VERSION }}
73
          github token: ${{ secrets.GITHUB_TOKEN }}
74
          driver: docker
75
          start args: --addons=ingress
76

77
      - name: Download keycloak distribution
78
        id: download-keycloak-dist
79
        uses: actions/download-artifact@v3
80
        with:
81
          name: keycloak-dist
82
          path: quarkus/container
83

84
      - name: Build Keycloak Docker images
85
        run: |
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)
89

90
      - name: Test operator running locally
91
        run: |
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
97

98
  test-remote:
99
    name: Test remote
100
    runs-on: ubuntu-latest
101
    needs: [build]
102
    steps:
103
      - uses: actions/checkout@v4
104

105
      - name: Set version
106
        id: vars
107
        run: echo "version_remote=0.0.1-${GITHUB_SHA::6}" >> $GITHUB_ENV
108

109
      - name: Setup Java
110
        uses: ./.github/actions/java-setup
111

112
      - name: Setup Minikube-Kubernetes
113
        uses: manusa/actions-setup-minikube@v2.10.0
114
        with:
115
          minikube version: ${{ env.MINIKUBE_VERSION }}
116
          kubernetes version: ${{ env.KUBERNETES_VERSION }}
117
          github token: ${{ secrets.GITHUB_TOKEN }}
118
          driver: docker
119
          start args: --addons=ingress
120

121
      - name: Download keycloak distribution
122
        id: download-keycloak-dist
123
        uses: actions/download-artifact@v3
124
        with:
125
          name: keycloak-dist
126
          path: quarkus/container
127

128
      - name: Build Keycloak Docker images
129
        run: |
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)
133

134
      - name: Test operator running in cluster
135
        run: |
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
144

145
  test-olm:
146
    name: Test OLM installation
147
    runs-on: ubuntu-latest
148
    needs: [build]
149
    steps:
150
      - uses: actions/checkout@v4
151

152
      - name: Setup Java
153
        uses: ./.github/actions/java-setup
154

155
      - name: Setup Minikube-Kubernetes
156
        uses: manusa/actions-setup-minikube@v2.10.0
157
        with:
158
          minikube version: ${{ env.MINIKUBE_VERSION }}
159
          kubernetes version: ${{ env.KUBERNETES_VERSION }}
160
          github token: ${{ secrets.GITHUB_TOKEN }}
161
          driver: docker
162

163
      - name: Install OPM
164
        uses: redhat-actions/openshift-tools-installer@v1
165
        with:
166
          source: github
167
          opm: 1.21.0
168

169
      - name: Install Yq
170
        run: sudo snap install yq
171

172
      - name: Install OLM
173
        working-directory: operator
174
        run: ./scripts/install-olm.sh
175

176
      - name: Download keycloak distribution
177
        id: download-keycloak-dist
178
        uses: actions/download-artifact@v3
179
        with:
180
          name: keycloak-dist
181
          path: quarkus/container
182

183
      - name: Arrange OLM test installation
184
        working-directory: operator
185
        run: |
186
          eval $(minikube -p minikube docker-env)
187
          ./scripts/olm-testing.sh ${GITHUB_SHA::6}
188

189
      - name: Deploy an example Keycloak and wait for it to be ready
190
        working-directory: operator
191
        run: |
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
200
          
201
      - name: Single namespace cleanup
202
        working-directory: operator
203
        run: |
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
209
      
210
      - name: Arrange OLM test installation for all namespaces
211
        working-directory: operator
212
        run: |
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"}]'
215
       
216
      - name: Deploy an example Keycloak in a different namespace and wait for it to be ready
217
        working-directory: operator
218
        run: |
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
227

228
  check:
229
    name: Status Check - Keycloak Operator CI
230
    if: always()
231
    needs:
232
      - conditional
233
      - build
234
      - test-local
235
      - test-remote
236
      - test-olm
237
    runs-on: ubuntu-latest
238
    steps:
239
      - uses: actions/checkout@v4
240
      - uses: ./.github/actions/status-check
241
        with:
242
          jobs: ${{ toJSON(needs) }}
243

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.