@@ -2,14 +2,20 @@ name: Build Training
2
2
3
3
on :
4
4
pull_request :
5
+ workflow_dispatch :
5
6
6
7
env :
7
8
REGISTRY : ghcr.io
8
9
# github.repository as <account>/<repo>
9
10
IMAGE_NAME : ${{ github.repository }}
11
+ HELM_RELEASE : pr-${{ github.event.pull_request.number }}
12
+ HELM_NAME : dagger-techlab-puzzle
13
+ NAMESPACE : pitc-cicd-dagger-techlab-test
14
+ TRAINING_VERSION : ${{ github.sha }}
15
+ PR_ENV_URL : https://dagger-techlab-pr-${{ github.event.pull_request.number }}.ocp.cloudscale.puzzle.ch
10
16
11
17
jobs :
12
- build :
18
+ lint :
13
19
runs-on : ubuntu-latest
14
20
steps :
15
21
-
25
31
-
26
32
name : Lint Markdown
27
33
run : npm ci && npm run mdlint
34
+
35
+ build_and_push :
36
+ runs-on : ubuntu-latest
37
+ needs : lint
38
+ steps :
39
+ -
40
+ name : Checkout Repository
41
+ uses : actions/checkout@v4
42
+ with :
43
+ submodules : recursive
44
+ fetch-depth : 0
28
45
-
29
46
name : Set up QEMU
30
47
uses : docker/setup-qemu-action@v3
50
67
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}
51
68
cache-from : type=gha
52
69
cache-to : type=gha,mode=max
70
+
71
+ deploy :
72
+ runs-on : ubuntu-latest
73
+ needs : build_and_push
74
+ steps :
53
75
-
54
76
name : ' Install Helm'
55
77
uses : azure/setup-helm@v4
@@ -69,34 +91,30 @@ jobs:
69
91
echo "$KUBE_CONFIG" > $HOME/.kube/config
70
92
-
71
93
name : Deploy Helm Release
72
- env :
73
- TRAINING_HELM_RELEASE : ' pr-${{ github.event.pull_request.number }}'
74
- TRAINING_NAMESPACE : ' pitc-cicd-dagger-techlab-test'
75
- TRAINING_VERSION : ' ${{ github.sha }}'
76
94
run : |
77
- helm upgrade $TRAINING_HELM_RELEASE acend-training-chart --install --wait \
95
+ helm upgrade $HELM_RELEASE acend-training-chart --install --wait \
78
96
--kubeconfig $HOME/.kube/config \
79
- --namespace=$TRAINING_NAMESPACE \
97
+ --namespace=$NAMESPACE \
80
98
--set=app.name=$HELM_RELEASE \
81
99
--set=app.version=$TRAINING_VERSION \
82
100
--repo=https://acend.github.io/helm-charts/ \
83
101
--values=helm-chart/values.yaml \
84
102
--atomic
85
103
-
86
104
name : Redeploy Deployments
87
- env :
88
- TRAINING_HELM_RELEASE : ' pr-${{ github.event.pull_request.number }}'
89
- TRAINING_HELM_NAME : ' dagger-techlab-puzzle'
90
- TRAINING_NAMESPACE : ' pitc-cicd-dagger-techlab-test'
91
105
run : |
92
- kubectl rollout restart deployment/${TRAINING_HELM_RELEASE }-${TRAINING_HELM_NAME } \
106
+ kubectl rollout restart deployment/${HELM_RELEASE }-${HELM_NAME } \
93
107
--kubeconfig $HOME/.kube/config \
94
- --namespace $TRAINING_NAMESPACE
108
+ --namespace $NAMESPACE
109
+
110
+ comment :
111
+ runs-on : ubuntu-latest
112
+ needs : deploy
113
+ steps :
95
114
-
96
115
name : Comment PR Environments in PR
97
116
uses : marocchino/sticky-pull-request-comment@v2
98
117
with :
99
118
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
100
119
message : |
101
- PR Environments:
102
- * puzzle version <https://dagger-techlab-pr-${{ github.event.pull_request.number }}.ocp.cloudscale.puzzle.ch>
120
+ 🚀 PR Environment: [Open Deployment](${{ env.PR_ENV_URL }})
0 commit comments