Skip to content

Commit 6387efe

Browse files
author
petergmurphy
committed
Peter's changes
1 parent a678fbd commit 6387efe

File tree

1 file changed

+25
-120
lines changed

1 file changed

+25
-120
lines changed
Lines changed: 25 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Install test matrix
2+
name: Test migration for failed database
33
on:
44
pull_request:
55
paths:
@@ -22,10 +22,10 @@ on:
2222
- .rubocop.yml
2323
- .puppet-lint.rc
2424
- .fixtures.yml
25-
branches: [main]
25+
branches: [PE-40163-replace-failed-postgres-plan]
2626
workflow_dispatch: {}
2727
jobs:
28-
test-install:
28+
test-migrate-failed-db:
2929
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
3030
runs-on: ubuntu-20.04
3131
env:
@@ -76,55 +76,19 @@ jobs:
7676
echo ::group::info:inventory
7777
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
7878
echo ::endgroup::
79+
- name: Change PE inventory name
80+
run: |
81+
mv spec/fixtures/litmus_inventory.yaml spec/fixtures/litmus_inventory_PE_XL_DR.yaml
7982
- name: Install PE on test cluster
8083
timeout-minutes: 120
8184
run: |
8285
bundle exec bolt plan run peadm_spec::install_test_cluster \
83-
--inventoryfile spec/fixtures/litmus_inventory.yaml \
86+
--inventoryfile spec/fixtures/litmus_inventory_PE_XL_DR.yaml \
8487
--modulepath spec/fixtures/modules \
8588
architecture=${{ matrix.architecture }} \
8689
version=${{ matrix.version }} \
8790
console_password=${{ secrets.CONSOLE_PASSWORD }}
88-
- name: Tear down test cluster
89-
if: ${{ always() }}
90-
continue-on-error: true
91-
run: |-
92-
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
93-
echo ::group::tear_down
94-
bundle exec rake 'litmus:tear_down'
95-
echo ::endgroup::
96-
echo ::group::info:request
97-
cat request.json || true; echo
98-
echo ::endgroup::
99-
fi
100-
test-backup: # to replace failed VM
101-
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
102-
runs-on: ubuntu-20.04
103-
env:
104-
BOLT_GEM: true
105-
BOLT_DISABLE_ANALYTICS: true
106-
LANG: en_US.UTF-8
107-
strategy:
108-
fail-fast: false
109-
matrix:
110-
architecture: [extra-large-with-dr]
111-
version: [2023.8.0] # can change to test multiple versions once this one works
112-
image: [almalinux-cloud/almalinux-8]
113-
steps:
114-
- name: Checkout Source
115-
uses: actions/checkout@v4
116-
- name: Activate Ruby 2.7
117-
uses: ruby/setup-ruby@v1
118-
with:
119-
ruby-version: '2.7'
120-
bundler-cache: true
121-
- name: Print bundle environment
122-
if: ${{ github.repository_owner == 'puppetlabs' }}
123-
run: |
124-
echo ::group::info:bundler
125-
bundle env
126-
echo ::endgroup::
127-
- name: Provision test cluster
91+
- name: Provision single node
12892
timeout-minutes: 15
12993
run: |
13094
echo ::group::prepare
@@ -138,7 +102,7 @@ jobs:
138102
bundle exec bolt plan run peadm_spec::provision_test_cluster \
139103
--modulepath spec/fixtures/modules \
140104
provider=provision_service \
141-
image=${{ matrix.image }} \
105+
image=almalinux-cloud/almalinux-8 \
142106
architecture=standard \
143107
--log-level trace
144108
echo ::endgroup::
@@ -148,98 +112,39 @@ jobs:
148112
echo ::group::info:inventory
149113
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
150114
echo ::endgroup::
151-
- name: Install PE on test cluster
152-
timeout-minutes: 120
115+
- name: Change PE inventory name
153116
run: |
154-
bundle exec bolt plan run peadm_spec::install_test_cluster \
155-
--inventoryfile spec/fixtures/litmus_inventory.yaml \
156-
--modulepath spec/fixtures/modules \
157-
architecture=${{ matrix.architecture }} \
158-
version=${{ matrix.version }} \
159-
console_password=${{ secrets.CONSOLE_PASSWORD }}
160-
- name: Tear down test cluster
117+
mv spec/fixtures/litmus_inventory.yaml spec/fixtures/litmus_inventory_single_node.yaml
118+
- name: Run migration
119+
run: |
120+
bolt plan run peadm::replace_failed_postgresql \
121+
inventoryfile=spec/fixtures/litmus_inventory_PE_XL_DR.yaml \
122+
primary_host=primary \
123+
replica_host=replica \
124+
working_postgresql_host=primary-pdb-postgresql \
125+
failed_postgresql_host=replica-pdb-postgresql \
126+
replacement_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .uri' spec/fixtures/litmus_inventory_single_node.yaml) \
127+
--no-host-key-check
128+
- name: Tear down PE XL DR test cluster
161129
if: ${{ always() }}
162130
continue-on-error: true
163131
run: |-
164-
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
132+
if [ -f spec/fixtures/litmus_inventory_PE_XL_DR.yaml ]; then
165133
echo ::group::tear_down
166134
bundle exec rake 'litmus:tear_down'
167135
echo ::endgroup::
168136
echo ::group::info:request
169137
cat request.json || true; echo
170138
echo ::endgroup::
171139
fi
172-
173-
test-backup: # to replace failed VM
174-
test-install:
175-
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
176-
runs-on: ubuntu-20.04
177-
env:
178-
BOLT_GEM: true
179-
BOLT_DISABLE_ANALYTICS: true
180-
LANG: en_US.UTF-8
181-
strategy:
182-
fail-fast: false
183-
matrix:
184-
architecture: [extra-large-with-dr]
185-
version: [2023.8.0] # can change to test multiple versions once this one works
186-
image: [almalinux-cloud/almalinux-8]
187-
steps:
188-
- name: Checkout Source
189-
uses: actions/checkout@v4
190-
- name: Activate Ruby 2.7
191-
uses: ruby/setup-ruby@v1
192-
with:
193-
ruby-version: '2.7'
194-
bundler-cache: true
195-
- name: Print bundle environment
196-
if: ${{ github.repository_owner == 'puppetlabs' }}
197-
run: |
198-
echo ::group::info:bundler
199-
bundle env
200-
echo ::endgroup::
201-
- name: Provision test cluster
202-
timeout-minutes: 15
203-
run: |
204-
echo ::group::prepare
205-
mkdir -p $HOME/.ssh
206-
echo 'Host *' > $HOME/.ssh/config
207-
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
208-
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
209-
bundle exec rake spec_prep
210-
echo ::endgroup::
211-
echo ::group::provision
212-
bundle exec bolt plan run peadm_spec::provision_test_cluster \
213-
--modulepath spec/fixtures/modules \
214-
provider=provision_service \
215-
image=${{ matrix.image }} \
216-
architecture=${{ matrix.architecture }} \
217-
--log-level trace
218-
echo ::endgroup::
219-
echo ::group::info:request
220-
cat request.json || true; echo
221-
echo ::endgroup::
222-
echo ::group::info:inventory
223-
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
224-
echo ::endgroup::
225-
- name: Install PE on test cluster
226-
timeout-minutes: 120
227-
run: |
228-
bundle exec bolt plan run peadm_spec::install_test_cluster \
229-
--inventoryfile spec/fixtures/litmus_inventory.yaml \
230-
--modulepath spec/fixtures/modules \
231-
architecture=${{ matrix.architecture }} \
232-
version=${{ matrix.version }} \
233-
console_password=${{ secrets.CONSOLE_PASSWORD }}
234-
- name: Tear down test cluster
140+
- name: Tear down single node
235141
if: ${{ always() }}
236142
continue-on-error: true
237143
run: |-
238-
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
144+
if [ -f spec/fixtures/litmus_inventory_single_node.yaml ]; then
239145
echo ::group::tear_down
240146
bundle exec rake 'litmus:tear_down'
241147
echo ::endgroup::
242148
echo ::group::info:request
243149
cat request.json || true; echo
244150
echo ::endgroup::
245-
fi

0 commit comments

Comments
 (0)