Rollback (Manual) #41
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
name: Rollback (Manual) | |
on: | |
workflow_dispatch: | |
inputs: | |
rollbackTo: | |
type: string | |
description: 'Full commit hash' | |
required: true | |
environment: | |
type: choice | |
description: 'Environment' | |
options: | |
- 'mainnet' | |
network: | |
type: choice | |
description: 'Network' | |
options: | |
- 'arbitrum' | |
- 'fluidity' | |
group: | |
description: 'Group' | |
required: true | |
default: 'all' | |
service: | |
description: 'Service' | |
required: true | |
default: 'all' | |
build_root_container: | |
type: boolean | |
description: 'Build root-container' | |
default: true | |
build_build_container: | |
type: boolean | |
description: 'Build build-container' | |
default: true | |
rollback_timescale: | |
type: boolean | |
description: 'Rollback Timescale DB' | |
default: false | |
rollback_postgres: | |
type: boolean | |
description: 'Rollback Postgres DB' | |
default: false | |
skip_app_rollback: | |
type: boolean | |
description: 'Skip rollback-app' | |
default: false | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
rollback-app: | |
if: ${{ github.event.inputs.skip_app_rollback == 'false' }} | |
runs-on: ubuntu-latest | |
environment: ${{ github.event.inputs.environment }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
ref: ${{ github.event.inputs.rollbackTo }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-region: ap-southeast-2 | |
role-to-assume: ${{ secrets.FLU_AWS_GITHUB_OIDC_ROLE }} | |
role-duration-seconds: 7200 #seconds | |
- name: Display Commit Hash | |
run: | | |
echo "" | |
echo "CommitHash: $(git log -1 --format='%H')" | |
echo "" | |
- name: Build | |
id: build | |
uses: ./scripts/actions | |
with: | |
command: | | |
flu build-docker \ | |
--network ${{ github.event.inputs.network }} \ | |
--group ${{ github.event.inputs.group }} \ | |
--service ${{ github.event.inputs.service }} \ | |
--environment ${{ github.event.inputs.environment }} \ | |
--build-root-container ${{ github.event.inputs.build_root_container }} \ | |
--build-build-container ${{ github.event.inputs.build_build_container }} \ | |
--tag ${{ github.event.inputs.rollbackTo }} | |
- name: Deploy | |
id: deploy | |
uses: ./scripts/actions | |
with: | |
command: | | |
flu deploy-service \ | |
--network ${{ github.event.inputs.network }} \ | |
--group ${{ github.event.inputs.group }} \ | |
--service ${{ github.event.inputs.service }} \ | |
--environment ${{ github.event.inputs.environment }} \ | |
--debug false \ | |
--tag ${{ github.event.inputs.rollbackTo }} | |
- name: Discord | |
uses: ./scripts/actions | |
if: always() | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
with: | |
command: | | |
flu send-discord --webhook-url ${{ secrets.FLU_CI_DISCORD_WEBHOOK_URL }} --status ${{ job.status }} | |
rollback-db: | |
if: ${{ github.event.inputs.rollback_timescale == 'true' || github.event.inputs.rollback_postgres == 'true' }} | |
runs-on: ubuntu-latest | |
environment: ${{ github.event.inputs.environment }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-region: ap-southeast-2 | |
role-to-assume: ${{ secrets.FLU_AWS_GITHUB_OIDC_ROLE }} | |
role-duration-seconds: 7200 #seconds | |
- name: Rollback Database | |
id: db | |
uses: ./scripts/actions | |
with: | |
command: | | |
flu rollback-db \ | |
--network ${{ github.event.inputs.network }} \ | |
--environment ${{ github.event.inputs.environment }} \ | |
--rollback-timescaledb ${{ github.event.inputs.rollback_timescale }} \ | |
--rollback-postgresdb ${{ github.event.inputs.rollback_postgres }} \ | |
--tag $GITHUB_SHA | |
- name: Discord | |
uses: ./scripts/actions | |
if: always() | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
with: | |
command: | | |
flu send-discord --webhook-url ${{ secrets.FLU_CI_DISCORD_WEBHOOK_URL }} --status ${{ job.status }} |