Skip to content

Commit e57034d

Browse files
committed
(maint) to run tests on gcp
1 parent 66cdd45 commit e57034d

File tree

12 files changed

+381
-141
lines changed

12 files changed

+381
-141
lines changed

.fixtures.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ fixtures:
22
forge_modules:
33
stdlib: 'puppetlabs-stdlib'
44
apt: 'puppetlabs-apt'
5+
puppet_conf: 'puppetlabs-puppet_conf'
56
archive: "puppet-archive"
67
translate: "puppetlabs-translate"
78
augeasproviders_sysctl: "herculesteam-augeasproviders_sysctl"
89
augeasproviders_core: "herculesteam-augeasproviders_core"
910
kmod: "camptocamp-kmod"
11+
helm: 'puppetlabs-helm'
12+
rook: 'puppetlabs-rook'
1013
repositories:
1114
facts: 'git://github.com/puppetlabs/puppetlabs-facts.git'
1215
puppet_agent: 'git://github.com/puppetlabs/puppetlabs-puppet_agent.git'
1316
provision: 'git://github.com/puppetlabs/provision.git'
17+
rook: 'git://github.com/puppetlabs/puppetlabs-rook.git'
1418
yumrepo_core:
1519
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
1620
puppet_version: ">= 6.0.0"

.github/workflows/auto_release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ jobs:
4646
if: ${{ github.repository_owner == 'puppetlabs' }}
4747
id: gv
4848
run: |
49-
echo "::set-output name=ver::$(cat metadata.json | jq .version | tr -d \")"
49+
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
5050
5151
- name: "Commit changes"
5252
if: ${{ github.repository_owner == 'puppetlabs' }}
5353
run: |
54-
git config --local user.email "action@github.com"
54+
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
5555
git config --local user.name "GitHub Action"
5656
git add .
5757
git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
@@ -66,7 +66,7 @@ jobs:
6666
branch: "release-prep"
6767
delete-branch: true
6868
title: "Release prep v${{ steps.gv.outputs.ver }}"
69-
body: "Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb)"
69+
body: "Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb) from commit ${{ github.sha }}"
7070
labels: "maintenance"
7171

7272
- name: PR outputs

.github/workflows/pr_test.yml renamed to .github/workflows/integration_test.yml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "PR Testing"
1+
name: "Integration Testing"
22

33
on: [pull_request]
44

@@ -25,7 +25,6 @@ jobs:
2525
run: |
2626
echo STEP_ID=setup-environment >> $GITHUB_ENV
2727
echo STEP_START=$(date +%s) >> $GITHUB_ENV
28-
2928
- name: Checkout Source
3029
uses: actions/checkout@v2
3130
if: ${{ github.repository_owner == 'puppetlabs' }}
@@ -43,29 +42,25 @@ jobs:
4342
echo ::group::bundler environment
4443
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
4544
echo ::endgroup::
46-
4745
- name: "Honeycomb: Record Setup Environment time"
4846
if: ${{ github.repository_owner == 'puppetlabs' }}
4947
run: |
5048
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
51-
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
49+
echo STEP_ID=Setup-Integration-Test-Matrix >> $GITHUB_ENV
5250
echo STEP_START=$(date +%s) >> $GITHUB_ENV
53-
54-
- name: Setup Acceptance Test Matrix
51+
- name: Setup Integration Test Matrix
5552
id: get-matrix
5653
run: |
5754
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
58-
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata
55+
echo "::set-output name=matrix::{'platform':['centos-7'],'collection':['puppet6-nightly', 'puppet7-nightly']}"
5956
else
6057
echo "::set-output name=matrix::{}"
6158
fi
62-
6359
- name: "Honeycomb: Record Setup Test Matrix time"
6460
if: ${{ always() }}
6561
run: |
6662
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
67-
68-
Acceptance:
63+
Integration:
6964
needs:
7065
- setup_matrix
7166
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
@@ -82,7 +77,6 @@ jobs:
8277
- run: |
8378
echo 'platform=${{ matrix.platform }}' >> $BUILDEVENT_FILE
8479
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
85-
8680
- name: "Honeycomb: Start recording"
8781
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
8882
with:
@@ -95,7 +89,6 @@ jobs:
9589
run: |
9690
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
9791
echo STEP_START=$(date +%s) >> $GITHUB_ENV
98-
9992
- name: Checkout Source
10093
uses: actions/checkout@v2
10194

@@ -110,33 +103,41 @@ jobs:
110103
echo ::group::bundler environment
111104
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
112105
echo ::endgroup::
113-
106+
- name: Create the fixtures directory
107+
run: |
108+
echo ::group::Create the fixtures directory
109+
buildevents cmd $TRACE_ID $STEP_ID 'bundle exec rake spec_prep' -- bundle exec rake spec_prep
110+
echo ::endgroup::
114111
- name: "Honeycomb: Record Setup Environment time"
115112
if: ${{ always() }}
116113
run: |
117114
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
118115
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
119116
echo STEP_START=$(date +%s) >> $GITHUB_ENV
120-
121117
- name: Provision test environment
122118
run: |
123-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platform }}' -- bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]'
119+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision' -- bundle exec bolt --modulepath spec/fixtures/modules plan run kubernetes::provision_gcp gcp_image=${{ matrix.platform }}
124120
echo ::group::=== REQUEST ===
125121
cat request.json || true
126122
echo
127123
echo ::endgroup::
128124
echo ::group::=== INVENTORY ===
129125
sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true
130126
echo ::endgroup::
131-
132-
- name: Install agent
127+
- name: Install module
133128
run: |
134-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
129+
buildevents cmd $TRACE_ID $STEP_ID 'rake kubernetes::puppetserver_setup' -- bundle exec bolt --modulepath spec/fixtures/modules plan run kubernetes::puppetserver_setup -i ./inventory.yaml
130+
- name: Install agent
131+
uses: nick-invision/retry@v1
132+
with:
133+
timeout_minutes: 30
134+
max_attempts: 5
135+
retry_wait_seconds: 60
136+
command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
135137

136138
- name: Install module
137139
run: |
138140
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
139-
140141
- name: "Honeycomb: Record deployment times"
141142
if: ${{ always() }}
142143
run: |
@@ -146,17 +147,15 @@ jobs:
146147
echo STEP_START=$(date +%s) >> $GITHUB_ENV
147148
echo ::endgroup::
148149
149-
- name: Run acceptance tests
150+
- name: Run integration tests
150151
run: |
151-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
152-
153-
- name: "Honeycomb: Record acceptance testing times"
152+
buildevents cmd $TRACE_ID $STEP_ID 'rake kubernetes:integration' -- bundle exec rake kubernetes:integration
153+
- name: "Honeycomb: Record integration testing times"
154154
if: ${{ always() }}
155155
run: |
156-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
156+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run integration tests'
157157
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
158158
echo STEP_START=$(date +%s) >> $GITHUB_ENV
159-
160159
- name: Remove test environment
161160
if: ${{ always() }}
162161
continue-on-error: true
@@ -168,7 +167,6 @@ jobs:
168167
echo
169168
echo ::endgroup::
170169
fi
171-
172170
- name: "Honeycomb: Record removal times"
173171
if: ${{ always() }}
174172
run: |

.github/workflows/nightly.yml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
run: |
2828
echo STEP_ID=setup-environment >> $GITHUB_ENV
2929
echo STEP_START=$(date +%s) >> $GITHUB_ENV
30-
3130
- name: Checkout Source
3231
uses: actions/checkout@v2
3332
if: ${{ github.repository_owner == 'puppetlabs' }}
@@ -45,32 +44,28 @@ jobs:
4544
echo ::group::bundler environment
4645
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
4746
echo ::endgroup::
48-
4947
- name: "Honeycomb: Record Setup Environment time"
5048
if: ${{ github.repository_owner == 'puppetlabs' }}
5149
run: |
5250
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
53-
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
51+
echo STEP_ID=Setup-Integration-Test-Matrix >> $GITHUB_ENV
5452
echo STEP_START=$(date +%s) >> $GITHUB_ENV
55-
56-
- name: Setup Acceptance Test Matrix
53+
- name: Setup Integration Test Matrix
5754
id: get-matrix
58-
if: ${{ github.repository_owner == 'puppetlabs' }}
5955
run: |
6056
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
61-
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata
57+
echo "::set-output name=matrix::{'platform':['centos-7'],'collection':['puppet6-nightly', 'puppet7-nightly']}"
6258
else
6359
echo "::set-output name=matrix::{}"
6460
fi
65-
6661
- name: "Honeycomb: Record Setup Test Matrix time"
6762
if: ${{ always() }}
6863
run: |
6964
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
70-
71-
Acceptance:
65+
Integration:
7266
needs:
7367
- setup_matrix
68+
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
7469

7570
runs-on: ubuntu-20.04
7671
strategy:
@@ -84,7 +79,6 @@ jobs:
8479
- run: |
8580
echo 'platform=${{ matrix.platform }}' >> $BUILDEVENT_FILE
8681
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
87-
8882
- name: "Honeycomb: Start recording"
8983
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
9084
with:
@@ -97,7 +91,6 @@ jobs:
9791
run: |
9892
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
9993
echo STEP_START=$(date +%s) >> $GITHUB_ENV
100-
10194
- name: Checkout Source
10295
uses: actions/checkout@v2
10396

@@ -112,33 +105,41 @@ jobs:
112105
echo ::group::bundler environment
113106
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
114107
echo ::endgroup::
115-
108+
- name: Create the fixtures directory
109+
run: |
110+
echo ::group::Create the fixtures directory
111+
buildevents cmd $TRACE_ID $STEP_ID 'bundle exec rake spec_prep' -- bundle exec rake spec_prep
112+
echo ::endgroup::
116113
- name: "Honeycomb: Record Setup Environment time"
117114
if: ${{ always() }}
118115
run: |
119116
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
120117
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
121118
echo STEP_START=$(date +%s) >> $GITHUB_ENV
122-
123119
- name: Provision test environment
124120
run: |
125-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platform }}' -- bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]'
121+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision' -- bundle exec bolt --modulepath spec/fixtures/modules plan run kubernetes::provision_gcp gcp_image=${{ matrix.platform }}
126122
echo ::group::=== REQUEST ===
127123
cat request.json || true
128124
echo
129125
echo ::endgroup::
130126
echo ::group::=== INVENTORY ===
131127
sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true
132128
echo ::endgroup::
133-
134-
- name: Install agent
129+
- name: Install module
135130
run: |
136-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
131+
buildevents cmd $TRACE_ID $STEP_ID 'rake kubernetes::puppetserver_setup' -- bundle exec bolt --modulepath spec/fixtures/modules plan run kubernetes::puppetserver_setup -i ./inventory.yaml
132+
- name: Install agent
133+
uses: nick-invision/retry@v1
134+
with:
135+
timeout_minutes: 30
136+
max_attempts: 5
137+
retry_wait_seconds: 60
138+
command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
137139

138140
- name: Install module
139141
run: |
140142
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
141-
142143
- name: "Honeycomb: Record deployment times"
143144
if: ${{ always() }}
144145
run: |
@@ -148,17 +149,15 @@ jobs:
148149
echo STEP_START=$(date +%s) >> $GITHUB_ENV
149150
echo ::endgroup::
150151
151-
- name: Run acceptance tests
152+
- name: Run integration tests
152153
run: |
153-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
154-
155-
- name: "Honeycomb: Record acceptance testing times"
154+
buildevents cmd $TRACE_ID $STEP_ID 'rake kubernetes:integration' -- bundle exec rake kubernetes:integration
155+
- name: "Honeycomb: Record integration testing times"
156156
if: ${{ always() }}
157157
run: |
158-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
158+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run integration tests'
159159
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
160160
echo STEP_START=$(date +%s) >> $GITHUB_ENV
161-
162161
- name: Remove test environment
163162
if: ${{ always() }}
164163
continue-on-error: true
@@ -170,7 +169,6 @@ jobs:
170169
echo
171170
echo ::endgroup::
172171
fi
173-
174172
- name: "Honeycomb: Record removal times"
175173
if: ${{ always() }}
176174
run: |

.sync.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ Gemfile:
2222
Rakefile:
2323
changelog_user: puppetlabs
2424
changelog_since_tag: '4.0.0'
25+
extras:
26+
- |
27+
require 'rspec/core/rake_task'
28+
namespace :kubernetes do
29+
RSpec::Core::RakeTask.new(:integration) do |t|
30+
t.pattern = 'spec/acceptance/**{,/*/**}/*_spec.rb'
31+
t.rspec_opts = "--tag integration"
32+
end
33+
end
2534
2635
.rubocop.yml:
2736
include_todos:
@@ -51,8 +60,8 @@ spec/spec_helper.rb:
5160
.gitpod.yml:
5261
unmanaged: false
5362
.github/workflows/nightly.yml:
54-
unmanaged: false
63+
unmanaged: true
5564
.github/workflows/pr_test.yml:
56-
unmanaged: false
65+
unmanaged: true
5766
.github/workflows/auto_release.yml:
5867
unmanaged: false

Rakefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,11 @@ EOM
8787
end
8888
end
8989

90+
require 'rspec/core/rake_task'
91+
namespace :kubernetes do
92+
RSpec::Core::RakeTask.new(:integration) do |t|
93+
t.pattern = 'spec/acceptance/**{,/*/**}/*_spec.rb'
94+
t.rspec_opts = "--tag integration"
95+
end
96+
end
97+

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@
5959
],
6060
"pdk-version": "1.18.1",
6161
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
62-
"template-ref": "heads/main-0-g44cc7ed"
62+
"template-ref": "heads/main-0-g6afe0a2"
6363
}

plans/provision_gcp.pp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# @summary Provisions machines
2+
#
3+
# Provisions machines for integration testing
4+
#
5+
# @example
6+
# kubernetes::provision_integration
7+
plan kubernetes::provision_gcp(
8+
Optional[String] $gcp_image = 'centos-7',
9+
) {
10+
#provision server machine, set role
11+
run_task('provision::provision_service', 'localhost',
12+
action => 'provision', platform => $gcp_image, vars => 'role: controller')
13+
run_task('provision::provision_service', 'localhost',
14+
action => 'provision', platform => $gcp_image, vars => 'role: worker1')
15+
run_task('provision::provision_service', 'localhost',
16+
action => 'provision', platform => $gcp_image, vars => 'role: worker2')
17+
}

0 commit comments

Comments
 (0)