Showing with 3,063 additions and 1,049 deletions.
  1. +2 −1 .fixtures.yml
  2. +32 −0 .github/README.md
  3. +84 −0 .github/workflows/auto_release.yml
  4. +47 −0 .github/workflows/release.yml
  5. +184 −0 .github/workflows/test-add-replica.yaml
  6. +149 −0 .github/workflows/test-install-matrix.yaml
  7. +176 −0 .github/workflows/test-install.yaml
  8. +4 −0 .gitignore
  9. +16 −0 .gitlab-ci.yml
  10. +3 −0 .pdkignore
  11. +10 −6 .sync.yml
  12. +27 −1 CHANGELOG.md
  13. +2 −12 Gemfile
  14. +190 −0 HISTORY.md
  15. +9 −8 README.md
  16. +2 −2 Rakefile
  17. +0 −10 bolt-project.yaml
  18. +21 −21 documentation/classification.md
  19. +2 −2 documentation/convert.md
  20. +5 −4 documentation/docker_examples.md
  21. BIN documentation/images/{PE_Large_Architecture_no_HA.png → PE_Large_Architecture_no_DR.png}
  22. BIN documentation/images/pe-master-a.png
  23. BIN documentation/images/pe-master-b.png
  24. BIN documentation/images/pe-primary-a.png
  25. BIN documentation/images/pe-primary-b.png
  26. BIN documentation/images/pe-xl-classification.png
  27. +53 −34 documentation/{provision.md → install.md}
  28. +2 −2 documentation/pre_post_checks.md
  29. +211 −0 documentation/recovery.md
  30. +18 −18 documentation/upgrade.md
  31. +4 −4 examples/provision/extra-large-ha.json
  32. +2 −2 examples/provision/extra-large.json
  33. +2 −2 examples/provision/large-ha.json
  34. +1 −1 examples/provision/large.json
  35. +1 −1 examples/provision/minimal.json
  36. +2 −2 examples/provision/standard-ha.json
  37. +1 −1 examples/provision/standard.json
  38. +80 −0 functions/assert_supported_architecture.pp
  39. +6 −3 functions/{check_bolt_version.pp → assert_supported_bolt_version.pp}
  40. +24 −0 functions/assert_supported_pe_version.pp
  41. +27 −0 functions/certname.pp
  42. +12 −8 functions/get_targets.pp
  43. +0 −18 functions/target_name.pp
  44. +0 −80 functions/validate_architecture.pp
  45. +0 −21 functions/validate_version.pp
  46. +17 −0 manifests/setup/convert_node_manager.pp
  47. +36 −29 manifests/setup/node_manager.pp
  48. +4 −2 manifests/setup/node_manager_yaml.pp
  49. +5 −5 metadata.json
  50. +90 −0 plans/add_compiler.pp
  51. +108 −0 plans/add_replica.pp
  52. +97 −95 plans/convert.pp
  53. +20 −20 plans/{provision.pp → install.pp}
  54. +4 −4 plans/misc/divert_code_manager.pp
  55. +38 −0 plans/modify_cert_extensions.pp
  56. +2 −2 plans/status.pp
  57. +40 −40 plans/{action → subplans}/configure.pp
  58. +150 −156 plans/{action → subplans}/install.pp
  59. +111 −0 plans/subplans/modify_cert_extensions.pp
  60. +72 −72 plans/upgrade.pp
  61. +0 −121 plans/util/add_cert_extensions.pp
  62. +1 −1 plans/util/insert_csr_extension_requests.pp
  63. +5 −5 plans/util/sanitize_pg_pe_conf.pp
  64. +3 −0 spec/acceptance/peadm_spec/README.md
  65. +26 −0 spec/acceptance/peadm_spec/plans/add_replica.pp
  66. +57 −0 spec/acceptance/peadm_spec/plans/install_test_cluster.pp
  67. +43 −0 spec/acceptance/peadm_spec/plans/provision_test_cluster.pp
  68. +4 −4 spec/docker/extra-large-ha/docker-compose.yaml
  69. +5 −5 spec/docker/extra-large-ha/params.json
  70. +5 −5 spec/docker/extra-large-ha/upgrade_params.json
  71. +2 −2 spec/docker/extra-large/docker-compose.yaml
  72. +4 −4 spec/docker/extra-large/params.json
  73. +3 −3 spec/docker/extra-large/upgrade_params.json
  74. +2 −2 spec/docker/large-ha/docker-compose.yaml
  75. +3 −3 spec/docker/large-ha/params.json
  76. +3 −3 spec/docker/large-ha/upgrade_params.json
  77. +1 −1 spec/docker/large/docker-compose.yaml
  78. +2 −2 spec/docker/large/params.json
  79. +2 −2 spec/docker/large/upgrade_params.json
  80. +2 −2 spec/docker/standard-ha/docker-compose.yaml
  81. +3 −3 spec/docker/standard-ha/params.json
  82. +3 −3 spec/docker/standard-ha/upgrade_params.json
  83. +1 −1 spec/docker/standard/docker-compose.yaml
  84. +2 −2 spec/docker/standard/params.json
  85. +2 −2 spec/docker/standard/upgrade_params.json
  86. +29 −0 spec/fixtures/plans/pe_conf.json
  87. +9 −0 spec/fixtures/plans/trusted_facts.json
  88. +84 −0 spec/functions/assert_supported_architecture_spec.rb
  89. +6 −6 spec/functions/{validate_version_spec.rb → assert_supported_pe_version_spec.rb}
  90. +1 −1 spec/functions/{target_name_spec.rb → certname_spec.rb}
  91. +29 −5 spec/functions/get_targets_spec.rb
  92. +0 −80 spec/functions/validate_architecture_spec.rb
  93. +55 −0 spec/plans/add_replica_spec.rb
  94. +27 −0 spec/plans/convert_spec.rb
  95. +13 −0 spec/plans/install_spec.rb
  96. +12 −0 spec/plans/misc/divert_code_manager_spec.rb
  97. +24 −0 spec/plans/modify_cert_extensions_spec.rb
  98. +0 −8 spec/plans/status_spec.rb
  99. +19 −0 spec/plans/subplans/configure_spec.rb
  100. +52 −0 spec/plans/subplans/install_spec.rb
  101. +43 −0 spec/plans/subplans/modify_cert_extensions_spec.rb
  102. +28 −0 spec/plans/upgrade_spec.rb
  103. +13 −0 spec/plans/util/insert_csr_extension_request_spec.rb
  104. +44 −0 spec/plans/util/retrieve_and_upload_spec.rb
  105. +19 −0 spec/plans/util/sanitize_pg_pe_conf_spec.rb
  106. +12 −0 spec/spec_helper.rb
  107. +0 −3 spec/spec_helper_local.rb
  108. +8 −0 tasks/cert_data.json
  109. +84 −0 tasks/cert_data.rb
  110. +1 −1 tasks/enable_replica.json
  111. +1 −1 tasks/enable_replica.sh
  112. +2 −2 tasks/pe_install.json
  113. +15 −4 tasks/pe_install.sh
  114. +1 −1 tasks/provision_replica.json
  115. +3 −3 tasks/provision_replica.sh
  116. +40 −19 tasks/sign_csr.rb
  117. +0 −8 tasks/trusted_facts.json
  118. +0 −42 tasks/trusted_facts.rb
3 changes: 2 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ fixtures:
format: 'https://github.com/voxpupuli/puppet-format'
container_inventory: 'https://gitlab.com/nwops/bolt-container_inventory'
symlinks:
"peadm": "#{source_dir}"
"peadm": "#{source_dir}"
"peadm_spec": "#{source_dir}/spec/acceptance/peadm_spec"
32 changes: 32 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# PEADM Workflows for Github Actions

These workflows enable acceptance testing of peadm plans using Github Actions. The Puppet Cloud CI tool from the IAC team is used to provision VMs for testing, and a fixtures module, peadm\_spec, is used to run Bolt-based testing plans. The fixtures module is located in the spec/fixtures/modules/peadm\_spec directory.

## Smoke test workflows

The three smoke test workflows currently available are:

* pr-test
* manual-smoke-test
* manual-smoke-test-with-debugging

All three workflows have the same core functionality: provision Cloud CI VMs, then use peadm::provision to install PE. If the installation is successfull, the smoke test passed.

The debugging workflow adds an extra step to permit users to ssh into the runner VM prior to the workflow kicking off properly. The credentials and ngrok configuration to enable this must be set as secrets on the Github repository.

There are six supported architectures for the smoke test:

* standard
* standard-with-dr
* large
* large-with-dr
* extra-large
* extra-large-with-dr

### PR Test ###

PRs are tested ONLY when a review is requested. This is to prevent unnecessary and expensive testing runs kicking off simply when filing a PR, waiting instead until a user signals the PR is ready for testing by requesting a review.

### Note for maintainers ###

The `steps:` of each of these three workflows are identical, with the exception of the first step in the debugging flow (which is the ssh step). When modifying the steps of any flow, the others should therefore be updatable with a simple full copy-paste.
84 changes: 84 additions & 0 deletions .github/workflows/auto_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Auto release"

on:
workflow_dispatch:

env:
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
HONEYCOMB_DATASET: litmus tests
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
auto_release:
name: "Automatic release prep"
runs-on: ubuntu-20.04

steps:
- name: "Honeycomb: Start recording"
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
with:
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
dataset: ${{ env.HONEYCOMB_DATASET }}
job-status: ${{ job.status }}

- name: "Honeycomb: start first step"
run: |
echo STEP_ID="auto-release" >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
- name: "Checkout Source"
if: ${{ github.repository_owner == 'puppetlabs' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false

- name: "PDK Release prep"
uses: docker://puppet/iac_release:ci
with:
args: 'release prep --force'
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Get Version"
if: ${{ github.repository_owner == 'puppetlabs' }}
id: gv
run: |
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
- name: "Commit changes"
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
- name: Create Pull Request
id: cpr
uses: puppetlabs/peter-evans-create-pull-request@v3
if: ${{ github.repository_owner == 'puppetlabs' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
branch: "release-prep"
delete-branch: true
title: "Release prep v${{ steps.gv.outputs.ver }}"
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 }}.
Please verify before merging:
- [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
- [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
- [ ] Ensure the [changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) version and [metadata](https://github.com/${{ github.repository }}/blob/release-prep/metadata.json) version match
labels: "maintenance"

- name: PR outputs
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: "Honeycomb: Record finish step"
if: ${{ always() }}
run: |
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Publish module"

on:
workflow_dispatch:

jobs:
create-github-release:
name: Deploy GitHub Release
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0
- name: Get Version
id: gv
run: |
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ steps.gv.outputs.ver }}"
draft: false
prerelease: false

deploy-forge:
name: Deploy to Forge
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
clean: true
- name: "PDK Build"
uses: docker://puppet/pdk:nightly
with:
args: 'build'
- name: "Push to Forge"
uses: docker://puppet/pdk:nightly
with:
args: 'release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force'
184 changes: 184 additions & 0 deletions .github/workflows/test-add-replica.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
name: "Add Replica test"

on:
workflow_dispatch:
inputs:
image:
description: 'GCP image for test cluster'
required: true
default: 'centos-7'
architecture:
description: 'PE architecture to test'
required: true
default: 'standard'
version:
description: 'PE version to install'
required: true
default: '2019.8.7'
ssh-debugging:
description: 'Boolean; whether or not to pause for ssh debugging'
required: true
default: 'false'

env:
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
HONEYCOMB_DATASET: litmus tests

jobs:
test-add-replica:
name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}"
runs-on: ubuntu-20.04
env:
BOLT_GEM: true
BOLT_DISABLE_ANALYTICS: true
BUILDEVENT_FILE: '../buildevents.txt'
LANG: 'en_US.UTF-8'
strategy:
fail-fast: false
matrix:
architecture:
- "${{ github.event.inputs.architecture }}"
version:
- "${{ github.event.inputs.version }}"
image:
- "${{ github.event.inputs.image }}"

steps:
- name: 'Start SSH session'
if: ${{ github.event.inputs.ssh-debugging == 'true' }}
uses: luchihoratiu/debug-via-ssh@main
with:
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }}
SSH_PASS: ${{ secrets.SSH_PASS }}

- name: "Honeycomb: Start recording"
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
with:
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
dataset: ${{ env.HONEYCOMB_DATASET }}
job-status: ${{ job.status }}

- name: "Honeycomb: Start first step"
run: |
echo STEP_ID=setup-test-cluster >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
- name: "Checkout Source"
uses: actions/checkout@v2

- name: "Activate Ruby 2.7"
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true

- name: "Print bundle environment"
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
echo ::group::info:bundler
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
echo ::endgroup::
- name: "Honeycomb: Record environment setup time"
if: ${{ always() }}
run: |
echo ::group::honeycomb
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Set up environment'
echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-provision >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
echo ::endgroup::
- name: 'Provision test cluster (specified architecture with added DR)'
timeout-minutes: 15
run: |
echo ::group::prepare
mkdir -p $HOME/.ssh
echo 'Host *' > $HOME/.ssh/config
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
buildevents cmd $TRACE_ID $STEP_ID 'rake spec_prep' -- bundle exec rake spec_prep
echo ::endgroup::
echo ::group::provision
buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::provision_test_cluster' -- \
bundle exec bolt plan run peadm_spec::provision_test_cluster \
--modulepath spec/fixtures/modules \
provider=provision_service \
image=${{ matrix.image }} \
architecture=${{ matrix.architecture }}-with-dr
echo ::endgroup::
echo ::group::info:request
cat request.json || true; echo
echo ::endgroup::
echo ::group::info:inventory
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
echo ::endgroup::
- name: "Honeycomb: Record provision time"
if: ${{ always() }}
run: |
echo ::group::honeycomb
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Provision test cluster'
echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-install >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
echo ::endgroup::
- name: 'Install PE on test cluster'
timeout-minutes: 120
run: |
buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::install_test_cluster' -- \
bundle exec bolt plan run peadm_spec::install_test_cluster \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules \
architecture=${{ matrix.architecture }} \
version=${{ matrix.version }}
- name: "Honeycomb: Record install time"
if: ${{ always() }}
run: |
echo ::group::honeycomb
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Install PE on test cluster'
echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-tear_down >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
echo ::endgroup::
- name: 'Run add_replica plan'
timeout-minutes: 30
run: |
buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::add_replica' -- \
bundle exec bolt plan run peadm_spec::add_replica -v \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules
- name: 'Wait as long as the file ${HOME}/pause file is present'
if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }}
run: |
while [ -f "${HOME}/pause" ] ; do
echo "${HOME}/pause present, sleeping for 60 seconds..."
sleep 60
done
echo "${HOME}/pause absent, continuing workflow."
- name: 'Tear down test cluster'
if: ${{ always() }}
continue-on-error: true
run: |
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
echo ::group::tear_down
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
echo ::endgroup::
echo ::group::info:request
cat request.json || true; echo
echo ::endgroup::
fi
- name: "Honeycomb: Record tear down time"
if: ${{ always() }}
run: |
echo ::group::honeycomb
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Tear down test cluster'
echo ::endgroup::
Loading