Skip to content

Commit 3c7a7f3

Browse files
committed
WIP: create action to deploy and test on Azure
1 parent fed07a3 commit 3c7a7f3

1 file changed

Lines changed: 162 additions & 0 deletions

File tree

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Test PR
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
- reopened
8+
- closed
9+
- edited
10+
merge_group:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
check-deploy:
18+
name: Analyze deploy string Azure
19+
runs-on: ubuntu-24.04
20+
outputs:
21+
pr-contains-string: ${{ steps.deploy-comment.outputs.pr-contains-string }}
22+
renku-core: ${{ steps.deploy-comment.outputs.renku-core}}
23+
renku-gateway: ${{ steps.deploy-comment.outputs.renku-gateway}}
24+
renku-graph: ${{ steps.deploy-comment.outputs.renku-graph}}
25+
renku-notebooks: ${{ steps.deploy-comment.outputs.renku-notebooks}}
26+
renku-ui: ${{ steps.deploy-comment.outputs.renku-ui}}
27+
renku-data-services: ${{ steps.deploy-comment.outputs.renku-data-services}}
28+
amalthea: ${{ steps.deploy-comment.outputs.amalthea}}
29+
amalthea-sessions: ${{ steps.deploy-comment.outputs.amalthea-sessions}}
30+
test-enabled: ${{ steps.deploy-comment.outputs.test-enabled}}
31+
extra-values: ${{ steps.deploy-comment.outputs.extra-values}}
32+
steps:
33+
- uses: actions/checkout@v4.1.7
34+
- id: deploy-comment
35+
uses: SwissDataScienceCenter/renku-actions/check-pr-description@v1.15.1
36+
with:
37+
string: /AzureDeploy
38+
pr_ref: ${{ github.event.number }}
39+
40+
deploy-pr:
41+
name: Deploy on Azure
42+
if: github.event.action != 'closed'
43+
needs: [check-deploy]
44+
runs-on: ubuntu-24.04
45+
environment:
46+
name: ci-renku-${{ github.event.number }}
47+
url: https://ci-renku-${{ github.event.number }}.dev.renku.ch
48+
steps:
49+
- name: Azure login
50+
uses: azure/login@v2
51+
with:
52+
client-id: ${{ secrets.CI_RENKU_AZURE_CLIENT_ID }}
53+
tenant-id: ${{ secrets.CI_RENKU_AZURE_TENANT_ID }}
54+
subscription-id: ${{ secrets.CI_RENKU_AZURE_SUBSCRIPTION_ID }}
55+
- uses: azure/aks-set-context@v4
56+
with:
57+
resource-group: "renku-dev"
58+
cluster-name: "aks-switzerlandnorth-renku-dev"
59+
- uses: actions/checkout@v4.1.7
60+
- run: ls $KUBECONFIG
61+
- name: renku build and deploy
62+
if: needs.check-deploy.outputs.pr-contains-string == 'true'
63+
uses: SwissDataScienceCenter/renku-actions/deploy-renku@v1.15.1
64+
env:
65+
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
66+
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
67+
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
68+
KUBECONFIG: $KUBECONFIG
69+
RENKU_ANONYMOUS_SESSIONS: true
70+
RENKU_RELEASE: ci-renku-${{ github.event.number }}
71+
RENKU_VALUES_FILE: "${{ github.workspace }}/values.yaml"
72+
RENKU_VALUES: minimal-deployment/minimal-deployment-values.yaml
73+
RENKUBOT_KUBECONFIG: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
74+
TEST_ARTIFACTS_PATH: "tests-artifacts-${{ github.sha }}"
75+
renku: "@${{ github.head_ref }}"
76+
renku_core: "${{ needs.check-deploy.outputs.renku-core }}"
77+
renku_gateway: "${{ needs.check-deploy.outputs.renku-gateway }}"
78+
renku_graph: "${{ needs.check-deploy.outputs.renku-graph }}"
79+
renku_notebooks: "${{ needs.check-deploy.outputs.renku-notebooks }}"
80+
renku_ui: "${{ needs.check-deploy.outputs.renku-ui }}"
81+
renku_data_services: "${{ needs.check-deploy.outputs.renku-data-services }}"
82+
amalthea: "${{ needs.check-deploy.outputs.amalthea }}"
83+
amalthea_sessions: "${{ needs.check-deploy.outputs.amalthea-sessions }}"
84+
extra_values: "${{ needs.check-deploy.outputs.extra-values }}"
85+
- name: Check existing renkubot comment
86+
if: needs.check-deploy.outputs.pr-contains-string == 'true'
87+
uses: peter-evans/find-comment@v3
88+
id: findcomment
89+
with:
90+
issue-number: ${{ github.event.pull_request.number }}
91+
comment-author: "RenkuBot"
92+
- name: Create comment pre deploy
93+
if: ${{ steps.findcomment.outputs.comment-id == 0 &&
94+
needs.check-deploy.outputs.pr-contains-string == 'true' }}
95+
uses: peter-evans/create-or-update-comment@v4
96+
with:
97+
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
98+
issue-number: ${{ github.event.pull_request.number }}
99+
body: |
100+
You can access the deployment of this PR at https://ci-renku-${{ github.event.number }}.dev.renku.ch
101+
102+
cypress-acceptance-tests:
103+
name: Cypress tests on Azure
104+
needs: [check-deploy, deploy-pr]
105+
runs-on: ubuntu-24.04
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
tests:
110+
[
111+
anonymousNavigation,
112+
dashboardV2,
113+
groupBasics,
114+
projectBasics,
115+
projectResources,
116+
searchEntities,
117+
sessionBasics,
118+
]
119+
steps:
120+
- uses: SwissDataScienceCenter/renku-actions/test-renku-cypress@v1.14.0
121+
if: github.event.action != 'closed' && needs.check-deploy.outputs.pr-contains-string == 'true' && needs.check-deploy.outputs.test-enabled == 'true'
122+
with:
123+
e2e-folder: cypress/e2e/v2/
124+
e2e-target: ${{ matrix.tests }}
125+
renku-reference: ${{ github.ref }}
126+
renku-release: ci-renku-${{ github.event.number }}
127+
test-user-password: ${{ secrets.RENKU_BOT_DEV_PASSWORD }}
128+
129+
deploy-string-no-custom-version:
130+
name: Ensure no custom components
131+
needs: [check-deploy]
132+
runs-on: ubuntu-24.04
133+
steps:
134+
- name: Check deploy string
135+
if: ${{
136+
needs.check-deploy.outputs.pr-contains-string == 'true'
137+
&& startsWith(github.base_ref, 'release-')
138+
&& (
139+
needs.check-deploy.outputs.renku-core != null
140+
|| needs.check-deploy.outputs.renku-gateway != null
141+
|| needs.check-deploy.outputs.renku-graph != null
142+
|| needs.check-deploy.outputs.renku-notebooks != null
143+
|| needs.check-deploy.outputs.renku-ui != null
144+
|| needs.check-deploy.outputs.renku-data-services != null
145+
)
146+
}}
147+
uses: actions/github-script@v7
148+
with:
149+
script: core.setFailed('Cannot merge release PR if it still has custom versions in deploy string.')
150+
cleanup:
151+
name: Cleanup
152+
if: github.event.action == 'closed'
153+
runs-on: ubuntu-24.04
154+
steps:
155+
- name: renku teardown
156+
uses: SwissDataScienceCenter/renku-actions/cleanup-renku-ci-deployments@v1.15.1
157+
env:
158+
HELM_RELEASE_REGEX: "^ci-renku-${{ github.event.number }}$"
159+
GITLAB_TOKEN: ${{ secrets.DEV_GITLAB_TOKEN }}
160+
RENKUBOT_KUBECONFIG: ${{ secrets.RENKUBOT_DEV_KUBECONFIG }}
161+
MAX_AGE_SECONDS: 0
162+
DELETE_NAMESPACE: "true"

0 commit comments

Comments
 (0)