ci: Push Helm charts to GH Pages Helm registry #6867
Workflow file for this run
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 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 | |
if: github.actor != 'dependabot[bot]' | |
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: ./images/guacamole | |
- name: session-preparation | |
image: ghcr.io/dsd-dbs/capella-collab-manager/session-preparation | |
context: ./images/session-preparation | |
- 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@v4 | |
- name: Checkout repository | |
if: ${{ matrix.name == 'frontend' || matrix.name == 'backend' }} | |
uses: actions/checkout@v4 | |
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: 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@v6 | |
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 | |
if: github.actor != 'dependabot[bot]' | |
needs: [push-images] | |
name: Install chart in kind cluster | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install helm | |
uses: azure/setup-helm@v4 | |
- 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: | | |
helm install test \ | |
--set docker.tag="${{ steps.tag.outputs.branch }}" \ | |
--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 |