mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-26 04:28:39 +02:00
65 lines
2.3 KiB
YAML
65 lines
2.3 KiB
YAML
# This workflow can be run from the CLI
|
|
# gh workflow run reset-db.yaml -f environment=ENVIRONMENT
|
|
# OR
|
|
# cf run-task getgov-ENVIRONMENT --command 'python manage.py flush' --name flush
|
|
# cf run-task getgov-ENVIRONMENT --command 'python manage.py load' --name loaddata
|
|
|
|
name: Reset database
|
|
run-name: Reset database for ${{ github.event.inputs.environment }}
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
environment:
|
|
type: choice
|
|
description: Which environment should we flush and re-load data for?
|
|
options:
|
|
- staging
|
|
- development
|
|
- backup
|
|
- ky
|
|
- es
|
|
- nl
|
|
- rh
|
|
- za
|
|
- gd
|
|
- rb
|
|
- ko
|
|
- ab
|
|
- bl
|
|
- rjm
|
|
- dk
|
|
|
|
jobs:
|
|
reset-db:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CF_USERNAME: CF_${{ github.event.inputs.environment }}_USERNAME
|
|
CF_PASSWORD: CF_${{ github.event.inputs.environment }}_PASSWORD
|
|
steps:
|
|
- name: Delete existing data for ${{ github.event.inputs.environment }}
|
|
uses: cloud-gov/cg-cli-tools@main
|
|
with:
|
|
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
|
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
|
cf_org: cisa-dotgov
|
|
cf_space: ${{ github.event.inputs.environment }}
|
|
cf_command: "run-task getgov-${{ github.event.inputs.environment }} --command 'python manage.py flush --no-input' --name flush"
|
|
|
|
- name: Run Django migrations for ${{ github.event.inputs.environment }}
|
|
uses: cloud-gov/cg-cli-tools@main
|
|
with:
|
|
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
|
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
|
cf_org: cisa-dotgov
|
|
cf_space: ${{ github.event.inputs.environment }}
|
|
cf_command: "run-task getgov-${{ github.event.inputs.environment }} --command 'python manage.py migrate' --name migrate"
|
|
|
|
- name: Load fake data for ${{ github.event.inputs.environment }}
|
|
uses: cloud-gov/cg-cli-tools@main
|
|
with:
|
|
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
|
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
|
cf_org: cisa-dotgov
|
|
cf_space: ${{ github.event.inputs.environment }}
|
|
cf_command: "run-task getgov-${{ github.event.inputs.environment }} --command 'python manage.py load' --name loaddata"
|