-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (84 loc) · 2.81 KB
/
configuration-sync.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Synchronise configuration
on: workflow_dispatch
jobs:
export:
name: Export (production)
runs-on: ubuntu-latest
environment: production
outputs:
output1: ${{ steps.step1.outputs.test }}
output2: ${{ steps.step2.outputs.test }}
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: Get pod name
id: pod-name
run: |
echo "value=$(kubectl get pod \
-n tra-production \
-l app=apply-for-qts-production-web \
-o jsonpath="{.items[0].metadata.name}")" >> $GITHUB_OUTPUT
- name: Export configuration data
run: |
kubectl exec \
-n tra-production \
${{ steps.pod-name.outputs.value }} \
-- 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 \
${{ steps.pod-name.outputs.value }}:data.json \
data.json
- name: Upload configuration data
uses: actions/upload-artifact@v4
with:
name: data
path: data.json
retention-days: 3
import:
name: Import
runs-on: ubuntu-latest
needs: [export]
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: Get pod name
id: pod-name
run: |
echo "value=$(kubectl get pod \
-n tra-${{ matrix.environment }} \
-l app=apply-for-qts-${{ matrix.environment }}-web \
-o jsonpath="{.items[0].metadata.name}")" >> $GITHUB_OUTPUT
- name: Copy configuration data
run: |
kubectl cp \
-n tra-${{ matrix.environment }} \
data.json \
${{ steps.pod-name.outputs.value }}:data.json
- name: Import configuration data
run: |
kubectl exec \
-n tra-${{ matrix.environment }} \
${{ steps.pod-name.outputs.value }} \
-- sh -c "cd /app && /usr/local/bin/bundle exec rails configuration_sync:import[data.json]"