11---
2- name : Install test matrix
2+ name : Test migration for failed database
33on :
44 pull_request :
55 paths :
2222 - .rubocop.yml
2323 - .puppet-lint.rc
2424 - .fixtures.yml
25- branches : [main ]
25+ branches : [PE-40163-replace-failed-postgres-plan ]
2626 workflow_dispatch : {}
2727jobs :
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 :
4141 steps :
4242 - name : Checkout Source
4343 uses : actions/checkout@v4
44+ with :
45+ ref : ${{ github.head_ref }}
4446 - name : Activate Ruby 2.7
4547 uses : ruby/setup-ruby@v1
4648 with :
5254 echo ::group::info:bundler
5355 bundle env
5456 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
5567 - name : Provision test cluster
5668 timeout-minutes : 15
5769 run : |
@@ -76,55 +88,19 @@ jobs:
7688 echo ::group::info:inventory
7789 sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
7890 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
7994 - name : Install PE on test cluster
8095 timeout-minutes : 120
8196 run : |
8297 bundle exec bolt plan run peadm_spec::install_test_cluster \
83- --inventoryfile spec/fixtures/litmus_inventory .yaml \
98+ --inventoryfile spec/fixtures/litmus_inventory_PE_XL_DR .yaml \
8499 --modulepath spec/fixtures/modules \
85100 architecture=${{ matrix.architecture }} \
86101 version=${{ matrix.version }} \
87102 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
103+ - name : Provision single node
128104 timeout-minutes : 15
129105 run : |
130106 echo ::group::prepare
@@ -138,7 +114,7 @@ jobs:
138114 bundle exec bolt plan run peadm_spec::provision_test_cluster \
139115 --modulepath spec/fixtures/modules \
140116 provider=provision_service \
141- image=${{ matrix.image }} \
117+ image=almalinux-cloud/almalinux-8 \
142118 architecture=standard \
143119 --log-level trace
144120 echo ::endgroup::
@@ -148,98 +124,45 @@ jobs:
148124 echo ::group::info:inventory
149125 sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
150126 echo ::endgroup::
151- - name : Install PE on test cluster
152- timeout-minutes : 120
127+ - name : Change single node inventory name
153128 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
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
161142 if : ${{ always() }}
162143 continue-on-error : true
163144 run : |-
164- if [ -f spec/fixtures/litmus_inventory.yaml ]; then
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
165147 echo ::group::tear_down
166148 bundle exec rake 'litmus:tear_down'
167149 echo ::endgroup::
168150 echo ::group::info:request
169151 cat request.json || true; echo
170152 echo ::endgroup::
153+ rm -f spec/fixtures/litmus_inventory.yaml
171154 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
155+ - name : Tear down single node
235156 if : ${{ always() }}
236157 continue-on-error : true
237158 run : |-
238- if [ -f spec/fixtures/litmus_inventory.yaml ]; then
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
239161 echo ::group::tear_down
240162 bundle exec rake 'litmus:tear_down'
241163 echo ::endgroup::
242164 echo ::group::info:request
243165 cat request.json || true; echo
244166 echo ::endgroup::
167+ rm -f spec/fixtures/litmus_inventory.yaml
245168 fi
0 commit comments