Skip to content

Commit

Permalink
👷 Rollback for studios #2026 (#2027)
Browse files Browse the repository at this point in the history
  • Loading branch information
padms authored Dec 26, 2023
1 parent 9d7f459 commit 1d56822
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
name: PROD - Rollback studio to a previous version
name: Rollback studio to a previous version
on:
workflow_dispatch:
inputs:
image-sha:
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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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 }}
Expand Down

0 comments on commit 1d56822

Please sign in to comment.