mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-14 05:29:43 +02:00
script thus far
This commit is contained in:
parent
d2323aa9ab
commit
d36ba58f77
1 changed files with 88 additions and 0 deletions
88
.github/workflows/reset-db-without-sb-takedown.yaml
vendored
Normal file
88
.github/workflows/reset-db-without-sb-takedown.yaml
vendored
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
# 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 }} without taking down the sandbox
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
environment:
|
||||||
|
type: choice
|
||||||
|
description: Which environment should we flush and re-load data for?
|
||||||
|
options:
|
||||||
|
- staging
|
||||||
|
- development
|
||||||
|
- el
|
||||||
|
- ad
|
||||||
|
- ms
|
||||||
|
- ag
|
||||||
|
- litterbox
|
||||||
|
- hotgov
|
||||||
|
- cb
|
||||||
|
- bob
|
||||||
|
- meoward
|
||||||
|
- backup
|
||||||
|
- ky
|
||||||
|
- es
|
||||||
|
- nl
|
||||||
|
- rh
|
||||||
|
- za
|
||||||
|
- gd
|
||||||
|
- rb
|
||||||
|
- ko
|
||||||
|
- ab
|
||||||
|
- 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: Unbind the database service
|
||||||
|
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: "cf unbind-service getgov-${{ github.event.inputs.environment }} getgov-${{ github.event.inputs.environment }}-database"
|
||||||
|
- name: Delete the service
|
||||||
|
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: "cf unbind-service getgov-${{ github.event.inputs.environment }} getgov-${{ github.event.inputs.environment }}-database"
|
||||||
|
-name: Recreate the service
|
||||||
|
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: "cf create-service aws-rds micro-psql getgov-${{ github.event.inputs.environment }} getgov-${{ github.event.inputs.environment }}-database"
|
||||||
|
-name: Recreate the service
|
||||||
|
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: "cf create-service aws-rds micro-psql getgov-${{ github.event.inputs.environment }} getgov-${{ github.event.inputs.environment }}-database"
|
||||||
|
-name: Rebind the service
|
||||||
|
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: "cf bind-service getgov-env getgov-${{ github.event.inputs.environment }}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue