Skip to content

Commit 251dfaf

Browse files
author
petergmurphy
committed
Add CI test for replace_failed_postgresql plan
1 parent 6f88c9a commit 251dfaf

File tree

1 file changed

+169
-0
lines changed

1 file changed

+169
-0
lines changed
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
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: [main]
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 show
60+
bundle exec bolt plan run peadm::replace_failed_postgresql \
61+
--modulepath=spec/fixtures/modules \
62+
primary_host=primary \
63+
replica_host=replica \
64+
working_postgresql_host=primary-pdb-postgresql \
65+
failed_postgresql_host=replica-pdb-postgresql \
66+
replacement_postgresql_host=primary-pdb-postgresql \
67+
--no-host-key-check
68+
- name: Provision test cluster
69+
timeout-minutes: 15
70+
run: |
71+
echo ::group::prepare
72+
mkdir -p $HOME/.ssh
73+
echo 'Host *' > $HOME/.ssh/config
74+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
75+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
76+
bundle exec rake spec_prep
77+
echo ::endgroup::
78+
echo ::group::provision
79+
bundle exec bolt plan run peadm_spec::provision_test_cluster \
80+
--modulepath spec/fixtures/modules \
81+
provider=provision_service \
82+
image=${{ matrix.image }} \
83+
architecture=${{ matrix.architecture }} \
84+
--log-level trace
85+
echo ::endgroup::
86+
echo ::group::info:request
87+
cat request.json || true; echo
88+
echo ::endgroup::
89+
echo ::group::info:inventory
90+
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
91+
echo ::endgroup::
92+
- name: Change PE inventory name
93+
run: |
94+
mv spec/fixtures/litmus_inventory.yaml spec/fixtures/litmus_inventory_PE_XL_DR.yaml
95+
- name: Install PE on test cluster
96+
timeout-minutes: 120
97+
run: |
98+
bundle exec bolt plan run peadm_spec::install_test_cluster \
99+
--inventoryfile spec/fixtures/litmus_inventory_PE_XL_DR.yaml \
100+
--modulepath spec/fixtures/modules \
101+
architecture=${{ matrix.architecture }} \
102+
version=${{ matrix.version }} \
103+
console_password=${{ secrets.CONSOLE_PASSWORD }}
104+
- name: Provision single node
105+
timeout-minutes: 15
106+
run: |
107+
echo ::group::prepare
108+
mkdir -p $HOME/.ssh
109+
echo 'Host *' > $HOME/.ssh/config
110+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
111+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
112+
bundle exec rake spec_prep
113+
echo ::endgroup::
114+
echo ::group::provision
115+
bundle exec bolt plan run peadm_spec::provision_test_cluster \
116+
--modulepath spec/fixtures/modules \
117+
provider=provision_service \
118+
image=almalinux-cloud/almalinux-8 \
119+
architecture=standard \
120+
--log-level trace
121+
echo ::endgroup::
122+
echo ::group::info:request
123+
cat request.json || true; echo
124+
echo ::endgroup::
125+
echo ::group::info:inventory
126+
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
127+
echo ::endgroup::
128+
- name: Change single node inventory name
129+
run: |
130+
mv spec/fixtures/litmus_inventory.yaml spec/fixtures/litmus_inventory_single_node.yaml
131+
# - name: Run migration
132+
# run: |
133+
# bundle exec bolt plan run peadm::replace_failed_postgresql \
134+
# --inventoryfile=spec/fixtures/litmus_inventory_PE_XL_DR.yaml \
135+
# --modulepath=spec/fixtures/modules \
136+
# primary_host=primary \
137+
# replica_host=replica \
138+
# working_postgresql_host=primary-pdb-postgresql \
139+
# failed_postgresql_host=replica-pdb-postgresql \
140+
# replacement_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .uri' spec/fixtures/litmus_inventory_single_node.yaml) \
141+
# --no-host-key-check
142+
- name: Tear down PE XL DR test cluster
143+
if: ${{ always() }}
144+
continue-on-error: true
145+
run: |-
146+
if [ -f spec/fixtures/litmus_inventory_PE_XL_DR.yaml ]; then
147+
mv spec/fixtures/litmus_inventory_PE_XL_DR.yaml spec/fixtures/litmus_inventory.yaml
148+
echo ::group::tear_down
149+
bundle exec rake 'litmus:tear_down'
150+
echo ::endgroup::
151+
echo ::group::info:request
152+
cat request.json || true; echo
153+
echo ::endgroup::
154+
rm -f spec/fixtures/litmus_inventory.yaml
155+
fi
156+
- name: Tear down single node
157+
if: ${{ always() }}
158+
continue-on-error: true
159+
run: |-
160+
if [ -f spec/fixtures/litmus_inventory_single_node.yaml ]; then
161+
mv spec/fixtures/litmus_inventory_single_node.yaml spec/fixtures/litmus_inventory.yaml
162+
echo ::group::tear_down
163+
bundle exec rake 'litmus:tear_down'
164+
echo ::endgroup::
165+
echo ::group::info:request
166+
cat request.json || true; echo
167+
echo ::endgroup::
168+
rm -f spec/fixtures/litmus_inventory.yaml
169+
fi

0 commit comments

Comments
 (0)