[keycloak] add configmaps & secrets to keycloak (#122) #37
This file contains hidden or 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
| name: CI/CD Pipeline for Keycloak SPI | ||
| on: | ||
| push: | ||
| paths: | ||
| - ".github/workflows/keycloak-ci-cd.yml" | ||
| - 'helm/keycloak/**' | ||
| workflow_dispatch: | ||
| env: | ||
| REGISTRY: oci://registry-1.docker.io | ||
| IMAGE_NAME: bitnamicharts/keycloak | ||
| NAMESPACE: recipefy | ||
| RELEASE_NAME: keycloak | ||
| CHART_PATH: ./helm/keycloak | ||
| SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }} | ||
| SECRET_FOLDER: ./helm/keycloak/templates/secrets | ||
| CONFIG_FOLDER: ./helm/keycloak/templates/configmaps | ||
| jobs: | ||
| deploy: | ||
|
Check failure on line 21 in .github/workflows/keycloak-ci-cd.yml
|
||
| name: Deploy to Rancher with Helm | ||
| if: github.ref == 'refs/heads/main' | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Helm | ||
| uses: azure/setup-helm@v4 | ||
| - name: Configure Kubernetes Context | ||
| uses: azure/k8s-set-context@v4 | ||
| with: | ||
| method: kubeconfig | ||
| kubeconfig: ${{ secrets.KUBE_CONFIG }} | ||
| - name: Set up SOPS | ||
| uses: nhedger/setup-sops@v2 | ||
| with: | ||
| version: 3.8.1 | ||
| - name: Decrypt secret | ||
| run: | | ||
| sops --decrypt "$SECRET_FOLDER/auth-secret.yaml" > tmp && mv tmp "$SECRET_FOLDER/auth-secret.decrypted.yaml" && \ | ||
| sops --decrypt "$SECRET_FOLDER/db-secret.yaml" > tmp && mv tmp "$SECRET_FOLDER/db-secret.decrypted.yaml" && \ | ||
| sops --decrypt "$SECRET_FOLDER/realms-secret.yaml" > tmp && mv tmp "$SECRET_FOLDER/realms-secret.decrypted.yaml" | ||
| - name: Apply secret to Kubernetes | ||
| run: | | ||
| kubectl apply -f "$SECRET_FOLDER/auth-secret.decrypted.yaml" --namespace "$NAMESPACE" && \ | ||
| kubectl apply -f "$SECRET_FOLDER/db-secret.decrypted.yaml" --namespace "$NAMESPACE" && \ | ||
| kubectl apply -f "$SECRET_FOLDER/realms-secret.decrypted.yaml" --namespace "$NAMESPACE" | ||
| - name: Apply configMaps to Kubernetes | ||
| run: | | ||
| kubectl apply -f "$CONFIG_FOLDER/keycloak-configmaps.yaml" --namespace "$NAMESPACE" && \ | ||
| kubectl apply -f "$CONFIG_FOLDER/realm-import-configmaps.yaml" --namespace "$NAMESPACE" | ||
| - name: Deploy Helm Chart | ||
| run: | | ||
| helm repo add bitnami https://charts.bitnami.com/bitnami | ||
| helm repo update | ||
| helm upgrade ${{ env.RELEASE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \ | ||
| -n ${{ env.HNAMESPACE }} -f ${{ env.CHART_PATH }}/values.yaml | ||