Merge pull request #1185 from DSD-DBS/chore-update-to-angular-17 #4459
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager 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@v2 | |
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@v3 | |
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 |