mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 17:28:31 +02:00
Create dev sandboxes scripts and first sandbox (#370)
* Add templates, scripts, and process documentation for creating and destroying developer sandboxes * Create developer sandbox 'lmm' infrastructure * fix up newlines * fix action syntax pull_request * add a line about the public.crt to developer docs * add docs about branch conventions * add new developer sandbox 'ik' infrastructure * Add new developer sandbox 'nmb' infrastructure * Add new developer sandbox 'sspj' infrastructure * Add new developer sandbox 'mr' infrastructure * make github actions dynamic by environment * trying something out with dynamic github action for dev sandbox * consolidate github actions to dynamic action * try out run name * combo run name and name * respond to comments
This commit is contained in:
parent
6a54bf1ff4
commit
508e5384cb
18 changed files with 524 additions and 67 deletions
51
.github/workflows/deploy-sandbox.yaml
vendored
Normal file
51
.github/workflows/deploy-sandbox.yaml
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
# This workflow runs on pushes when a pull request is opened under certain branch conventions.
|
||||
|
||||
name: Build and deploy developer sandbox
|
||||
run-name: Build and deploy developer sandbox for branch ${{ github.ref_name }}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
|
||||
branches:
|
||||
- 'ik/**'
|
||||
- 'sspj/**'
|
||||
- 'lmm/**'
|
||||
- 'nmb/**'
|
||||
- 'mr/**'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Split branch name
|
||||
env:
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
id: split
|
||||
run: echo "::set-output name=fragment::${BRANCH##*/}"
|
||||
- name: Set secrets
|
||||
id: secret
|
||||
run: |
|
||||
echo "::set-output name=cf_username::CF_${{ steps.split.outputs.fragment }}_USERNAME"
|
||||
echo "::set-output name=cf_password::CF_${{ steps.split.outputs.fragment }}_PASSWORD"
|
||||
- name: Compile USWDS assets
|
||||
working-directory: ./src
|
||||
run: |
|
||||
docker compose run node npm install &&
|
||||
docker compose run node npx gulp copyAssets &&
|
||||
docker compose run node npx gulp compile
|
||||
- name: Collect static assets
|
||||
working-directory: ./src
|
||||
run: docker compose run app python manage.py collectstatic
|
||||
- name: Deploy to cloud.gov sandbox
|
||||
uses: 18f/cg-deploy-action@main
|
||||
env:
|
||||
DEPLOY_NOW: thanks
|
||||
with:
|
||||
cf_username: ${{ secrets[steps.secret.outputs.cf_username] }}
|
||||
cf_password: ${{ secrets[steps.secret.outputs.cf_password] }}
|
||||
cf_org: cisa-getgov-prototyping
|
||||
cf_space: ${{ steps.split.outputs.fragment }}
|
||||
push_arguments: "-f ops/manifests/manifest-${{ steps.split.outputs.fragment }}.yaml"
|
|
@ -1,8 +1,7 @@
|
|||
name: Build and deploy
|
||||
|
||||
# This workflow runs on pushes of tagged commits.
|
||||
# "Releases" of tagged commits will deploy selected branch to stable.
|
||||
|
||||
# "Releases" of tagged commits will deploy `main` to Stable.
|
||||
name: Build and deploy stable for tagged release
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -14,8 +13,6 @@ on:
|
|||
|
||||
jobs:
|
||||
deploy-stable:
|
||||
# if this job runs on a tag, we deduce that code
|
||||
# has been tagged for release and should be deployed to stable
|
||||
if: ${{ github.ref_type == 'tag' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
40
.github/workflows/loaddata.yaml
vendored
40
.github/workflows/loaddata.yaml
vendored
|
@ -1,40 +0,0 @@
|
|||
name: Reset database
|
||||
|
||||
# This workflow can be run from the CLI
|
||||
# gh workflow run loaddata.yaml -f environment=stable
|
||||
# OR
|
||||
# cf run-task getgov-stable --wait \
|
||||
# --command 'python manage.py flush' --name flush
|
||||
# cf run-task getgov-stable --wait \
|
||||
# --command 'python manage.py load' --name loaddata
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
type: choice
|
||||
description: Where should we load data
|
||||
options:
|
||||
- stable
|
||||
|
||||
jobs:
|
||||
reset-db-stable:
|
||||
if: ${{ github.event.inputs.environment == 'stable' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Delete existing data for stable
|
||||
uses: 18f/cg-deploy-action@main
|
||||
with:
|
||||
cf_username: ${{ secrets.CF_STABLE_USERNAME }}
|
||||
cf_password: ${{ secrets.CF_STABLE_PASSWORD }}
|
||||
cf_org: cisa-getgov-prototyping
|
||||
cf_space: stable
|
||||
full_command: "cf run-task getgov-stable --wait --command 'python manage.py flush --no-input' --name flush"
|
||||
|
||||
- name: Load fake data for stable
|
||||
uses: 18f/cg-deploy-action@main
|
||||
with:
|
||||
cf_username: ${{ secrets.CF_STABLE_USERNAME }}
|
||||
cf_password: ${{ secrets.CF_STABLE_PASSWORD }}
|
||||
cf_org: cisa-getgov-prototyping
|
||||
cf_space: stable
|
||||
full_command: "cf run-task getgov-stable --wait --command 'python manage.py load' --name loaddata"
|
38
.github/workflows/migrate.yaml
vendored
38
.github/workflows/migrate.yaml
vendored
|
@ -1,31 +1,37 @@
|
|||
name: Run migrations
|
||||
|
||||
# This workflow can be run from the CLI
|
||||
# gh workflow run migrate.yaml -f environment=sandbox
|
||||
# This workflow can be run from the CLI for any environment
|
||||
# gh workflow run migrate.yaml -f environment=ENVIRONMENT
|
||||
# OR
|
||||
# cf run-task getgov-stable --wait \
|
||||
# --command 'python manage.py migrate' --name migrate
|
||||
# cf run-task getgov-ENVIRONMENT --command 'python manage.py migrate' --name migrate
|
||||
|
||||
name: Migrate data
|
||||
run-name: Run migrations for ${{ github.event.inputs.environment }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
type: choice
|
||||
description: Where should we run migrations
|
||||
description: Which environment should we run migrations for?
|
||||
options:
|
||||
- stable
|
||||
- stable
|
||||
- lmm
|
||||
- ik
|
||||
- sspj
|
||||
- nmb
|
||||
- mr
|
||||
|
||||
jobs:
|
||||
migrate-stable:
|
||||
if: ${{ github.event.inputs.environment == 'stable' }}
|
||||
migrate:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CF_USERNAME: CF_${{ github.event.inputs.environment }}_USERNAME
|
||||
CF_PASSWORD: CF_${{ github.event.inputs.environment }}_PASSWORD
|
||||
steps:
|
||||
- name: Run Django migrations for stable
|
||||
- name: Run Django migrations for ${{ github.event.inputs.environment }}
|
||||
uses: 18f/cg-deploy-action@main
|
||||
with:
|
||||
cf_username: ${{ secrets.CF_STABLE_USERNAME }}
|
||||
cf_password: ${{ secrets.CF_STABLE_PASSWORD }}
|
||||
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
||||
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
||||
cf_org: cisa-getgov-prototyping
|
||||
cf_space: stable
|
||||
full_command: "cf run-task getgov-stable --wait --command 'python manage.py migrate' --name migrate"
|
||||
|
||||
cf_space: ${{ github.event.inputs.environment }}
|
||||
full_command: "cf run-task getgov-${{ github.event.inputs.environment }} --wait --command 'python manage.py migrate' --name migrate"
|
||||
|
|
47
.github/workflows/reset-db.yaml
vendored
Normal file
47
.github/workflows/reset-db.yaml
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
# 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:
|
||||
- stable
|
||||
- lmm
|
||||
- ik
|
||||
- sspj
|
||||
- nmb
|
||||
- mr
|
||||
|
||||
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: 18f/cg-deploy-action@main
|
||||
with:
|
||||
cf_username: ${{ secrets[CF_USERNAME] }}
|
||||
cf_password: ${{ secrets[CF_PASSWORD] }}
|
||||
cf_org: cisa-getgov-prototyping
|
||||
cf_space: ${{ github.event.inputs.environment }}
|
||||
full_command: "cf run-task getgov-${{ github.event.inputs.environment }} --wait --command 'python manage.py flush --no-input' --name flush"
|
||||
|
||||
- name: Load fake data for ${{ github.event.inputs.environment }}
|
||||
uses: 18f/cg-deploy-action@main
|
||||
with:
|
||||
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
||||
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
||||
cf_org: cisa-getgov-prototyping
|
||||
cf_space: ${{ github.event.inputs.environment }}
|
||||
full_command: "cf run-task getgov-${{ github.event.inputs.environment }} --wait --command 'python manage.py load' --name loaddata"
|
Loading…
Add table
Add a link
Reference in a new issue