44 schedule :
55 - cron : ' 0 0 * * *'
66
7-
87env :
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
119
1210jobs :
1311 setup_matrix :
14- if : ${{ github.repository_owner == 'puppetlabs' }}
1512 name : " Setup Test Matrix"
16- runs-on : ubuntu-20.04
13+ runs-on : ubuntu-latest
1714 outputs :
1815 matrix : ${{ steps.get-matrix.outputs.matrix }}
1916
2017 steps :
2118
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
3819 - name : Checkout Source
3920 uses : actions/checkout@v2
4021 if : ${{ github.repository_owner == 'puppetlabs' }}
@@ -50,61 +31,28 @@ jobs:
5031 if : ${{ github.repository_owner == 'puppetlabs' }}
5132 run : |
5233 echo ::group::bundler environment
53- buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
34+ bundle env
5435 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+
6237 - name : Setup Acceptance Test Matrix
6338 id : get-matrix
64- if : ${{ github.repository_owner == 'puppetlabs' }}
6539 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+
7643 Acceptance :
7744 name : " ${{matrix.platforms.label}}, ${{matrix.collection}}"
7845 needs :
7946 - setup_matrix
47+ if : ${{ needs.setup_matrix.outputs.matrix != '{}' }}
8048
81- runs-on : ubuntu-20.04
49+ runs-on : ubuntu-latest
8250 strategy :
8351 fail-fast : false
8452 matrix : ${{fromJson(needs.setup_matrix.outputs.matrix)}}
8553
86- env :
87- BUILDEVENT_FILE : ' ../buildevents.txt'
8854
8955 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
10856
10957 - name : Checkout Source
11058 uses : actions/checkout@v2
@@ -118,92 +66,46 @@ jobs:
11866 - name : Print bundle environment
11967 run : |
12068 echo ::group::bundler environment
121- buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
69+ bundle env
12270 echo ::endgroup::
12371
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-
13172 - name : Provision test environment
13273 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 }}]"
14875
14976 - name : Install agent
15077 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 }}]'
15279
15380 - name : Install module
15481 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'
15683
157- - name : " Honeycomb: Record deployment times"
158- if : ${{ always() }}
84+ - name : Authenitcate with GCP
15985 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
16589
166- - name : Run acceptance tests
90+ - name : Download OS ISO
16791 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
16993
170- - name : " Honeycomb: Record acceptance testing times"
171- if : ${{ always() }}
94+ - name : Download SQLServer ISO
95+ run : |
96+ 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
97+
98+ - name : Set Environment Variable
17299 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
100+ pass=`grep -oP '(?<=password: ).*' spec/fixtures/litmus_inventory.yaml`
101+ bundle exec bolt command run "[Environment]::SetEnvironmentVariable('pass', '$pass', 'Machine')" --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
102+
103+ - name : Run acceptance tests
104+ run : |
105+ bundle exec rake 'litmus:acceptance:parallel'
176106
177107 - name : Remove test environment
178108 if : ${{ always() }}
179109 continue-on-error : true
180110 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'
111+ bundle exec rake 'litmus:tear_down'
0 commit comments