Skip to content

Commit a0acfa2

Browse files
author
jordanbreen28
committed
Further acceptance test fix
1 parent b6c056b commit a0acfa2

9 files changed

+120
-268
lines changed

.fixtures.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ fixtures:
44
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
55
provision: 'https://github.com/puppetlabs/provision.git'
66
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
7+
mount_iso: 'https://github.com/puppetlabs/puppetlabs-mount_iso.git'
8+
archive: 'https://github.com/voxpupuli/puppet-archive.git'
79
symlinks:
810
sqlserver: "#{source_dir}"

.github/workflows/nightly.yml

Lines changed: 40 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,15 @@ on:
55
- cron: '0 0 * * *'
66

77

8-
env:
9-
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
10-
HONEYCOMB_DATASET: litmus tests
11-
128
jobs:
139
setup_matrix:
14-
if: ${{ github.repository_owner == 'puppetlabs' }}
1510
name: "Setup Test Matrix"
16-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
1712
outputs:
1813
matrix: ${{ steps.get-matrix.outputs.matrix }}
1914

2015
steps:
2116

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
3817
- name: Checkout Source
3918
uses: actions/checkout@v2
4019
if: ${{ github.repository_owner == 'puppetlabs' }}
@@ -50,61 +29,28 @@ jobs:
5029
if: ${{ github.repository_owner == 'puppetlabs' }}
5130
run: |
5231
echo ::group::bundler environment
53-
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
32+
bundle env
5433
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
34+
6235
- name: Setup Acceptance Test Matrix
6336
id: get-matrix
64-
if: ${{ github.repository_owner == 'puppetlabs' }}
6537
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'
38+
bundle exec matrix_from_metadata_v2
39+
bundle exec matrix_from_metadata_v2
40+
7641
Acceptance:
7742
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
7843
needs:
7944
- setup_matrix
45+
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
8046

81-
runs-on: ubuntu-20.04
47+
runs-on: ubuntu-latest
8248
strategy:
8349
fail-fast: false
8450
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
8551

86-
env:
87-
BUILDEVENT_FILE: '../buildevents.txt'
8852

8953
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
10854

10955
- name: Checkout Source
11056
uses: actions/checkout@v2
@@ -118,92 +64,56 @@ jobs:
11864
- name: Print bundle environment
11965
run: |
12066
echo ::group::bundler environment
121-
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
67+
bundle env
12268
echo ::endgroup::
12369
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-
13170
- name: Provision test environment
13271
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::
72+
bundle exec rake "litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]"
14873
14974
- name: Install agent
15075
run: |
151-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
76+
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
15277
15378
- name: Install module
15479
run: |
155-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
80+
bundle exec rake 'litmus:install_module'
15681
157-
- name: "Honeycomb: Record deployment times"
158-
if: ${{ always() }}
82+
- name: Authenitcate with GCP
15983
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::
84+
echo '${{ secrets.GCP_CONNECTION }}' >> creds.json
85+
bundle exec bolt file upload creds.json C:\\creds.json --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
86+
bundle exec bolt command run "gcloud auth activate-service-account --key-file C:\\creds.json" --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
16587
166-
- name: Run acceptance tests
88+
- name: Download & Mount OS ISO
16789
run: |
168-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
90+
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
91+
bundle exec bolt command run '$isoImg = "C:\\en_windows_server_2019_updated_july_2020_x64_dvd_94453821.iso"
92+
$driveLetter = "I:"
93+
$diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter
94+
$volInfo = $diskImg | Get-Volume
95+
mountvol $driveLetter $volInfo.UniqueId' --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
16996
170-
- name: "Honeycomb: Record acceptance testing times"
171-
if: ${{ always() }}
97+
- name: Download & Mount SQLServer ISO
98+
run: |
99+
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
100+
bundle exec bolt command run '$isoImg = "C:\\SQLServer2019CTP2.4-x64-ENU.iso"
101+
$driveLetter = "H:"
102+
$diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter
103+
$volInfo = $diskImg | Get-Volume
104+
mountvol $driveLetter $volInfo.UniqueId' --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
105+
106+
- name: Set Environment Variable
172107
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
108+
pass=`grep -oP '(?<=password: ).*' spec/fixtures/litmus_inventory.yaml`
109+
bundle exec bolt command run "[Environment]::SetEnvironmentVariable('pass', '$pass', 'Machine')" --targets ssh_nodes --inventoryfile spec/fixtures/litmus_inventory.yaml
110+
111+
- name: Run acceptance tests
112+
run: |
113+
bundle exec rake 'litmus:acceptance:parallel'
176114
177115
- name: Remove test environment
178116
if: ${{ always() }}
179117
continue-on-error: true
180118
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'
119+
bundle exec rake 'litmus:tear_down'

0 commit comments

Comments
 (0)