@@ -234,188 +234,58 @@ bats .vortex/tests/bats/deploy.bats
234234
235235## Updating test assets
236236
237- There are * demo* and * test* database dumps captured as * files* and * container images* .
237+ There are * demo* and * test* database dumps captured as * files* and * container
238+ images* . All flows are automated by ` .vortex/tests/update-test-assets ` , which
239+ prints every shell command it runs.
238240
239- ### Updating * demo* database dump * file*
240-
241- <details >
242- <summary >Show instructions</summary >
243-
244- 1 . Run fresh build of ** Vortex** locally:
245- ``` shell
246- rm .data/db.sql || true
247- VORTEX_PROVISION_TYPE=profile VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 AHOY_CONFIRM_RESPONSE=1 ahoy build
248- ```
249- 2 . Update content and config:
250- ``` shell
251- ahoy cli
252-
253- drush eval " Drupal::entityTypeManager()->getStorage('node')->create([
254- 'type' => 'page',
255- 'title' => 'Welcome to the demo site!',
256- 'body' => [
257- 'value' => '<p>This demo page is sourced from the Vortex database dump file to demonstrate database importing capabilities.</p>',
258- 'format' => 'basic_html',
259- ],
260- ])->save();"
261-
262- drush config:set system.site page.front " /node/1" -y
263- drush sql:query " SHOW TABLES LIKE 'cache_%'" | xargs -I{} drush sql:query " TRUNCATE TABLE {}" && drush sql:query " TRUNCATE TABLE watchdog"
264-
265- exit
266-
267- ```
268- 3 . Export DB :
269- ``` shell
270- ahoy export-db db.demo.sql
271- ```
272- 4 . Upload ` db.demo.sql ` to the latest release as an asset and name it ` db_d11.demo.sql ` .
273-
274- </details >
275-
276- ### Updating * demo* database * container image*
277-
278- <details >
279- <summary >Show instructions</summary >
280-
281- 1 . Run fresh build of ** Vortex** locally:
282241``` shell
283- rm .data/db.sql || true
284- VORTEX_PROVISION_TYPE=profile VORTEX_PROVISION_POST_OPERATIONS_SKIP=1 AHOY_CONFIRM_RESPONSE=1 ahoy build
242+ php .vortex/tests/update-test-assets [mode] [--tag < tag> ]
285243```
286- 2 . Update content and config:
287- ``` shell
288- ahoy cli
289244
290- drush eval " Drupal::entityTypeManager()->getStorage('node')->create([
291- 'type' => 'page',
292- 'title' => 'Welcome to the demo site!',
293- 'body' => [
294- 'value' => '<p>This demo page is sourced from the Vortex database container image to demonstrate database importing capabilities.</p>',
295- 'format' => 'basic_html',
296- ],
297- ])->save();"
245+ Without arguments, runs ` all ` for a full refresh. Default tag is ` latest ` .
298246
299- drush config:set system.site page.front " /node/1" -y
300- drush sql:query " SHOW TABLES LIKE 'cache_%'" | xargs -I{} drush sql:query " TRUNCATE TABLE {}" && drush sql:query " TRUNCATE TABLE watchdog"
247+ ### Modes
301248
302- exit
249+ | Mode | What it does | Follow-up |
250+ | --- | --- | --- |
251+ | ` demo-dump ` | Builds the demo profile in-place; exports ` .data/db.demo.sql ` . | Upload as ` db.demo.sql ` to the latest GitHub release. |
252+ | ` demo-image ` | Builds the demo profile in-place; pushes ` drevops/vortex-dev-mariadb-drupal-data-demo-11.x:<tag> ` . | None. |
253+ | ` test-dump ` | Installs Vortex into ` /tmp/star-wars ` ; builds; exports ` /tmp/star-wars/.data/db.test.sql ` . | Upload as ` db_d11.test.sql ` to the latest GitHub release. |
254+ | ` test-image ` | Installs Vortex into ` /tmp/star-wars ` ; builds; pushes ` drevops/vortex-dev-mariadb-drupal-data-test-11.x:<tag> ` . | None. |
255+ | ` destination-images ` | Tags and pushes the local demo image to the didi destination tags (` vortex-dev-database-ii ` , ` vortex-dev-didi-database-fi ` ). | None. |
256+ | ` all ` | Optimised full refresh: builds the demo stack once for both demo modes and the test stack once for both test modes (2 stack builds instead of 4), then pushes images and tags destination images. Default when no mode is given. | Upload both dump files as above. |
303257
304- ```
305- 3 . Export DB :
306- ``` shell
307- ahoy export-db db.demo_image.sql
258+ ### Options
308259
309- # Update the collation to avoid issues with MariaDB 10.5+:
310- sed -i ' ' ' s/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' .data/db.demo_image.sql
311- ```
312- 4 . Seed the database container image:
313- ``` shell
314- curl -LO https://github.com/drevops/mariadb-drupal-data/releases/latest/download/seed.sh
315- chmod +x seed.sh
316- ./seed.sh .data/db.demo_image.sql drevops/vortex-dev-mariadb-drupal-data-demo-11.x:latest
317- ```
318-
319- </details >
320-
321- ### Updating * test* database dump * file*
322-
323- <details >
324- <summary >Show instructions</summary >
260+ | Option | Description |
261+ | --- | --- |
262+ | ` --tag <tag> ` | Image tag for image modes. Default: ` latest ` . Also accepts ` --tag=<tag> ` . |
325263
326- 1 . Run a fresh install of ** Vortex** into a new directory and name the project ` Star Wars ` :
327- ``` shell
328- mkdir /tmp/star-wars
329- VORTEX_INSTALLER_TEMPLATE_REPO=" $( pwd) " .vortex/installer/installer.php /tmp/star-wars --no-interaction
330- cd /tmp/star-wars
331- ```
332- 2 . Run fresh build of ** Vortex** locally:
333- ``` shell
334- rm .data/db.sql || true
335- VORTEX_PROVISION_TYPE=profile AHOY_CONFIRM_RESPONSE=1 ahoy build
336- ```
337- 3 . Update content and config:
338- ``` shell
339- ahoy cli
340-
341- drush eval " Drupal::entityTypeManager()->getStorage('node')->create([
342- 'type' => 'page',
343- 'title' => 'Welcome to the test site!',
344- 'body' => [
345- 'value' => '<p>This test page is sourced from the Vortex database dump file to demonstrate database importing capabilities.</p>',
346- 'format' => 'basic_html',
347- ],
348- ])->save();"
349-
350- drush config:set system.site page.front " /node/1" -y
351- drush sql:query " SHOW TABLES LIKE 'cache_%'" | xargs -I{} drush sql:query " TRUNCATE TABLE {}" && drush sql:query " TRUNCATE TABLE watchdog"
352-
353- exit
264+ ### Requirements
354265
355- ```
356- 4 . Export DB :
357- ``` shell
358- ahoy export-db db.test.sql
359- ```
360- 5 . Upload ` db.test.sql ` to the latest release as an asset and name it ` db_d11.test.sql ` .
266+ - ` docker ` , ` ahoy ` , ` curl ` , ` sed ` , ` php ` available on ` PATH ` .
267+ - A Docker Hub session with push permission to ` drevops/ ` for any image mode.
361268
362- </ details >
269+ ### Caveats
363270
364- ### Updating * test* database * container image*
271+ - Demo modes are ** destructive** against the current repository: containers
272+ are reset and ` .data/db.sql ` is removed before the rebuild.
273+ - Test modes wipe and recreate ` /tmp/star-wars ` on each run.
274+ - ` destination-images ` expects ` drevops/vortex-dev-mariadb-drupal-data-demo-11.x:latest `
275+ to already exist locally - run ` demo-image ` (or ` all ` ) first.
365276
366- <details >
367- <summary >Show instructions</summary >
277+ ### Examples
368278
369- 1 . Run a fresh install of ** Vortex** into a new directory and name the project ` Star Wars ` :
370279``` shell
371- mkdir /tmp/star-wars
372- VORTEX_INSTALLER_TEMPLATE_REPO=" $( pwd) " .vortex/installer/installer.php /tmp/star-wars --no-interaction
373- cd /tmp/star-wars
374- ```
375- 2 . Run fresh build of ** Vortex** locally:
376- ``` shell
377- rm .data/db.sql || true
378- VORTEX_PROVISION_TYPE=profile AHOY_CONFIRM_RESPONSE=1 ahoy build
379- ```
380- 3 . Update content and config:
381- ``` shell
382- ahoy cli
383-
384- drush eval " Drupal::entityTypeManager()->getStorage('node')->create([
385- 'type' => 'page',
386- 'title' => 'Welcome to the test site!',
387- 'body' => [
388- 'value' => '<p>This test page is sourced from the Vortex database container image to demonstrate database importing capabilities.</p>',
389- 'format' => 'basic_html',
390- ],
391- ])->save();"
280+ # Full refresh of every asset at :latest (default).
281+ php .vortex/tests/update-test-assets
392282
393- drush config:set system.site page.front " /node/1" -y
394- drush sql:query " SHOW TABLES LIKE 'cache_%'" | xargs -I{} drush sql:query " TRUNCATE TABLE {}" && drush sql:query " TRUNCATE TABLE watchdog"
395-
396- exit
397-
398- ```
399- 4 . Export DB :
400- ``` shell
401- ahoy export-db db.test_image.sql
283+ # Full refresh, tagging images as :rc1.
284+ php .vortex/tests/update-test-assets --tag rc1
402285
403- # Update the collation to avoid issues with MariaDB 10.5+:
404- sed -i ' ' ' s/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' .data/db.test_image.sql
405- ```
406- 5 . Seed the database container image:
407- ``` shell
408- curl -LO https://github.com/drevops/mariadb-drupal-data/releases/latest/download/seed.sh
409- chmod +x seed.sh
410- ./seed.sh .data/db.test_image.sql drevops/vortex-dev-mariadb-drupal-data-test-11.x:latest
411- ```
412- 6 . Update destination container images:
413- ``` shell
414- docker tag drevops/vortex-dev-mariadb-drupal-data-demo-11.x:latest drevops/vortex-dev-mariadb-drupal-data-demo-destination-11.x:vortex-dev-database-ii
415- docker push drevops/vortex-dev-mariadb-drupal-data-demo-destination-11.x:vortex-dev-database-ii
286+ # Refresh only the test container image at :latest.
287+ php .vortex/tests/update-test-assets test-image
416288
417- docker tag drevops/vortex-dev-mariadb-drupal-data-demo-11.x:latest drevops/vortex-dev-mariadb-drupal-data-demo-destination-11.x:vortex-dev-didi-database-fi
418- docker push drevops/vortex-dev-mariadb-drupal-data-demo-destination-11.x: vortex-dev-didi-database-fi
289+ # Refresh only the test container image at :rc1.
290+ php . vortex/tests/update-test-assets test-image --tag rc1
419291```
420-
421- </details >
0 commit comments