-
Notifications
You must be signed in to change notification settings - Fork 18
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
#2903: Target Stable/Staging for Clone Workflow #3061
Changes from 5 commits
af23b7d
321052d
5e96cec
dc2ade2
c3fb2dd
a3ffae2
40b9b4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
name: Clone Staging Database | ||
# This workflow runs at the top of every hour and can be manually run as needed | ||
# The workflow will copy the database from stable (production) to our staging sandbox. | ||
# This workflow may fail if changes to the database schema make objects in stable | ||
# incompatible with staging. This should resolve once both schemas match again. | ||
|
||
name: Clone Stable Database | ||
|
||
on: | ||
schedule: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment here is incorrect, please update |
||
|
@@ -8,16 +13,19 @@ on: | |
workflow_dispatch: | ||
|
||
env: | ||
DESTINATION_ENVIRONMENT: ms | ||
SOURCE_ENVIRONMENT: staging | ||
# sandbox receiving the cloned db | ||
DESTINATION_ENVIRONMENT: staging | ||
Matt-Spence marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# sandbox we are cloning | ||
SOURCE_ENVIRONMENT: stable | ||
Matt-Spence marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
jobs: | ||
clone-database: | ||
runs-on: ubuntu-24.04 | ||
env: | ||
CF_USERNAME: ${{ secrets.CF_MS_USERNAME }} | ||
CF_PASSWORD: ${{ secrets.CF_MS_PASSWORD }} | ||
# must be the github secrets for the receiving sandbox | ||
CF_USERNAME: ${{ secrets.CF_STAGING_USERNAME }} | ||
Matt-Spence marked this conversation as resolved.
Show resolved
Hide resolved
|
||
CF_PASSWORD: ${{ secrets.CF_STAGING_PASSWORD }} | ||
steps: | ||
- name: Clone Database | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we updating to cf8-cli here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also don't you need to do continue-on-error: true so that if this fails before unsharing the service the last step is triggered? reference There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've been using cf8-cli for months (including when researching for this ticket) with no issues so I figured it would be fine to just go ahead and use it here too. For your second question: I have set the next step to run always(), which does the same thing as continue-on-error in practice. Just two different ways of accomplishing the same thing. |
||
run: | | ||
|
@@ -42,6 +50,11 @@ jobs: | |
# clone from source to destination | ||
cf target -s $SOURCE_ENVIRONMENT | ||
cg-manage-rds clone getgov-$SOURCE_ENVIRONMENT-database getgov-$DESTINATION_ENVIRONMENT-database | ||
|
||
# load fixtures in destination | ||
cf target -s $DESTINATION_ENVIRONMENT | ||
cf run-task getgov-staging --command 'python manage.py load' --name fixtures | ||
|
||
- name: Cleanup | ||
if: always() | ||
run: cf unshare-service getgov-$DESTINATION_ENVIRONMENT-database -s $SOURCE_ENVIRONMENT -f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if the database is missing columns/tables in staging that exist in stable then we do expect this workflow to fail temporarily, correct? If so update this comment to reflect that as that is a very real possibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we do, we will need to ensure that the target database has a compatible schema with the source database.