mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 10:46:06 +02:00
Merge pull request #3061 from cisagov/ms/2903-clone-stable-to-staging
#2903: Target Stable/Staging for Clone Workflow
This commit is contained in:
commit
a872893d00
1 changed files with 23 additions and 5 deletions
|
@ -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:
|
||||
|
@ -8,16 +13,19 @@ on:
|
|||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
DESTINATION_ENVIRONMENT: ms
|
||||
SOURCE_ENVIRONMENT: staging
|
||||
# sandbox receiving the cloned db
|
||||
DESTINATION_ENVIRONMENT: staging
|
||||
# sandbox we are cloning
|
||||
SOURCE_ENVIRONMENT: stable
|
||||
|
||||
|
||||
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 }}
|
||||
CF_PASSWORD: ${{ secrets.CF_STAGING_PASSWORD }}
|
||||
steps:
|
||||
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
|
||||
- name: Clone Database
|
||||
|
@ -43,6 +51,16 @@ jobs:
|
|||
# clone from source to destination
|
||||
cf target -s $SOURCE_ENVIRONMENT
|
||||
cg-manage-rds clone getgov-$SOURCE_ENVIRONMENT-database getgov-$DESTINATION_ENVIRONMENT-database
|
||||
|
||||
- name: Load Fixtures
|
||||
uses: cloud-gov/cg-cli-tools@main
|
||||
with:
|
||||
cf_username: ${{ secrets.CF_STAGING_USERNAME }}
|
||||
cf_password: ${{ secrets.CF_STAGING_PASSWORD }}
|
||||
cf_org: cisa-dotgov
|
||||
cf_space: ${{ env.DESTINATION_ENVIRONMENT }}
|
||||
cf_command: "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
|
Loading…
Add table
Add a link
Reference in a new issue