-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration sync GitHub workflow
This adds a workflow that allows us to trigger the configuration sync task via GitHub Actions rather than needing to do it manually using kubectl.
- Loading branch information
1 parent
f4e4cb7
commit fccd37b
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Synchronise configuration | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
export: | ||
name: Export from production | ||
runs-on: ubuntu-latest | ||
|
||
environment: production | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: Azure/login@v2 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- uses: ./.github/actions/set-kubernetes-credentials | ||
with: | ||
environment: production | ||
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- name: Export configuration data | ||
run: | | ||
kubectl exec \ | ||
-n tra-production \ | ||
deployment/apply-for-qts-production-web \ | ||
-- sh -c "cd /app && /usr/local/bin/bundle exec rails configuration_sync:export[data.json]" | ||
- name: Copy configuration data | ||
run: | | ||
kubectl cp \ | ||
-n tra-production \ | ||
deployment/apply-for-qts-production-web:data.json \ | ||
data.json | ||
- name: Upload configuration data | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: data | ||
path: data.json | ||
retention-days: 3 | ||
|
||
import: | ||
name: Export from production | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
environment: [development, test] | ||
|
||
environment: ${{ matrix.environment }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: Azure/login@v2 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- uses: ./.github/actions/set-kubernetes-credentials | ||
with: | ||
environment: ${{ matrix.environment }} | ||
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- name: Download configuration data | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: data | ||
|
||
- name: Copy configuration data | ||
run: | | ||
kubectl cp \ | ||
-n tra-${{ matrix.environment }} \ | ||
data.json \ | ||
deployment/apply-for-qts-${{ matrix.environment }}-web:data.json | ||
- name: Import configuration data | ||
run: | | ||
kubectl exec \ | ||
-n tra-${{ matrix.environment }} \ | ||
deployment/apply-for-qts-${{ matrix.environment }}-web \ | ||
-- sh -c "cd /app && /usr/local/bin/bundle exec rails configuration_sync:import[data.json]" |