-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (87 loc) · 3.15 KB
/
template-deploy.yaml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
on:
workflow_call:
inputs:
namespace:
type: string
required: true
helm_release_name:
type: string
default: portal
required: false
image_tag:
type: string
required: true
revision:
type: string
required: true
environment:
type: string
required: false
default: preview
secrets:
openshift_token:
required: true
keycloak_user:
required: false
keycloak_password:
required: false
glitch_tip_dsn:
required: true
env:
OPENSHIFT_API: https://api.cloudscale-lpg-2.appuio.cloud:6443
jobs:
install:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
url: https://${{ steps.deployment_info.outputs.route_host }}
steps:
- uses: actions/checkout@v4
- name: Setup helmfile
uses: mamezou-tech/[email protected]
with:
helm-version: v3.11.2
helmfile-version: v0.152.0
install-kubectl: false
additional-helm-plugins: https://github.com/aslafy-z/helm-git --version 0.15.1
- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4"
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ env.OPENSHIFT_API }}
openshift_token: ${{ secrets.openshift_token }}
namespace: ${{ inputs.namespace }}
# We don't have a LE cert yet
insecure_skip_tls_verify: true
- name: Deploy app
run: helmfile --namespace ${{ inputs.namespace }} --file deployment/helmfile.yaml -e ${{ inputs.environment }} apply --wait
env:
HELM_RELEASE_NAME: ${{ inputs.helm_release_name }}
IMG_TAG: ${{ inputs.image_tag }}
GIT_SHA: ${{ inputs.revision }}
GLITCH_TIP_DSN: ${{ secrets.glitch_tip_dsn }}
ENVIRONMENT: preview-${{ inputs.image_tag }}
- name: Gather deployment status
id: deployment_info
run: |
echo route_host="$(oc -n ${{ inputs.namespace }} get route ${{ inputs.helm_release_name }} -o jsonpath='{.spec.host}')" >> $GITHUB_OUTPUT
- name: Add route URL to Keycloak client
if: ${{ github.event_name == 'pull_request' }}
run: .github/keycloak-redirect-url.sh "${{ secrets.keycloak_user }}" "${{ secrets.keycloak_password }}" "https://${{ steps.deployment_info.outputs.route_host }}"
- name: Notify on success
uses: peter-evans/create-or-update-comment@v3
if: ${{ github.event_name == 'pull_request' }}
with:
issue-number: ${{ github.event.number }}
body: |
## 🚀 Preview deployment active
| | |
|-|-|
**App URL** | https://${{ steps.deployment_info.outputs.route_host }}
**Revision** | ${{ inputs.revision }}
**Helm release** | ${{ inputs.namespace }}/${{ inputs.helm_release_name }}
**Cluster** | ${{ env.OPENSHIFT_API }}
To uninstall this deployment, close or merge this PR.