forked from acend/kubernetes-basics-training
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (141 loc) · 4.75 KB
/
push-main.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Publish Main Version
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
-
name: Set up npm for linting
uses: actions/setup-node@v2
with:
node-version: '15.x'
-
name: Lint Markdown
run: npm ci && npm run mdlint
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to Quay.io Container Registry
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}
-
name: Build Acend Version
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
quay.io/acend/kubernetes-basics-training:latest
-
name: Run vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'quay.io/acend/kubernetes-basics-training:latest'
format: 'table'
output: 'trivy-results.txt'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os'
severity: 'CRITICAL,HIGH'
-
name: Archive vulnerability scan results
uses: actions/upload-artifact@v2
with:
name: trivy-results-main
path: trivy-results.txt
-
name: Build Mobi Version
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=mobi
push: true
tags: |
quay.io/acend/kubernetes-basics-training:latest-mobi
-
name: Build Rancher Version
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=rancher
push: true
tags: |
quay.io/acend/kubernetes-basics-training:latest-rancher
-
name: Build OpenShift Version
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=openshift
push: true
tags: |
quay.io/acend/kubernetes-basics-training:latest-openshift
-
name: Build Netcetera Version
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
build-args: |
TRAINING_HUGO_ENV=netcetera
push: true
tags: |
quay.io/acend/kubernetes-basics-training:latest-netcetera
-
name: 'Install Helm'
uses: azure/setup-helm@v1
with:
version: v3.6.2
-
name: Install Kubectl
uses: azure/setup-kubectl@v1
with:
version: v1.21.2
-
name: Create KUBECONFIG
env:
KUBE_CONFIG: '${{ secrets.KUBECONFIG }}'
run: |
mkdir -p $HOME/.kube
echo "$KUBE_CONFIG" > $HOME/.kube/config
-
name: Deploy Helm Release
env:
TRAINING_HELM_RELEASE: 'latest'
TRAINING_NAMESPACE: 'acend-kubernetes-basics-training-prod'
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: 'latest'
TRAINING_NAMESPACE: 'acend-kubernetes-basics-training-prod'
run: |
kubectl rollout restart deployment/$TRAINING_HELM_RELEASE-acend-kubernetes-basics-acend --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/$TRAINING_HELM_RELEASE-acend-kubernetes-basics-mobi --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/$TRAINING_HELM_RELEASE-acend-kubernetes-basics-rancher --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/$TRAINING_HELM_RELEASE-acend-kubernetes-basics-openshift --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE
kubectl rollout restart deployment/$TRAINING_HELM_RELEASE-acend-kubernetes-basics-netcetera --kubeconfig $HOME/.kube/config --namespace $TRAINING_NAMESPACE