4
4
schedule :
5
5
- cron : ' 0 0 * * *'
6
6
7
-
8
7
env :
9
- HONEYCOMB_WRITEKEY : 7f3c63a70eecc61d635917de46bea4e6
10
- HONEYCOMB_DATASET : litmus tests
8
+ SERVICE_URL : https://facade-maint-config-windows-use-ssh-6f3kfepqcq-ew.a.run.app/v1/provision
11
9
12
10
jobs :
13
11
setup_matrix :
14
- if : ${{ github.repository_owner == 'puppetlabs' }}
15
12
name : " Setup Test Matrix"
16
- runs-on : ubuntu-20.04
13
+ runs-on : ubuntu-latest
17
14
outputs :
18
15
matrix : ${{ steps.get-matrix.outputs.matrix }}
19
16
20
17
steps :
21
18
22
- - name : " Connect to twingate"
23
- uses : twingate/github-action@v1
24
- with :
25
- service-key : ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }}
26
-
27
- - name : " Honeycomb: Start recording"
28
- uses : puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
29
- with :
30
- apikey : ${{ env.HONEYCOMB_WRITEKEY }}
31
- dataset : ${{ env.HONEYCOMB_DATASET }}
32
- job-status : ${{ job.status }}
33
-
34
- - name : " Honeycomb: Start first step"
35
- run : |
36
- echo STEP_ID=setup-environment >> $GITHUB_ENV
37
- echo STEP_START=$(date +%s) >> $GITHUB_ENV
38
19
- name : Checkout Source
39
20
uses : actions/checkout@v2
40
21
if : ${{ github.repository_owner == 'puppetlabs' }}
@@ -50,61 +31,28 @@ jobs:
50
31
if : ${{ github.repository_owner == 'puppetlabs' }}
51
32
run : |
52
33
echo ::group::bundler environment
53
- buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
34
+ bundle env
54
35
echo ::endgroup::
55
-
56
- - name : " Honeycomb: Record Setup Environment time"
57
- if : ${{ github.repository_owner == 'puppetlabs' }}
58
- run : |
59
- buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
60
- echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
61
- echo STEP_START=$(date +%s) >> $GITHUB_ENV
36
+
62
37
- name : Setup Acceptance Test Matrix
63
38
id : get-matrix
64
- if : ${{ github.repository_owner == 'puppetlabs' }}
65
39
run : |
66
- if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
67
- buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
68
- else
69
- echo "::set-output name=matrix::{}"
70
- fi
71
-
72
- - name : " Honeycomb: Record Setup Test Matrix time"
73
- if : ${{ always() }}
74
- run : |
75
- buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
40
+ bundle exec matrix_from_metadata_v2
41
+ bundle exec matrix_from_metadata_v2
42
+
76
43
Acceptance :
77
44
name : " ${{matrix.platforms.label}}, ${{matrix.collection}}"
78
45
needs :
79
46
- setup_matrix
47
+ if : ${{ needs.setup_matrix.outputs.matrix != '{}' }}
80
48
81
- runs-on : ubuntu-20.04
49
+ runs-on : ubuntu-latest
82
50
strategy :
83
51
fail-fast : false
84
52
matrix : ${{fromJson(needs.setup_matrix.outputs.matrix)}}
85
53
86
- env :
87
- BUILDEVENT_FILE : ' ../buildevents.txt'
88
54
89
55
steps :
90
- - run : |
91
- echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE
92
- echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
93
- echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE
94
-
95
-
96
- - name : " Honeycomb: Start recording"
97
- uses : puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
98
- with :
99
- apikey : ${{ env.HONEYCOMB_WRITEKEY }}
100
- dataset : ${{ env.HONEYCOMB_DATASET }}
101
- job-status : ${{ job.status }}
102
- matrix-key : ${{ matrix.platforms.label }}-${{ matrix.collection }}
103
-
104
- - name : " Honeycomb: start first step"
105
- run : |
106
- echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
107
- echo STEP_START=$(date +%s) >> $GITHUB_ENV
108
56
109
57
- name : Checkout Source
110
58
uses : actions/checkout@v2
@@ -118,92 +66,56 @@ jobs:
118
66
- name : Print bundle environment
119
67
run : |
120
68
echo ::group::bundler environment
121
- buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
69
+ bundle env
122
70
echo ::endgroup::
123
71
124
- - name : " Honeycomb: Record Setup Environment time"
125
- if : ${{ always() }}
126
- run : |
127
- buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
128
- echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
129
- echo STEP_START=$(date +%s) >> $GITHUB_ENV
130
-
131
72
- name : Provision test environment
132
73
run : |
133
- buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
134
- echo ::group::=== REQUEST ===
135
- cat request.json || true
136
- echo
137
- echo ::endgroup::
138
- echo ::group::=== INVENTORY ===
139
- if [ -f 'spec/fixtures/litmus_inventory.yaml' ];
140
- then
141
- FILE='spec/fixtures/litmus_inventory.yaml'
142
- elif [ -f 'inventory.yaml' ];
143
- then
144
- FILE='inventory.yaml'
145
- fi
146
- sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
147
- echo ::endgroup::
74
+ bundle exec rake "litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]"
148
75
149
76
- name : Install agent
150
77
run : |
151
- buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
78
+ bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
152
79
153
80
- name : Install module
154
81
run : |
155
- buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
82
+ bundle exec rake 'litmus:install_module'
156
83
157
- - name : " Honeycomb: Record deployment times"
158
- if : ${{ always() }}
84
+ - name : Authenitcate with GCP
159
85
run : |
160
- echo ::group::honeycomb step
161
- buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
162
- echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
163
- echo STEP_START=$(date +%s) >> $GITHUB_ENV
164
- echo ::endgroup::
86
+ echo '${{ secrets.GCP_CONNECTION }}' >> creds.json
87
+ bundle exec bolt file upload creds.json C:\\creds.json --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
88
+ bundle exec bolt command run "gcloud auth activate-service-account --key-file C:\\creds.json" --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
165
89
166
- - name : Run acceptance tests
90
+ - name : Download & Mount OS ISO
167
91
run : |
168
- buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
92
+ bundle exec bolt command run 'gsutil -q cp gs://artifactory-modules/windows/en_windows_server_2019_updated_july_2020_x64_dvd_94453821.iso C:\\' --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
93
+ bundle exec bolt command run '$isoImg = "C:\\en_windows_server_2019_updated_july_2020_x64_dvd_94453821.iso"
94
+ $driveLetter = "I:"
95
+ $diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter
96
+ $volInfo = $diskImg | Get-Volume
97
+ mountvol $driveLetter $volInfo.UniqueId' --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
169
98
170
- - name : " Honeycomb: Record acceptance testing times"
171
- if : ${{ always() }}
99
+ - name : Download & Mount SQLServer ISO
100
+ run : |
101
+ bundle exec bolt command run "gsutil -q cp gs://artifactory-modules/puppetlabs-sqlserver/SQLServer2019CTP2.4-x64-ENU.iso C:\\" --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
102
+ bundle exec bolt command run '$isoImg = "C:\\SQLServer2019CTP2.4-x64-ENU.iso"
103
+ $driveLetter = "H:"
104
+ $diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter
105
+ $volInfo = $diskImg | Get-Volume
106
+ mountvol $driveLetter $volInfo.UniqueId' --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
107
+
108
+ - name : Set Environment Variable
172
109
run : |
173
- buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
174
- echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
175
- echo STEP_START=$(date +%s) >> $GITHUB_ENV
110
+ pass=`grep -oP '(?<=password: ).*' spec/fixtures/litmus_inventory.yaml`
111
+ bundle exec bolt command run "[Environment]::SetEnvironmentVariable('pass', '$pass', 'Machine')" --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
112
+
113
+ - name : Run acceptance tests
114
+ run : |
115
+ bundle exec rake 'litmus:acceptance:parallel'
176
116
177
117
- name : Remove test environment
178
118
if : ${{ always() }}
179
119
continue-on-error : true
180
120
run : |
181
- if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
182
- buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
183
- echo ::group::=== REQUEST ===
184
- cat request.json || true
185
- echo
186
- echo ::endgroup::
187
- fi
188
-
189
- - name : " Honeycomb: Record removal times"
190
- if : ${{ always() }}
191
- run : |
192
- buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'
193
-
194
- slack-workflow-status :
195
- if : ${{ github.repository_owner == 'puppetlabs' }}
196
- name : Post Workflow Status To Slack
197
- needs :
198
- - Acceptance
199
- runs-on : ubuntu-20.04
200
- steps :
201
- - name : Slack Workflow Notification
202
- uses : puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1
203
- with :
204
- # Required Input
205
- repo_token : ${{ secrets.GITHUB_TOKEN }}
206
- slack_webhook_url : ${{ secrets.SLACK_WEBHOOK }}
207
- # Optional Input
208
- channel : ' #team-cat-bots'
209
- name : ' GABot'
121
+ bundle exec rake 'litmus:tear_down'
0 commit comments