Refresh migration DB from production DB #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Refresh migration DB from production DB | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: GitHub environment to refresh from | |
type: choice | |
default: production | |
options: | |
- production | |
required: true | |
schedule: | |
- cron: "0 0 * * *" # Run at midnight. | |
jobs: | |
refresh-migration-db: | |
runs-on: ubuntu-20.04 | |
environment: production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Refresh migration DB | |
uses: ./.github/actions/refresh-migration-database | |
with: | |
environment: production | |
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Login | |
uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- uses: DFE-Digital/github-actions/set-kubelogin-environment@master | |
with: | |
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Install kubectl | |
uses: DFE-Digital/github-actions/set-kubectl@master | |
- name: Set AKS credentials (migration) | |
shell: bash | |
run: make ci migration get-cluster-credentials | |
- name: Generate known keys | |
shell: bash | |
run: | | |
kubectl -n cpd-production exec -ti --tty deployment/cpd-ecf-migration-web -- /bin/sh -c "cd /app && bundle exec rails runner \"PaperTrail.request.whodunnit = %{CI}; Migration::ParityCheck::TokenProvider.new.generate!\"" | |
- name: Turn off DfE analytics feature flag | |
shell: bash | |
run: | | |
kubectl -n cpd-production exec -ti --tty deployment/cpd-ecf-migration-web -- /bin/sh -c "cd /app && bundle exec rails runner \"FeatureFlag.deactivate(:dfe_analytics)\"" |