From 1dfc0533dd689e472ff17fb28168a6e5869e124e Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 11 Nov 2023 14:26:07 +0100 Subject: [PATCH] removed all references to the staging deployment --- .github/workflows/_restart-argocd.yml | 10 +--- .github/workflows/add-deployment.yaml | 65 ---------------------- .github/workflows/comment-staging-url.yaml | 17 ------ .github/workflows/data-cicd.yml | 2 + .github/workflows/remove-deployment.yml | 20 ------- .github/workflows/server-cicd.yml | 3 + .github/workflows/webclient-cicd.yml | 1 + 7 files changed, 8 insertions(+), 110 deletions(-) delete mode 100644 .github/workflows/add-deployment.yaml delete mode 100644 .github/workflows/comment-staging-url.yaml delete mode 100644 .github/workflows/remove-deployment.yml diff --git a/.github/workflows/_restart-argocd.yml b/.github/workflows/_restart-argocd.yml index 13c9e610b..1a33f10b2 100644 --- a/.github/workflows/_restart-argocd.yml +++ b/.github/workflows/_restart-argocd.yml @@ -21,11 +21,5 @@ jobs: run: curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 && chmod +x /usr/local/bin/argocd - name: Restart ${{ inputs.deployment }} via the ArgoCD CLI run: | - echo ${{ github.ref }} - if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then - echo restarting the production deployment ${{ inputs.deployment }} - argocd app actions run navigatum-prod restart --kind Deployment --resource-name ${{ inputs.deployment }} --auth-token ${{ secrets.ARGOCD_TOKEN }} --server argocd.nav.tum.sexy - else - echo restarting the staging deployment ${{ inputs.deployment }} - argocd app actions run pr-${{github.event.number}} restart --kind Deployment --resource-name ${{ inputs.deployment }} --auth-token ${{ secrets.ARGOCD_TOKEN }} --server argocd.nav.tum.sexy - fi + echo restarting the deployment ${{ inputs.deployment }} + argocd app actions run navigatum-prod restart --kind Deployment --resource-name ${{ inputs.deployment }} --auth-token ${{ secrets.ARGOCD_TOKEN }} --server argocd.nav.tum.sexy diff --git a/.github/workflows/add-deployment.yaml b/.github/workflows/add-deployment.yaml deleted file mode 100644 index 435081864..000000000 --- a/.github/workflows/add-deployment.yaml +++ /dev/null @@ -1,65 +0,0 @@ -name: Add a new Deployment - -on: - pull_request: - branches: [main] - types: [opened, reopened, edited] -jobs: - deploy: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - with: - ref: deployment - - run: git config --global user.email "github-actions[bot]@users.noreply.github.com" - - run: git config --global user.name "github-actions[bot]" - - run: | - MEILI_MASTER_KEY_RAW="$(echo $RANDOM | md5sum | head -c 20)" - MEILI_MASTER_KEY="$(echo "$MEILI_MASTER_KEY_RAW"|base64)" - export MEILI_MASTER_KEY - echo > staging/pr-${{ github.event.number }}.yaml " - apiVersion: argoproj.io/v1alpha1 - kind: Application - metadata: - name: pr-${{ github.event.number }} - namespace: argocd - finalizers: - - resources-finalizer.argocd.argoproj.io - spec: - project: default - source: - repoURL: https://github.com/TUM-Dev/navigatum.git - targetRevision: ${{ github.event.pull_request.head.ref }} - path: deployment/k3s - helm: - version: v3 - values: | - namespace: pr-${{ github.event.number }} - tag: pr-${{ github.event.number }} - url: pr-${{ github.event.number }}.nav.tum.sexy - server: - MEILI_MASTER_KEY: $MEILI_MASTER_KEY - # GITHUB_TOKEN is intentionally omitted, as this file is templated and then added to git in the deployments branch - # JWT_KEY is omitted, because adding it would only make sense in conjunction with GITHUB_TOKEN - # MEILI_MASTER_KEY being added is not a security risk, since it is a hidden service and even if exposed is heavily restricted by other network policies - destination: - server: https://kubernetes.default.svc - namespace: pr-${{ github.event.number }} - syncPolicy: - automated: - selfHeal: true - prune: true - syncOptions: - - PrunePropagationPolicy=foreground - - CreateNamespace=true - retry: - limit: 2 - backoff: - duration: 5s - factor: 2 - maxDuration: 3m0s" - - run: git add . - - run: git commit -m "Add deployment for PR ${{ '#' }}${{ github.event.number }}" - - run: git push diff --git a/.github/workflows/comment-staging-url.yaml b/.github/workflows/comment-staging-url.yaml deleted file mode 100644 index a31e01fde..000000000 --- a/.github/workflows/comment-staging-url.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Add a comment to new PRs - -on: - pull_request_target: - branches: [main] - types: [opened, reopened] -jobs: - comment: - runs-on: ubuntu-latest - steps: - - run: | - curl \ - -X POST \ - ${{ github.event.pull_request.comments_url }} \ - -H "Content-Type: application/json" \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - --data '{ "body": "👋 Thank you for contributing. A [staging environment for this PR](https://pr-${{ github.event.number }}.nav.tum.sexy) for this change will be available shortly" }' diff --git a/.github/workflows/data-cicd.yml b/.github/workflows/data-cicd.yml index 24008b63a..6c9662cda 100644 --- a/.github/workflows/data-cicd.yml +++ b/.github/workflows/data-cicd.yml @@ -55,6 +55,7 @@ jobs: packages: write data-deployment-1: uses: ./.github/workflows/_restart-argocd.yml + if: ${{ github.ref }} == 'refs/heads/main' needs: - data-build with: @@ -63,6 +64,7 @@ jobs: ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }} data-deployment-2: # we need to restart the server, as otherwise it will not serve the new data uses: ./.github/workflows/_restart-argocd.yml + if: ${{ github.ref }} == 'refs/heads/main' needs: - data-deployment-1 with: diff --git a/.github/workflows/remove-deployment.yml b/.github/workflows/remove-deployment.yml deleted file mode 100644 index a361e2de6..000000000 --- a/.github/workflows/remove-deployment.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Remove a Deployment - -on: - pull_request: - types: [closed] -jobs: - deploy: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - with: - ref: deployment - - run: git config --global user.email "github-actions[bot]@users.noreply.github.com" - - run: git config --global user.name "github-actions[bot]" - - run: rm -f staging/pr-${{ github.event.number }}.yaml - - run: git add . - - run: git commit -m "Removed the deployment for PR ${{ '#' }}${{ github.event.number }}" - - run: git push diff --git a/.github/workflows/server-cicd.yml b/.github/workflows/server-cicd.yml index fd10db726..ea8236e9c 100644 --- a/.github/workflows/server-cicd.yml +++ b/.github/workflows/server-cicd.yml @@ -62,6 +62,7 @@ jobs: packages: write feedback-deployment: uses: ./.github/workflows/_restart-argocd.yml + if: ${{ github.ref }} == 'refs/heads/main' needs: - server-build with: @@ -70,6 +71,7 @@ jobs: ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }} calendar-deployment: uses: ./.github/workflows/_restart-argocd.yml + if: ${{ github.ref }} == 'refs/heads/main' needs: - server-build with: @@ -78,6 +80,7 @@ jobs: ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }} server-deployment: uses: ./.github/workflows/_restart-argocd.yml + if: ${{ github.ref }} == 'refs/heads/main' needs: - server-build with: diff --git a/.github/workflows/webclient-cicd.yml b/.github/workflows/webclient-cicd.yml index 4a5dab6b7..1e4d7cc3d 100644 --- a/.github/workflows/webclient-cicd.yml +++ b/.github/workflows/webclient-cicd.yml @@ -58,6 +58,7 @@ jobs: packages: write webclient-deployment: uses: ./.github/workflows/_restart-argocd.yml + if: ${{ github.ref }} == 'refs/heads/main' needs: - webclient-build with: