-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (102 loc) · 3.47 KB
/
build.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
99
100
101
102
103
104
# changeme
# Change the following parts to your current installation
# - entire Docker Build steps accordingly to the amount of different versions or tags your building TRAINING_HUGO_ENV
# - Tags
# - Helm Target Namespace
# - Name of K8S Deployment to trigger and namespace
# - URL that gets commented on the PR
# - Secrets
# - QUAYIO_USERNAME and QUAYIO_TOKEN must be set accordingly to your registry, existing users must have access to the repos
# - KUBECONFIG_TEST content of the Kubeconfig File, Account must have access to the k8s namespace. It's used in the helm steps
name: Build Training and Publish
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Set up npm for linting
uses: actions/setup-node@v4
with:
node-version: '18.x'
-
name: Lint Markdown
run: npm ci && npm run mdlint
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Quay.io Container Registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}
-
name: Build Latest Version
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
quay.io/puzzle/dagger-techlab:pr-${{ github.event.pull_request.number }}
-
name: 'Install Helm'
uses: azure/setup-helm@v4
with:
version: v3.6.2
-
name: Install Kubectl
uses: azure/setup-kubectl@v4
with:
version: v1.21.2
-
name: Create KUBECONFIG
env:
KUBE_CONFIG: '${{ secrets.KUBECONFIG_TEST_AV2 }}'
run: |
mkdir -p $HOME/.kube
echo "$KUBE_CONFIG" > $HOME/.kube/config
-
name: Deploy Helm Release
env:
TRAINING_HELM_RELEASE: 'pr-${{ github.event.pull_request.number }}'
TRAINING_NAMESPACE: 'pitc-cicd-dagger-techlab-test'
TRAINING_VERSION: '${{ github.sha }}'
run: |
helm upgrade $TRAINING_HELM_RELEASE acend-training-chart --install --wait \
--kubeconfig $HOME/.kube/config \
--namespace=$TRAINING_NAMESPACE \
--set=app.name=$HELM_RELEASE \
--set=app.version=$TRAINING_VERSION \
--repo=https://acend.github.io/helm-charts/ \
--values=helm-chart/values.yaml \
--atomic
-
name: Redeploy Deployments
env:
TRAINING_HELM_RELEASE: 'pr-${{ github.event.pull_request.number }}'
TRAINING_HELM_NAME: 'dagger-techlab-puzzle'
TRAINING_NAMESPACE: 'pitc-cicd-dagger-techlab-test'
run: |
kubectl rollout restart deployment/${TRAINING_HELM_RELEASE}-${TRAINING_HELM_NAME} \
--kubeconfig $HOME/.kube/config \
--namespace $TRAINING_NAMESPACE
-
name: Comment PR Environments in PR
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: |
PR Environments:
* puzzle version <https://dagger-techlab-pr-${{ github.event.pull_request.number }}.ocp.cloudscale.puzzle.ch>