1+ ---
2+ name : Test replace failed PostgreSQL
3+ on :
4+ pull_request :
5+ paths :
6+ - .github/workflows/**/*
7+ - spec/**/*
8+ - lib/**/*
9+ - tasks/**/*
10+ - functions/**/*
11+ - types/**/*
12+ - plans/**/*
13+ - hiera/**/*
14+ - manifests/**/*
15+ - templates/**/*
16+ - files/**/*
17+ - metadata.json
18+ - Rakefile
19+ - Gemfile
20+ - provision.yaml
21+ - .rspec
22+ - .rubocop.yml
23+ - .puppet-lint.rc
24+ - .fixtures.yml
25+ branches : [main]
26+ workflow_dispatch : {}
27+ jobs :
28+ test-replace-failed-postgresql :
29+ name : PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
30+ runs-on : ubuntu-20.04
31+ env :
32+ BOLT_GEM : true
33+ BOLT_DISABLE_ANALYTICS : true
34+ LANG : en_US.UTF-8
35+ strategy :
36+ fail-fast : false
37+ matrix :
38+ architecture : [extra-large-with-dr-and-spare-replica]
39+ install_architecture : [extra-large-with-dr]
40+ version : [2021.7.9, 2023.8.1, 2025.0.0]
41+ image : [almalinux-cloud/almalinux-8]
42+ steps :
43+ - name : Checkout Source
44+ uses : actions/checkout@v4
45+ with :
46+ ref : ${{ github.head_ref }}
47+ - name : Activate Ruby 2.7
48+ uses : ruby/setup-ruby@v1
49+ with :
50+ ruby-version : ' 2.7'
51+ bundler-cache : true
52+ - name : Print bundle environment
53+ if : ${{ github.repository_owner == 'puppetlabs' }}
54+ run : |
55+ echo ::group::info:bundler
56+ bundle env
57+ echo ::endgroup::
58+ - name : Provision test cluster
59+ timeout-minutes : 15
60+ run : |
61+ echo ::group::prepare
62+ mkdir -p $HOME/.ssh
63+ echo 'Host *' > $HOME/.ssh/config
64+ echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
65+ echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
66+ bundle exec rake spec_prep
67+ echo ::endgroup::
68+ echo ::group::provision
69+ bundle exec bolt plan run peadm_spec::provision_test_cluster \
70+ --modulepath spec/fixtures/modules \
71+ provider=provision_service \
72+ image=${{ matrix.image }} \
73+ architecture=${{ matrix.architecture }} \
74+ --log-level trace
75+ echo ::endgroup::
76+ echo ::group::info:request
77+ cat request.json || true; echo
78+ echo ::endgroup::
79+ echo ::group::info:inventory
80+ sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
81+ echo ::endgroup::
82+ echo ::group::certnames
83+ bundle exec bolt plan run peadm_spec::add_inventory_hostnames \
84+ --inventory spec/fixtures/litmus_inventory.yaml \
85+ --modulepath spec/fixtures/modules \
86+ --no-host-key-check \
87+ inventory_file=spec/fixtures/litmus_inventory.yaml
88+ echo ::endgroup::
89+ - name : Output contents of litmus_inventory.yaml
90+ run : |
91+ cat spec/fixtures/litmus_inventory.yaml
92+ - name : Install PE on test cluster
93+ timeout-minutes : 120
94+ run : |
95+ bundle exec bolt plan run peadm_spec::install_test_cluster \
96+ --inventoryfile spec/fixtures/litmus_inventory.yaml \
97+ --modulepath spec/fixtures/modules \
98+ architecture=${{ matrix.install_architecture }} \
99+ version=${{ matrix.version }} \
100+ console_password=${{ secrets.CONSOLE_PASSWORD }} \
101+ code_manager_auto_configure=true
102+ - name : Replace failed PostgreSQL
103+ run : |
104+ echo ::group::prepare
105+ mkdir -p $HOME/.ssh
106+ echo 'Host *' > $HOME/.ssh/config
107+ echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
108+ echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
109+ bundle exec rake spec_prep
110+ echo ::endgroup::
111+ bundle exec bolt plan run peadm_spec::test_replace_failed_postgres \
112+ --inventoryfile spec/fixtures/litmus_inventory.yaml \
113+ --modulepath spec/fixtures/modules \
114+ primary_host=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .name' spec/fixtures/litmus_inventory.yaml) \
115+ replica_host=$(yq '.groups[].targets[] | select(.vars.role == "replica") | .name' spec/fixtures/litmus_inventory.yaml) \
116+ working_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "replica-pdb-postgresql") | .name' spec/fixtures/litmus_inventory.yaml) \
117+ failed_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "primary-pdb-postgresql") | .name' spec/fixtures/litmus_inventory.yaml) \
118+ replacement_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "spare-replica") | .name' spec/fixtures/litmus_inventory.yaml) \
119+ --no-host-key-check
120+ - name : Tear down PE XL DR test cluster
121+ if : ${{ always() }}
122+ continue-on-error : true
123+ run : |-
124+ if [ -f spec/fixtures/litmus_inventory.yaml ]; then
125+ echo ::group::tear_down
126+ bundle exec rake 'litmus:tear_down'
127+ echo ::endgroup::
128+ echo ::group::info:request
129+ cat request.json || true; echo
130+ echo ::endgroup::
131+ fi
0 commit comments