-
Notifications
You must be signed in to change notification settings - Fork 60
82 lines (71 loc) · 2.7 KB
/
deploy_to_dev_cluster.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
# deploy to dev cluster using own runner
name: Deploy to dev cluster
on:
workflow_call:
inputs:
frontend_image_tag:
required: true
description: "frontend image tag"
type: string
server_image_tag:
required: true
description: "server image tag"
type: string
jobs:
deploy:
runs-on: self-hosted
permissions:
id-token: write
contents: read
actions: read
pull-requests: write
steps:
- name: Install kubectl
uses: azure/setup-kubectl@v4
id: install
- name: Set up Kubernetes Auth
uses: azure/k8s-set-context@v4
with:
method: service-account
k8s-secret: ${{ secrets.KUBERNETES_SECRET }}
k8s-url: https://kubernetes.default.svc
- name: Checkout
uses: actions/checkout@v4
- name: Replace template variables
run: |
if [ -z "${{ github.event.pull_request.number }}" ]; then
echo "No pull request number found. This was triggered by the main branch. Using main instead of PR_NUMBER"
sed -i "s#PR_NUMBER#main#g" k8s/deployment.yaml
else
sed -i "s#PR_NUMBER#${{ github.event.pull_request.number }}#g" k8s/deployment.yaml
fi
sed -i "s#POSTGRES_DEV_PASSWORD#${{ secrets.POSTGRES_DEV_PASSWORD }}#g" k8s/deployment.yaml
- name: json_debug
run: |
cat k8s/deployment.yaml
- name: Deploy to dev cluster
uses: Azure/k8s-deploy@v5
with:
namespace: scrumlr-dev-deployments
force: true
manifests: |
k8s/deployment.yaml
images: |
ghcr.io/inovex/scrumlr.io/scrumlr-frontend:${{ inputs.frontend_image_tag }}
ghcr.io/inovex/scrumlr.io/scrumlr-server:${{ inputs.server_image_tag }}
- name: send_github_message
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
The deployment to the dev cluster was successful. You can find the deployment here: https://${{ github.event.pull_request.number }}.development.scrumlr.fra.ics.inovex.io
This deployment is only for testing purposes and will be deleted after 1 week.
To redeploy rerun the workflow.
<strong>DO NOT STORE IMPORTANT DATA ON THIS DEPLOYMENT</strong>
<details>
<summary>Deployed Images</summary>
- ghcr.io/inovex/scrumlr.io/scrumlr-frontend:${{ inputs.frontend_image_tag }}
- ghcr.io/inovex/scrumlr.io/scrumlr-server:${{ inputs.server_image_tag }}
</details>
comment_tag: dev-deployment
mode: recreate