-
Notifications
You must be signed in to change notification settings - Fork 4
160 lines (157 loc) · 5.5 KB
/
push.yml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: CC0-1.0
name: push
on:
push:
branches: ["**"]
tags: ["v*.*.*"]
pull_request:
branches: [main]
jobs:
push-images:
runs-on: ubuntu-latest
name: Build and push ${{ matrix.name }} image
strategy:
matrix:
include:
- name: backend
image: ghcr.io/dsd-dbs/capella-collab-manager/backend
context: ./backend
- name: frontend
image: ghcr.io/dsd-dbs/capella-collab-manager/frontend
context: ./frontend
- name: guacamole
image: ghcr.io/dsd-dbs/capella-collab-manager/guacamole
context: ./guacamole
- name: docs
image: ghcr.io/dsd-dbs/capella-collab-manager/docs
context: ./docs
steps:
- name: Checkout repository
if: ${{ matrix.name != 'frontend' && matrix.name != 'backend' }}
uses: actions/checkout@v3
- name: Checkout repository
if: ${{ matrix.name == 'frontend' || matrix.name == 'backend' }}
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch version
if: ${{ matrix.name == 'backend' }}
run: |
python backend/generate_git_archival.py
- name: Fetch version
if: ${{ matrix.name == 'frontend' }}
run: |
python frontend/fetch-version.py
- name: Prepare environment.prod.ts
if: ${{ matrix.name == 'frontend' }}
run: |
cp frontend/src/environments/environment.ts frontend/src/environments/environment.prod.ts
- name: Login to github container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: tag
run: |
echo "branch=$(echo $GITHUB_REF_NAME | sed 's/[^a-zA-Z0-9.]/-/g')" >> "$GITHUB_OUTPUT"
echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
tags: ${{ matrix.image }}:${{ steps.tag.outputs.branch }}
labels: git-short-sha=${{ steps.tag.outputs.sha }}
push: true
install-chart:
runs-on: ubuntu-latest
needs: [push-images]
name: Install chart in kind cluster
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install helm
uses: azure/setup-helm@v3
- name: Extract metadata for Docker
id: tag
run: |
echo "branch=$(echo $GITHUB_REF_NAME | sed 's/[^a-zA-Z0-9.]/-/g')" >> "$GITHUB_OUTPUT"
echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Create k8s Kind Cluster
uses: helm/[email protected]
- name: Create sessions namespace
run: |
kubectl create namespace collab-sessions
- name: Add registry token
run: |
kubectl create secret docker-registry github \
--docker-server=ghcr.io \
--docker-username=${{ github.actor }} \
--docker-password=${{ secrets.GITHUB_TOKEN }}
- name: Add secret to default serviceaccount
run: |
kubectl patch serviceaccount default \
-p '{"imagePullSecrets": [{"name": "github"}]}'
- name: Update dependencies
run: |
helm dependency update ./helm
- name: Install chart
run: |
export TAG=${{ steps.tag.outputs.branch }}
helm install test \
--set docker.registry.internal="ghcr.io/dsd-dbs/capella-collab-manager" \
--set docker.images.frontend="/frontend:$TAG" \
--set docker.images.backend="/backend:$TAG" \
--set docker.images.guacamole.guacamole="ghcr.io/dsd-dbs/capella-collab-manager/guacamole:$TAG" \
--set docker.images.docs="/docs:$TAG" \
--set loki.enabled=False \
--set cluster.pvc.storageClassName="standard" \
--set cluster.imagePullSecret="github" \
--set promtail.storageClassName="standard" \
--set mocks.oauth=True \
--set development=True \
--set general.port=8080 \
--set backend.authentication.oauth.endpoints.wellKnown="http://test-oauth-mock:8080/default/.well-known/openid-configuration" \
./helm
- name: Wait for all containers to be ready
run: |
kubectl wait --all deployment --for condition=Available=True --timeout=5m
- name: Print status of Pods
if: always()
run: |
kubectl get pods
- name: Describe deployments
if: always()
run: |
kubectl describe deployment
- name: Describe pods
if: always()
run: |
kubectl describe pods
- name: Describe nodes
if: always()
run: |
kubectl describe nodes
- name: Describe PVCs
if: always()
run: |
kubectl describe pvc
- name: Describe volumes
if: always()
run: |
kubectl describe pv
- name: Describe configmaps
if: always()
run: |
kubectl describe cm
- name: Describe secrets
if: always()
run: |
kubectl describe secrets
- name: Print logs of backend container
if: always()
run: |
kubectl logs deployment/test-backend test-backend