Skip to content

Commit 7eebaba

Browse files
author
petergmurphy
committed
Add CI test for replace_failed_postgresql plan
1 parent f5a2417 commit 7eebaba

File tree

1 file changed

+168
-0
lines changed

1 file changed

+168
-0
lines changed
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
---
2+
name: Test migration for failed database
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: [PE-40163-replace-failed-postgres-plan]
26+
workflow_dispatch: {}
27+
jobs:
28+
test-migrate-failed-db:
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]
39+
version: [2023.8.0] # can change to test multiple versions once this one works
40+
image: [almalinux-cloud/almalinux-8]
41+
steps:
42+
- name: Checkout Source
43+
uses: actions/checkout@v4
44+
with:
45+
ref: ${{ github.head_ref }}
46+
- name: Activate Ruby 2.7
47+
uses: ruby/setup-ruby@v1
48+
with:
49+
ruby-version: '2.7'
50+
bundler-cache: true
51+
- name: Print bundle environment
52+
if: ${{ github.repository_owner == 'puppetlabs' }}
53+
run: |
54+
echo ::group::info:bundler
55+
bundle env
56+
echo ::endgroup::
57+
- name: Run migration
58+
run: |
59+
bundle exec bolt plan run peadm::replace_failed_postgresql \
60+
--modulepath=spec/fixtures/modules \
61+
primary_host=primary \
62+
replica_host=replica \
63+
working_postgresql_host=primary-pdb-postgresql \
64+
failed_postgresql_host=replica-pdb-postgresql \
65+
replacement_postgresql_host=primary-pdb-postgresql \
66+
--no-host-key-check
67+
- name: Provision test cluster
68+
timeout-minutes: 15
69+
run: |
70+
echo ::group::prepare
71+
mkdir -p $HOME/.ssh
72+
echo 'Host *' > $HOME/.ssh/config
73+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
74+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
75+
bundle exec rake spec_prep
76+
echo ::endgroup::
77+
echo ::group::provision
78+
bundle exec bolt plan run peadm_spec::provision_test_cluster \
79+
--modulepath spec/fixtures/modules \
80+
provider=provision_service \
81+
image=${{ matrix.image }} \
82+
architecture=${{ matrix.architecture }} \
83+
--log-level trace
84+
echo ::endgroup::
85+
echo ::group::info:request
86+
cat request.json || true; echo
87+
echo ::endgroup::
88+
echo ::group::info:inventory
89+
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
90+
echo ::endgroup::
91+
- name: Change PE inventory name
92+
run: |
93+
mv spec/fixtures/litmus_inventory.yaml spec/fixtures/litmus_inventory_PE_XL_DR.yaml
94+
- name: Install PE on test cluster
95+
timeout-minutes: 120
96+
run: |
97+
bundle exec bolt plan run peadm_spec::install_test_cluster \
98+
--inventoryfile spec/fixtures/litmus_inventory_PE_XL_DR.yaml \
99+
--modulepath spec/fixtures/modules \
100+
architecture=${{ matrix.architecture }} \
101+
version=${{ matrix.version }} \
102+
console_password=${{ secrets.CONSOLE_PASSWORD }}
103+
- name: Provision single node
104+
timeout-minutes: 15
105+
run: |
106+
echo ::group::prepare
107+
mkdir -p $HOME/.ssh
108+
echo 'Host *' > $HOME/.ssh/config
109+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
110+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
111+
bundle exec rake spec_prep
112+
echo ::endgroup::
113+
echo ::group::provision
114+
bundle exec bolt plan run peadm_spec::provision_test_cluster \
115+
--modulepath spec/fixtures/modules \
116+
provider=provision_service \
117+
image=almalinux-cloud/almalinux-8 \
118+
architecture=standard \
119+
--log-level trace
120+
echo ::endgroup::
121+
echo ::group::info:request
122+
cat request.json || true; echo
123+
echo ::endgroup::
124+
echo ::group::info:inventory
125+
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
126+
echo ::endgroup::
127+
- name: Change single node inventory name
128+
run: |
129+
mv spec/fixtures/litmus_inventory.yaml spec/fixtures/litmus_inventory_single_node.yaml
130+
# - name: Run migration
131+
# run: |
132+
# bundle exec bolt plan run peadm::replace_failed_postgresql \
133+
# --inventoryfile=spec/fixtures/litmus_inventory_PE_XL_DR.yaml \
134+
# --modulepath=spec/fixtures/modules \
135+
# primary_host=primary \
136+
# replica_host=replica \
137+
# working_postgresql_host=primary-pdb-postgresql \
138+
# failed_postgresql_host=replica-pdb-postgresql \
139+
# replacement_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .uri' spec/fixtures/litmus_inventory_single_node.yaml) \
140+
# --no-host-key-check
141+
- name: Tear down PE XL DR test cluster
142+
if: ${{ always() }}
143+
continue-on-error: true
144+
run: |-
145+
if [ -f spec/fixtures/litmus_inventory_PE_XL_DR.yaml ]; then
146+
mv spec/fixtures/litmus_inventory_PE_XL_DR.yaml spec/fixtures/litmus_inventory.yaml
147+
echo ::group::tear_down
148+
bundle exec rake 'litmus:tear_down'
149+
echo ::endgroup::
150+
echo ::group::info:request
151+
cat request.json || true; echo
152+
echo ::endgroup::
153+
rm -f spec/fixtures/litmus_inventory.yaml
154+
fi
155+
- name: Tear down single node
156+
if: ${{ always() }}
157+
continue-on-error: true
158+
run: |-
159+
if [ -f spec/fixtures/litmus_inventory_single_node.yaml ]; then
160+
mv spec/fixtures/litmus_inventory_single_node.yaml spec/fixtures/litmus_inventory.yaml
161+
echo ::group::tear_down
162+
bundle exec rake 'litmus:tear_down'
163+
echo ::endgroup::
164+
echo ::group::info:request
165+
cat request.json || true; echo
166+
echo ::endgroup::
167+
rm -f spec/fixtures/litmus_inventory.yaml
168+
fi

0 commit comments

Comments
 (0)