Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IAPS: Modify data refresh pipeline to allow specifying a specific snapshot ID #336

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/delius-iaps-data-refresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" \
Expand All @@ -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.manually_specified_snapshot_id }} >> $GITHUB_ENV
echo SNAPSHOT_IDENTIFIER=${{ github.event.inputs.manually_specified_snapshot_id }} >> $GITHUB_OUTPUT


- name: Set snapshot name string
run: |
Expand All @@ -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"

Expand Down