Skip to content

Commit 2266829

Browse files
committed
chore: allow CI deployments on Azure
1 parent cc6d251 commit 2266829

1 file changed

Lines changed: 152 additions & 37 deletions

File tree

.github/workflows/pull-request-test.yml

Lines changed: 152 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,35 @@ jobs:
5353
path: docs/_build/html/
5454

5555
check-deploy:
56-
name: Analyze deploy string
56+
name: Analyze deploy strings
5757
runs-on: ubuntu-24.04
5858
outputs:
59-
pr-contains-string: ${{ steps.deploy-comment.outputs.pr-contains-string }}
60-
renku-core: ${{ steps.deploy-comment.outputs.renku-core}}
61-
renku-gateway: ${{ steps.deploy-comment.outputs.renku-gateway}}
62-
renku-graph: ${{ steps.deploy-comment.outputs.renku-graph}}
63-
renku-notebooks: ${{ steps.deploy-comment.outputs.renku-notebooks}}
64-
renku-ui: ${{ steps.deploy-comment.outputs.renku-ui}}
65-
renku-data-services: ${{ steps.deploy-comment.outputs.renku-data-services}}
66-
amalthea: ${{ steps.deploy-comment.outputs.amalthea}}
67-
amalthea-sessions: ${{ steps.deploy-comment.outputs.amalthea-sessions}}
68-
test-enabled: ${{ steps.deploy-comment.outputs.test-enabled}}
69-
test-legacy-enabled: ${{ steps.deploy-comment.outputs.test-legacy-enabled}}
70-
extra-values: ${{ steps.deploy-comment.outputs.extra-values}}
59+
switch-deploy: ${{ steps.deploy-comment.outputs.pr-contains-string }}
60+
azure-deploy: ${{ steps.deploy-comment-azure.outputs.pr-contains-string }}
61+
renku-core: ${{ steps.deploy-comment.outputs.renku-core || steps.deploy-comment-azure.outputs.renku-core }}
62+
renku-gateway: ${{ steps.deploy-comment.outputs.renku-gateway || steps.deploy-comment-azure.outputs.renku-gateway }}
63+
renku-graph: ${{ steps.deploy-comment.outputs.renku-graph || steps.deploy-comment-azure.outputs.renku-graph }}
64+
renku-notebooks: ${{ steps.deploy-comment.outputs.renku-notebooks || steps.deploy-comment-azure.outputs.renku-notebooks }}
65+
renku-ui: ${{ steps.deploy-comment.outputs.renku-ui || steps.deploy-comment-azure.outputs.renku-ui }}
66+
renku-data-services: ${{ steps.deploy-comment.outputs.renku-data-services || steps.deploy-comment-azure.outputs.renku-data-services }}
67+
amalthea: ${{ steps.deploy-comment.outputs.amalthea || steps.deploy-comment-azure.outputs.amalthea }}
68+
amalthea-sessions: ${{ steps.deploy-comment.outputs.amalthea-sessions || steps.deploy-comment-azure.outputs.amalthea-sessions }}
69+
test-enabled: ${{ steps.deploy-comment.outputs.test-enabled || steps.deploy-comment-azure.outputs.test-enabled }}
70+
test-legacy-enabled: ${{ steps.deploy-comment.outputs.test-legacy-enabled || steps.deploy-comment-azure.outputs.test-legacy-enabled }}
71+
extra-values: ${{ steps.deploy-comment.outputs.extra-values || steps.deploy-comment-azure.outputs.extra-values }}
7172
steps:
7273
- id: deploy-comment
73-
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.17.0
74+
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.18.1
7475
with:
7576
pr_ref: ${{ github.event.number }}
77+
- id: deploy-comment-azure
78+
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.18.1
79+
with:
80+
string: /AzureDeploy
81+
pr_ref: ${{ github.event.number }}
7682

7783
deploy-pr:
78-
name: Deploy
84+
name: Deploy on SWITCH
7985
runs-on: ubuntu-24.04
8086
needs: [check-deploy]
8187
permissions:
@@ -86,8 +92,8 @@ jobs:
8692
url: https://ci-renku-${{ github.event.number }}.dev.renku.ch
8793
steps:
8894
- uses: actions/checkout@v4.1.7
89-
- name: Find deplyoment url
90-
if: needs.check-deploy.outputs.pr-contains-string == 'true'
95+
- name: Find deployment url
96+
if: needs.check-deploy.outputs.switch-deploy == 'true'
9197
uses: peter-evans/find-comment@v3
9298
id: deploymentUrlMessage
9399
with:
@@ -96,16 +102,16 @@ jobs:
96102
body-includes: "You can access the deployment of this PR at"
97103
- name: Create comment deployment url
98104
if: steps.deploymentUrlMessage.outputs.comment-id == 0 &&
99-
needs.check-deploy.outputs.pr-contains-string == 'true'
105+
needs.check-deploy.outputs.switch-deploy == 'true'
100106
uses: peter-evans/create-or-update-comment@v4
101107
with:
102108
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
103109
issue-number: ${{ github.event.pull_request.number }}
104110
body: |
105111
You can access the deployment of this PR at https://ci-renku-${{ github.event.number }}.dev.renku.ch
106112
- name: renku build and deploy
107-
if: needs.check-deploy.outputs.pr-contains-string == 'true'
108-
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.17.0
113+
if: needs.check-deploy.outputs.switch-deploy == 'true'
114+
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.18.1
109115
env:
110116
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
111117
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
@@ -128,13 +134,92 @@ jobs:
128134
amalthea_sessions: "${{ needs.check-deploy.outputs.amalthea-sessions }}"
129135
extra_values: "${{ needs.check-deploy.outputs.extra-values }}"
130136

137+
deploy-pr-azure:
138+
name: Deploy on Azure
139+
runs-on: ubuntu-24.04
140+
needs: [check-deploy]
141+
permissions:
142+
pull-requests: write
143+
id-token: write
144+
if: github.event.action != 'closed'
145+
steps:
146+
- uses: actions/checkout@v4.1.7
147+
- name: Find deployment url
148+
if: needs.check-deploy.outputs.azure-deploy == 'true'
149+
uses: peter-evans/find-comment@v3
150+
id: deploymentUrlMessage
151+
with:
152+
issue-number: ${{ github.event.pull_request.number }}
153+
comment-author: "RenkuBot"
154+
body-includes: "You can access the deployment of this PR at"
155+
156+
- name: Create comment deployment url
157+
if: steps.deploymentUrlMessage.outputs.comment-id == 0 &&
158+
needs.check-deploy.outputs.azure-deploy == 'true'
159+
uses: peter-evans/create-or-update-comment@v4
160+
with:
161+
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
162+
issue-number: ${{ github.event.pull_request.number }}
163+
body: |
164+
You can access the deployment of this PR at ${{ format('https://ci-renku-{0}.dev.azure.renku.ch', github.event.number) }}
165+
166+
- name: Azure login
167+
if: needs.check-deploy.outputs.azure-deploy == 'true'
168+
uses: azure/login@v2
169+
with:
170+
client-id: ${{ secrets.CI_RENKU_AZURE_CLIENT_ID }}
171+
tenant-id: ${{ secrets.CI_RENKU_AZURE_TENANT_ID }}
172+
subscription-id: ${{ secrets.CI_RENKU_AZURE_SUBSCRIPTION_ID }}
173+
- uses: azure/aks-set-context@v4
174+
if: needs.check-deploy.outputs.azure-deploy == 'true'
175+
with:
176+
resource-group: "renku-dev"
177+
cluster-name: "aks-switzerlandnorth-renku-dev"
178+
179+
- name: Get AKS credentials
180+
if: needs.check-deploy.outputs.azure-deploy == 'true'
181+
run: |
182+
az aks get-credentials --resource-group renku-dev --name aks-switzerlandnorth-renku-dev --file "${{ github.workspace }}/renkubot-kube.config"
183+
chmod 600 "${{ github.workspace }}/renkubot-kube.config"
184+
185+
echo "RENKUBOT_KUBECONFIG<<EOF" >> $GITHUB_ENV
186+
cat "${{ github.workspace }}/renkubot-kube.config" >> $GITHUB_ENV
187+
echo "EOF" >> $GITHUB_ENV
188+
189+
- name: renku build and deploy
190+
if: needs.check-deploy.outputs.azure-deploy == 'true'
191+
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.18.1
192+
env:
193+
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
194+
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
195+
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
196+
KUBECONFIG: "${{ github.workspace }}/renkubot-kube.config"
197+
RENKU_RELEASE: ci-renku-${{ github.event.number }}
198+
RENKU_VALUES_FILE: "${{ github.workspace }}/values.yaml"
199+
RENKU_VALUES: minimal-deployment/minimal-deployment-values.yaml
200+
RENKUBOT_KUBECONFIG: ${{ env.RENKUBOT_KUBECONFIG }}
201+
TEST_ARTIFACTS_PATH: "tests-artifacts-${{ github.sha }}"
202+
KUBERNETES_CLUSTER_FQDN: 'dev.azure.renku.ch'
203+
RENKU_ANONYMOUS_SESSIONS: 'true'
204+
ENABLE_NGINX_INGRESS: 'true'
205+
renku: "@${{ github.head_ref }}"
206+
renku_core: "${{ needs.check-deploy.outputs.renku-core }}"
207+
renku_gateway: "${{ needs.check-deploy.outputs.renku-gateway }}"
208+
renku_graph: "${{ needs.check-deploy.outputs.renku-graph }}"
209+
renku_notebooks: "${{ needs.check-deploy.outputs.renku-notebooks }}"
210+
renku_ui: "${{ needs.check-deploy.outputs.renku-ui }}"
211+
renku_data_services: "${{ needs.check-deploy.outputs.renku-data-services }}"
212+
amalthea: "${{ needs.check-deploy.outputs.amalthea }}"
213+
amalthea_sessions: "${{ needs.check-deploy.outputs.amalthea-sessions }}"
214+
extra_values: "${{ needs.check-deploy.outputs.extra-values }}"
215+
131216
legacy-scala-tests:
132217
name: Legacy Scala tests
133218
runs-on: ubuntu-24.04
134-
needs: [check-deploy, deploy-pr]
135-
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-legacy-enabled == 'true'
219+
needs: [check-deploy, deploy-pr, deploy-pr-azure]
220+
if: github.event.action != 'closed' && (needs.check-deploy.outputs.switch-deploy == 'true' || needs.check-deploy.outputs.azure-deploy == 'true') && needs.check-deploy.outputs.test-legacy-enabled == 'true'
136221
steps:
137-
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.17.0
222+
- uses: SwissDataScienceCenter/renku-actions/test-renku@v1.18.1
138223
with:
139224
kubeconfig: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
140225
renku-release: ci-renku-${{ github.event.number }}
@@ -146,8 +231,8 @@ jobs:
146231
legacy-cypress-acceptance-tests:
147232
name: Legacy Cypress tests
148233
runs-on: ubuntu-24.04
149-
needs: [check-deploy, deploy-pr]
150-
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-legacy-enabled == 'true'
234+
needs: [check-deploy, deploy-pr, deploy-pr-azure]
235+
if: github.event.action != 'closed' && (needs.check-deploy.outputs.switch-deploy == 'true' || needs.check-deploy.outputs.azure-deploy == 'true') && needs.check-deploy.outputs.test-legacy-enabled == 'true'
151236
strategy:
152237
fail-fast: false
153238
matrix:
@@ -162,8 +247,8 @@ jobs:
162247
rstudioSession,
163248
]
164249
steps:
165-
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.17.0
166-
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-enabled == 'true'
250+
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.18.1
251+
if: github.event.action != 'closed' && (needs.check-deploy.outputs.switch-deploy == 'true' || needs.check-deploy.outputs.azure-deploy == 'true') && needs.check-deploy.outputs.test-legacy-enabled == 'true'
167252
with:
168253
e2e-target: ${{ matrix.tests }}
169254
renku-reference: ${{ github.ref }}
@@ -173,7 +258,7 @@ jobs:
173258
cypress-acceptance-tests:
174259
name: Cypress tests
175260
runs-on: ubuntu-24.04
176-
needs: [check-deploy, deploy-pr]
261+
needs: [check-deploy, deploy-pr, deploy-pr-azure]
177262
strategy:
178263
fail-fast: false
179264
matrix:
@@ -188,11 +273,12 @@ jobs:
188273
sessionBasics,
189274
]
190275
steps:
191-
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.17.0
192-
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-enabled == 'true'
276+
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.18.1
277+
if: github.event.action != 'closed' && (needs.check-deploy.outputs.switch-deploy == 'true' || needs.check-deploy.outputs.azure-deploy == 'true') && needs.check-deploy.outputs.test-enabled == 'true'
193278
with:
194279
e2e-folder: cypress/e2e/v2/
195280
e2e-target: ${{ matrix.tests }}
281+
kubernetes-cluster-fqdn: ${{ needs.check-deploy.outputs.azure-deploy == 'true' && 'dev.azure.renku.ch' || '' }}
196282
renku-reference: ${{ github.ref }}
197283
renku-release: ci-renku-${{ github.event.number }}
198284
test-user-password: ${{ secrets.RENKU_BOT_DEV_PASSWORD }}
@@ -204,7 +290,7 @@ jobs:
204290
steps:
205291
- name: Check deploy string
206292
if: ${{
207-
needs.check-deploy.outputs.pr-contains-string == 'true'
293+
needs.check-deploy.outputs.switch-deploy == 'true'
208294
&& startsWith(github.base_ref, 'release-')
209295
&& (
210296
needs.check-deploy.outputs.renku-core != null
@@ -223,30 +309,59 @@ jobs:
223309
name: Cleanup
224310
runs-on: ubuntu-24.04
225311
needs: [check-deploy]
226-
if: github.event.action == 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true'
312+
if: github.event.action == 'closed' && (needs.check-deploy.outputs.switch-deploy == 'true' || needs.check-deploy.outputs.azure-deploy == 'true')
227313
permissions:
228314
pull-requests: write
315+
id-token: write
229316
steps:
230-
- name: Find deplyoment url
317+
- name: Find deployment url
231318
uses: peter-evans/find-comment@v3
232319
id: deploymentUrlMessage
233320
with:
234321
issue-number: ${{ github.event.pull_request.number }}
235322
comment-author: "RenkuBot"
236-
body-includes: "Tearing down the temporary RenkuLab deplyoment"
323+
body-includes: "Tearing down the temporary RenkuLab deployment"
237324
- name: Create comment deployment url
238325
if: steps.deploymentUrlMessage.outputs.comment-id == 0
239326
uses: peter-evans/create-or-update-comment@v4
240327
with:
241328
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
242329
issue-number: ${{ github.event.pull_request.number }}
243330
body: |
244-
Tearing down the temporary RenkuLab deplyoment for this PR.
331+
Tearing down the temporary RenkuLab deployment for this PR.
332+
333+
# Azure-specific setup
334+
- name: Azure login
335+
if: needs.check-deploy.outputs.azure-deploy == 'true'
336+
uses: azure/login@v2
337+
with:
338+
client-id: ${{ secrets.CI_RENKU_AZURE_CLIENT_ID }}
339+
tenant-id: ${{ secrets.CI_RENKU_AZURE_TENANT_ID }}
340+
subscription-id: ${{ secrets.CI_RENKU_AZURE_SUBSCRIPTION_ID }}
341+
342+
- uses: azure/aks-set-context@v4
343+
if: needs.check-deploy.outputs.azure-deploy == 'true'
344+
with:
345+
resource-group: "renku-dev"
346+
cluster-name: "aks-switzerlandnorth-renku-dev"
347+
348+
- name: Get AKS credentials
349+
if: needs.check-deploy.outputs.azure-deploy == 'true'
350+
run: |
351+
az aks get-credentials --resource-group renku-dev --name aks-switzerlandnorth-renku-dev --file "${{ github.workspace }}/renkubot-kube.config"
352+
chmod 600 "${{ github.workspace }}/renkubot-kube.config"
353+
354+
# Create a multiline env var with the content for RENKUBOT_KUBECONFIG
355+
echo "RENKUBOT_KUBECONFIG<<EOF" >> $GITHUB_ENV
356+
cat "${{ github.workspace }}/renkubot-kube.config" >> $GITHUB_ENV
357+
echo "EOF" >> $GITHUB_ENV
358+
359+
# Cleanup for both standard and Azure deployments
245360
- name: renku teardown
246-
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.17.0
361+
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.18.1
247362
env:
248363
HELM_RELEASE_REGEX: "^ci-renku-${{ github.event.number }}$"
249364
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
250-
RENKUBOT_KUBECONFIG: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
365+
RENKUBOT_KUBECONFIG: ${{ needs.check-deploy.outputs.azure-deploy == 'true' && env.RENKUBOT_KUBECONFIG || secrets.RENKUBOT_DEV_KUBECONFIG }}
251366
MAX_AGE_SECONDS: 0
252367
DELETE_NAMESPACE: "true"

0 commit comments

Comments
 (0)