From 3b3a583860f669f0b4663810473a1d7060c336a1 Mon Sep 17 00:00:00 2001 From: George Taylor Date: Wed, 20 Sep 2023 15:31:11 +0100 Subject: [PATCH 1/2] add snapshot id override --- .../workflows/delius-iaps-data-refresh.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/delius-iaps-data-refresh.yml b/.github/workflows/delius-iaps-data-refresh.yml index c529ece2f..7cf730931 100644 --- a/.github/workflows/delius-iaps-data-refresh.yml +++ b/.github/workflows/delius-iaps-data-refresh.yml @@ -5,6 +5,11 @@ permissions: contents: read # This is required for actions/checkout on: workflow_dispatch: + inputs: + manually_specified_snapshot_id: # This is the name of the input + description: 'Snapshot ID' + required: false + jobs: share-latest-manual-snapshot: runs-on: ubuntu-latest @@ -23,6 +28,7 @@ jobs: aws-region: "eu-west-2" - name: Get latest overnight backup + if: ${{ github.event.inputs.manually_specified_snapshot_id == '' }} run: | overnight_snapshot_identifier=$(aws rds describe-db-snapshots \ --snapshot-type "automated" \ @@ -33,8 +39,15 @@ jobs: echo "No snapshot found" exit 1 fi - echo OVERNIGHT_SNAPSHOT_IDENTIFIER=${overnight_snapshot_identifier} >> $GITHUB_ENV - echo OVERNIGHT_SNAPSHOT_IDENTIFIER=${overnight_snapshot_identifier} >> $GITHUB_OUTPUT + echo SNAPSHOT_IDENTIFIER=${overnight_snapshot_identifier} >> $GITHUB_ENV + echo SNAPSHOT_IDENTIFIER=${overnight_snapshot_identifier} >> $GITHUB_OUTPUT + + - name: Snapshot ID provided + if: ${{ github.event.inputs.manually_specified_snapshot_id != '' }} + run: | + echo SNAPSHOT_IDENTIFIER=${{ github.event.inputs.snapshot_id }} >> $GITHUB_ENV + echo SNAPSHOT_IDENTIFIER=${{ github.event.inputs.snapshot_id }} >> $GITHUB_OUTPUT + - name: Set snapshot name string run: | @@ -44,7 +57,7 @@ jobs: - name: Copy snapshot (prod-prod) run: | aws rds copy-db-snapshot \ - --source-db-snapshot-identifier "${{ env.OVERNIGHT_SNAPSHOT_IDENTIFIER }}" \ + --source-db-snapshot-identifier "${{ env.SNAPSHOT_IDENTIFIER }}" \ --target-db-snapshot-identifier "${{ env.SNAPSHOT_NAME }}" \ --region "eu-west-2" From cbef338106afa171df32760e02835cade3d90159 Mon Sep 17 00:00:00 2001 From: George Taylor Date: Wed, 20 Sep 2023 15:37:28 +0100 Subject: [PATCH 2/2] typo --- .github/workflows/delius-iaps-data-refresh.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/delius-iaps-data-refresh.yml b/.github/workflows/delius-iaps-data-refresh.yml index caf64a33b..565bb3cba 100644 --- a/.github/workflows/delius-iaps-data-refresh.yml +++ b/.github/workflows/delius-iaps-data-refresh.yml @@ -45,8 +45,8 @@ jobs: - name: Snapshot ID provided if: ${{ github.event.inputs.manually_specified_snapshot_id != '' }} run: | - echo SNAPSHOT_IDENTIFIER=${{ github.event.inputs.snapshot_id }} >> $GITHUB_ENV - echo SNAPSHOT_IDENTIFIER=${{ github.event.inputs.snapshot_id }} >> $GITHUB_OUTPUT + echo SNAPSHOT_IDENTIFIER=${{ github.event.inputs.manually_specified_snapshot_id }} >> $GITHUB_ENV + echo SNAPSHOT_IDENTIFIER=${{ github.event.inputs.manually_specified_snapshot_id }} >> $GITHUB_OUTPUT - name: Set snapshot name string