Create new stable environment (#367)

update documentation for environments and setup new stable environment
This commit is contained in:
Logan McDonald 2023-01-17 13:54:30 -08:00 committed by GitHub
parent 80f8748f39
commit 6a54bf1ff4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 88 additions and 137 deletions

View file

@ -1,33 +1,22 @@
name: Build and deploy
# This workflow runs on pushes to main (typically,
# a merged pull request) and on pushes of tagged commits.
# This workflow runs on pushes of tagged commits.
# Pushes to main will deploy to Staging
# This will also deploy nightly
# "Releases" of tagged commits will deploy `main` to Stable.
on:
schedule:
# 3am UTC
- cron: '0 3 * * *'
push:
paths-ignore:
- 'docs/**'
branches:
- main
tags:
- v*
workflow_dispatch:
jobs:
deploy-staging:
# if this job runs on a branch, we deduce that code
# has been pushed to main and should be deployed to staging
if: ${{ github.ref_type == 'branch' }}
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:
- uses: actions/checkout@v3
@ -46,8 +35,8 @@ jobs:
env:
DEPLOY_NOW: thanks
with:
cf_username: ${{ secrets.CF_STAGING_USERNAME }}
cf_password: ${{ secrets.CF_STAGING_PASSWORD }}
cf_username: ${{ secrets.CF_STABLE_USERNAME }}
cf_password: ${{ secrets.CF_STABLE_PASSWORD }}
cf_org: cisa-getgov-prototyping
cf_space: staging
push_arguments: "-f ops/manifests/manifest-staging.yaml"
cf_space: stable
push_arguments: "-f ops/manifests/manifest-stable.yaml"

View file

@ -1,11 +1,11 @@
name: Reset database
# This workflow can be run from the CLI
# gh workflow run loaddata.yaml -f environment=staging
# gh workflow run loaddata.yaml -f environment=stable
# OR
# cf run-task getgov-staging --wait \
# cf run-task getgov-stable --wait \
# --command 'python manage.py flush' --name flush
# cf run-task getgov-staging --wait \
# cf run-task getgov-stable --wait \
# --command 'python manage.py load' --name loaddata
on:
workflow_dispatch:
@ -14,27 +14,27 @@ on:
type: choice
description: Where should we load data
options:
- staging
- stable
jobs:
reset-db-staging:
if: ${{ github.event.inputs.environment == 'staging' }}
reset-db-stable:
if: ${{ github.event.inputs.environment == 'stable' }}
runs-on: ubuntu-latest
steps:
- name: Delete existing data for staging
- name: Delete existing data for stable
uses: 18f/cg-deploy-action@main
with:
cf_username: ${{ secrets.CF_STAGING_USERNAME }}
cf_password: ${{ secrets.CF_STAGING_PASSWORD }}
cf_username: ${{ secrets.CF_STABLE_USERNAME }}
cf_password: ${{ secrets.CF_STABLE_PASSWORD }}
cf_org: cisa-getgov-prototyping
cf_space: staging
full_command: "cf run-task getgov-staging --wait --command 'python manage.py flush --no-input' --name flush"
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 staging
- name: Load fake data for stable
uses: 18f/cg-deploy-action@main
with:
cf_username: ${{ secrets.CF_STAGING_USERNAME }}
cf_password: ${{ secrets.CF_STAGING_PASSWORD }}
cf_username: ${{ secrets.CF_STABLE_USERNAME }}
cf_password: ${{ secrets.CF_STABLE_PASSWORD }}
cf_org: cisa-getgov-prototyping
cf_space: staging
full_command: "cf run-task getgov-staging --wait --command 'python manage.py load' --name loaddata"
cf_space: stable
full_command: "cf run-task getgov-stable --wait --command 'python manage.py load' --name loaddata"

View file

@ -3,7 +3,7 @@ name: Run migrations
# This workflow can be run from the CLI
# gh workflow run migrate.yaml -f environment=sandbox
# OR
# cf run-task getgov-staging --wait \
# cf run-task getgov-stable --wait \
# --command 'python manage.py migrate' --name migrate
on:
@ -13,19 +13,19 @@ on:
type: choice
description: Where should we run migrations
options:
- staging
- stable
jobs:
migrate-staging:
if: ${{ github.event.inputs.environment == 'staging' }}
migrate-stable:
if: ${{ github.event.inputs.environment == 'stable' }}
runs-on: ubuntu-latest
steps:
- name: Run Django migrations for staging
- name: Run Django migrations for stable
uses: 18f/cg-deploy-action@main
with:
cf_username: ${{ secrets.CF_STAGING_USERNAME }}
cf_password: ${{ secrets.CF_STAGING_PASSWORD }}
cf_username: ${{ secrets.CF_STABLE_USERNAME }}
cf_password: ${{ secrets.CF_STABLE_PASSWORD }}
cf_org: cisa-getgov-prototyping
cf_space: staging
full_command: "cf run-task getgov-staging --wait --command 'python manage.py migrate' --name migrate"
cf_space: stable
full_command: "cf run-task getgov-stable --wait --command 'python manage.py migrate' --name migrate"