@@ -16,6 +16,45 @@ concurrency:
16
16
cancel-in-progress : true
17
17
18
18
jobs :
19
+ check_deployment_clearance :
20
+ name : " Check deployment clearance"
21
+ runs-on : ubuntu-latest
22
+ env :
23
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
24
+ outputs :
25
+ deployment_clearance : ${{ steps.determine_deployment_clearance.outputs.deployment_clearance }}
26
+ steps :
27
+ - name : Checkout code
28
+ uses : actions/checkout@v2
29
+
30
+ - name : Get PR number
31
+ id : get_pr_number
32
+ run : |
33
+ PR_NUMBER=$(gh pr list --state open --head ${{ github.ref_name }} --json number --jq '.[0].number')
34
+ if [ -z "$PR_NUMBER" ]; then
35
+ echo "No existing PR found for ${{ github.ref_name }} "
36
+ else
37
+ echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
38
+ fi
39
+
40
+ - name : Get PR labels
41
+ id : get_pr_labels
42
+ if : ${{ env.PR_NUMBER != '' }}
43
+ run : |
44
+ PR_LABELS=$(gh pr view ${{ env.PR_NUMBER }} --json labels --jq '.labels | map(.name) | join(",")')
45
+ echo "PR_LABELS=$PR_LABELS" >> $GITHUB_ENV
46
+
47
+ - name : Determine deployment clearance
48
+ id : determine_deployment_clearance
49
+ run : |
50
+ if [ -z "$env.PR_NUMBER" ] || [[ ${{ ! contains(env.PR_LABELS, 'prevent_auto_deployment') }} == true ]]; then
51
+ echo "Deployment clearance: true"
52
+ echo "deployment_clearance=true" >> "$GITHUB_OUTPUT"
53
+ else
54
+ echo "deployment_clearance=false" >> "$GITHUB_OUTPUT"
55
+ echo "Deployment clearance: false"
56
+ fi
57
+
19
58
codeql_analyze :
20
59
name : " CodeQL"
21
60
if : ${{ github.event_name == 'push' }}
@@ -26,10 +65,11 @@ jobs:
26
65
security-events : write
27
66
28
67
build_image_on_push :
29
- needs :
68
+ needs :
69
+ - check_deployment_clearance
30
70
- create_branch_identifier
31
71
name : " Publish image and scan with trivy"
32
- if : ${{ github.event_name == 'push' }}
72
+ if : ${{ github.event_name == 'push' && needs.check_deployment_clearance.outputs.deployment_clearance == 'true' }}
33
73
permissions :
34
74
packages : write
35
75
security-events : write
53
93
contents : read
54
94
55
95
select_helm_version_generation_and_image_tag_generation :
56
- if : ${{ github.event_name == 'push'}}
96
+ needs :
97
+ - check_deployment_clearance
98
+ if : ${{ github.event_name == 'push' && needs.check_deployment_clearance.outputs.deployment_clearance == 'true' }}
57
99
runs-on : ubuntu-latest
58
100
outputs :
59
101
SELECT_HELM_VERSION_GENERATION : ${{ steps.select_generation.outputs.SELECT_HELM_VERSION_GENERATION }}
@@ -118,8 +160,7 @@ jobs:
118
160
dbildungs_iam_keycloak_branch : ${{ needs.branch_meta.outputs.ticket }}
119
161
dbildungs_iam_ldap_branch : ${{ needs.branch_meta.outputs.ticket }}
120
162
namespace : ${{ needs.create_branch_identifier.outputs.namespace_from_branch }}
121
- database_recreation : ${{ github.ref_name == 'main' && 'true' || 'false' }}
122
- # database_recreation: "true" # to force database recreation this has be set to true
163
+ database_recreation : " true" # to prevent database recreation this has to be set to false
123
164
secrets : inherit
124
165
125
166
# On Delete
0 commit comments