From 1d56822bdb212f48f693d2e95056b42e4d5d5252 Mon Sep 17 00:00:00 2001 From: Padmaja Date: Tue, 26 Dec 2023 17:36:33 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Rollback=20for=20studios=20#2026?= =?UTF-8?q?=20(#2027)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...os-rollback.yaml => studios-rollback.yaml} | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) rename .github/workflows/{PROD-studios-rollback.yaml => studios-rollback.yaml} (93%) diff --git a/.github/workflows/PROD-studios-rollback.yaml b/.github/workflows/studios-rollback.yaml similarity index 93% rename from .github/workflows/PROD-studios-rollback.yaml rename to .github/workflows/studios-rollback.yaml index ef56d0cac..1b460894f 100644 --- a/.github/workflows/PROD-studios-rollback.yaml +++ b/.github/workflows/studios-rollback.yaml @@ -1,4 +1,4 @@ -name: PROD - Rollback studio to a previous version +name: Rollback studio to a previous version on: workflow_dispatch: inputs: @@ -6,6 +6,14 @@ on: description: 'The commit sha of the image to rollback to' required: true type: string + environment: + description: 'Choose the environment to rollback' + type: choice + options: + - 'development' + - 'preprod' + - 'production' + required: true permissions: id-token: write jobs: @@ -57,7 +65,7 @@ jobs: rollback-global: runs-on: ubuntu-latest needs: find-image - if: ${{ needs.find-image.outputs.imageExists }} == true + if: ${{ needs.find-image.outputs.imageExists }} == true && ${{ github.event.inputs.environment }} == "production" environment: name: production url: https://equinor.sanity.studio @@ -125,7 +133,7 @@ jobs: rollback-secret: runs-on: ubuntu-latest needs: find-image - if: ${{ needs.find-image.outputs.imageExists }} == true + if: ${{ needs.find-image.outputs.imageExists }} == true && ${{ github.event.inputs.environment }} == "production" environment: name: production env: @@ -195,7 +203,7 @@ jobs: needs: find-image runs-on: ubuntu-latest environment: - name: production + name: ${{ github.event.inputs.environment }} if: ${{ needs.find-image.outputs.imageExists }} == true env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} @@ -218,7 +226,7 @@ jobs: git remote set-url origin https://x-access-token:${{ secrets.PADMS_PAT }}@github.com/equinor/energyvision-internal if [[ `git status --porcelain` ]] then - git commit -am "🔙 Rolling back satellite studios in production to version ${{ github.event.inputs.image-sha }}" + git commit -am "🔙 Rolling back satellite studios in ${{ github.event.inputs.environment }} to version ${{ github.event.inputs.image-sha }}" git pull --rebase origin main git push origin HEAD:main fi @@ -232,7 +240,7 @@ jobs: needs: update-radix-config runs-on: ubuntu-latest environment: - name: production + name: ${{ github.event.inputs.environment }} url: https://equinor.com env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}