From 9c58c2272593b9da3e99924ce8ffcb1913a39a8e Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 30 Apr 2024 10:40:40 +1000 Subject: [PATCH] [#1293] Simplified `DREVOPS_DB_DOCKER_IMAGE` to `DREVOPS_DB_IMAGE`. (#1295) --- .ahoy.yml | 4 +- .circleci/config.yml | 24 +++++------ .env | 10 ++--- .../.utils/variables/extra/.env.variables.sh | 6 +-- .../docs/content/workflows/variables.mdx | 42 +++++++++---------- .scaffold/tests/bats/_helper.bash | 2 +- .scaffold/tests/bats/docker-compose.bats | 2 +- .scaffold/tests/bats/install.initial.bats | 8 ++-- .../tests/bats/workflow.storage.curl.bats | 8 ++-- .../tests/bats/workflow.storage.image.bats | 10 ++--- .../bats/workflow.storage.image_cached.bats | 24 +++++------ docker-compose.yml | 2 +- .../drevops/download-db-docker-registry.sh | 26 ++++++------ scripts/drevops/download-db.sh | 2 +- scripts/drevops/export-db.sh | 8 ++-- scripts/drevops/info.sh | 4 +- scripts/drevops/provision.sh | 4 +- 17 files changed, 93 insertions(+), 93 deletions(-) diff --git a/.ahoy.yml b/.ahoy.yml index 05f3b09a6..0824a6dbf 100644 --- a/.ahoy.yml +++ b/.ahoy.yml @@ -144,12 +144,12 @@ commands: cmd: ahoy cli ./scripts/drevops/provision.sh export-db: - usage: Export database dump or database image (if DREVOPS_DB_DOCKER_IMAGE variable is set). + usage: Export database dump or database image (if DREVOPS_DB_IMAGE variable is set). cmd: ./scripts/drevops/export-db.sh "$@" pull-db: usage: Download database image with the latest nightly dump. Run "ahoy reload-db" to reload DB in the running stack. - cmd: \[ -n "${DREVOPS_DB_DOCKER_IMAGE}" \] && docker pull ${DREVOPS_DB_DOCKER_IMAGE} || true + cmd: \[ -n "${DREVOPS_DB_IMAGE}" \] && docker pull ${DREVOPS_DB_IMAGE} || true reset: usage: "Remove containers, all build files. Use with `hard` to reset repository to the last commit." diff --git a/.circleci/config.yml b/.circleci/config.yml index d36393762..69fc4cc9d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -175,7 +175,7 @@ jobs: docker compose up -d && sleep 15 docker compose exec cli mkdir -p .data && docker compose cp -L .data/db.sql cli:/app/.data/db.sql || true docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c "DREVOPS_PROVISION_POST_OPERATIONS_SKIP=1 ./scripts/drevops/provision.sh" - grep -q ^DREVOPS_DB_DOCKER_IMAGE .env && rm .data/db.sql || true + grep -q ^DREVOPS_DB_IMAGE .env && rm .data/db.sql || true ./scripts/drevops/export-db.sh db.sql no_output_timeout: 30m - save_cache: @@ -196,7 +196,7 @@ jobs: # Enforce fresh DB build (do not rely on fallback caches). DREVOPS_CI_DB_CACHE_FALLBACK: 'no' # Always use fresh base image for the database. - DREVOPS_DB_DOCKER_IMAGE_BASE: drevops/mariadb-drupal-data:24.4.0 + DREVOPS_DB_IMAGE_BASE: drevops/mariadb-drupal-data:24.4.0 # Deploy docker image (if DREVOPS_DB_EXPORT_DOCKER_IMAGE storage is used). DREVOPS_EXPORT_DB_DOCKER_DEPLOY_PROCEED: 1 #;> !PROVISION_USE_PROFILE @@ -409,7 +409,7 @@ jobs: # # Switching between "database in file" (DIF, mounted data volume) and # "database-in-Docker-image" (DIDI, data volume is a part of the image) is - # done by providing the value of DREVOPS_DB_DOCKER_IMAGE environment variable, + # done by providing the value of DREVOPS_DB_IMAGE environment variable, # which would be set in .env file for consumer projects. # # Also, the source of the database can be either file (downloaded from @@ -425,7 +425,7 @@ jobs: # test jobs below and run them as a part of the CI system for Scaffold itself. # # Job to test creation of the image from DB dump file when using - # DREVOPS_DB_DOCKER_IMAGE workflow. + # DREVOPS_DB_IMAGE workflow. scaffold-dev-didi-database-fi: <<: *job-database environment: @@ -434,13 +434,13 @@ jobs: # Use Docker database storage despite that the file is coming # from CURL - this is to make sure that image is exported into cache # to be used between jobs. Note that in consumer project .env file would - # have DREVOPS_DB_DOCKER_IMAGE variable set and this environment variable + # have DREVOPS_DB_IMAGE variable set and this environment variable # would not be required. # # Note that here and below we are using "destination" demo image - this # is to allow updating of this image from CI tests without jeopardizing # main demo image. - DREVOPS_DB_DOCKER_IMAGE: drevops/drevops-mariadb-drupal-data-demo-destination-10.x + DREVOPS_DB_IMAGE: drevops/drevops-mariadb-drupal-data-demo-destination-10.x # Use a separate tag to make sure that pushed image does not affect # other tests (pushing broken image as 'latest' would fail other tests). DREVOPS_DOCKER_IMAGE_TAG: scaffold-dev-didi-database-fi @@ -457,7 +457,7 @@ jobs: environment: DREVOPS_DB_DOWNLOAD_SOURCE: docker_registry DREVOPS_DB_DOWNLOAD_FORCE: 1 - DREVOPS_DB_DOCKER_IMAGE: drevops/drevops-mariadb-drupal-data-demo-destination-10.x + DREVOPS_DB_IMAGE: drevops/drevops-mariadb-drupal-data-demo-destination-10.x DREVOPS_DOCKER_IMAGE_TAG: scaffold-dev-database-ii # Also, use this job to test pushing of the DB image to the Docker # registry so replicate what database-nightly job would do. @@ -466,20 +466,20 @@ jobs: # the main workflow are separated from this one. DREVOPS_CI_DB_CACHE_BRANCH: scaffold-dev-didi-ii # Job to test build of the image from the previous stage of the image when - # using database-in-Docker-image workflow. Overwriting just the DREVOPS_DB_DOCKER_IMAGE + # using database-in-Docker-image workflow. Overwriting just the DREVOPS_DB_IMAGE # variable should change the storage mechanisms, but preserve application-level # stack operation. scaffold-dev-didi-build-fi: <<: *job_build environment: - DREVOPS_DB_DOCKER_IMAGE: drevops/drevops-mariadb-drupal-data-demo-destination-10.x:drevops_dev_didi_database_fi + DREVOPS_DB_IMAGE: drevops/drevops-mariadb-drupal-data-demo-destination-10.x:drevops_dev_didi_database_fi # Use custom cache key for this workflow to make sure that caches from # the main workflow are separated from this one. DREVOPS_CI_DB_CACHE_BRANCH: scaffold-dev-didi-fi scaffold-dev-didi-build-ii: <<: *job_build environment: - DREVOPS_DB_DOCKER_IMAGE: drevops/drevops-mariadb-drupal-data-demo-destination-10.x:drevops_dev_database_ii + DREVOPS_DB_IMAGE: drevops/drevops-mariadb-drupal-data-demo-destination-10.x:drevops_dev_database_ii # Use custom cache key for this workflow to make sure that caches from # the main workflow are separated from this one. DREVOPS_CI_DB_CACHE_BRANCH: scaffold-dev-didi-ii @@ -555,7 +555,7 @@ workflows: tags: only: /.*/ - # Test workflow to test DREVOPS_DB_DOCKER_IMAGE workflow for DB from file. + # Test workflow to test DREVOPS_DB_IMAGE workflow for DB from file. scaffold-dev-didi-fi: jobs: - scaffold-dev-didi-database-fi @@ -563,7 +563,7 @@ workflows: requires: - scaffold-dev-didi-database-fi - # Test workflow to test DREVOPS_DB_DOCKER_IMAGE workflow for DB from docker registry. + # Test workflow to test DREVOPS_DB_IMAGE workflow for DB from docker registry. scaffold-dev-didi-ii: jobs: - scaffold-dev-database-ii diff --git a/.env b/.env index c957e710e..a08257018 100644 --- a/.env +++ b/.env @@ -121,7 +121,7 @@ DREVOPS_DB_FILE=db.sql # Name of the pre-built Docker image. # Uncomment to use an image with a DB data loaded into it. # @see https://github.com/drevops/mariadb-drupal-data to seed your DB image. -# DREVOPS_DB_DOCKER_IMAGE=your_org/your_site:latest +# DREVOPS_DB_IMAGE=your_org/your_site:latest #;< !PROVISION_USE_PROFILE # Database can be sourced from one of the following locations: @@ -134,7 +134,7 @@ DREVOPS_DB_FILE=db.sql # - `none` - not downloaded, site is freshly installed for every build. # Note that "docker_registry" works only for database-in-Docker-image -# database storage (when $DREVOPS_DB_DOCKER_IMAGE variable has a value). +# database storage (when $DREVOPS_DB_IMAGE variable has a value). DREVOPS_DB_DOWNLOAD_SOURCE=curl #;< DREVOPS_DB_DOWNLOAD_SOURCE_CURL @@ -241,12 +241,12 @@ DREVOPS_NOTIFY_EMAIL_RECIPIENTS="webmaster@your-site-url.example" DREVOPS_DB_DOWNLOAD_CURL_URL=https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql #;> DREVOPS_DB_DOWNLOAD_SOURCE_CURL -#;< DREVOPS_DB_DOCKER_IMAGE +#;< DREVOPS_DB_IMAGE # The name of the demo database image used for demonstration only for # database-in-Docker-image data storage. #; The line below will be automatically uncommented for database-in-Docker-image #; storage. It is commented out to allow running non-database-in-Docker-image # workflow by default. -##### DREVOPS_DB_DOCKER_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest -#;> DREVOPS_DB_DOCKER_IMAGE +##### DREVOPS_DB_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest +#;> DREVOPS_DB_IMAGE #;> DEMO diff --git a/.scaffold/docs/.utils/variables/extra/.env.variables.sh b/.scaffold/docs/.utils/variables/extra/.env.variables.sh index d3c3e49f2..c90e5082b 100755 --- a/.scaffold/docs/.utils/variables/extra/.env.variables.sh +++ b/.scaffold/docs/.utils/variables/extra/.env.variables.sh @@ -7,13 +7,13 @@ # Name of the database docker image to use. # # See https://github.com/drevops/mariadb-drupal-data to seed your DB image. -DREVOPS_DB_DOCKER_IMAGE= +DREVOPS_DB_IMAGE= # Name of the database fall-back docker image to use. # -# If the image specified in $DREVOPS_DB_DOCKER_IMAGE does not exist and base +# If the image specified in $DREVOPS_DB_IMAGE does not exist and base # image was provided - it will be used as a "clean slate" for the database. -DREVOPS_DB_DOCKER_IMAGE_BASE= +DREVOPS_DB_IMAGE_BASE= # Drupal admin email. May need to be reset if database was sanitized. DRUPAL_ADMIN_EMAIL="webmaster@your-site-url.example" diff --git a/.scaffold/docs/content/workflows/variables.mdx b/.scaffold/docs/content/workflows/variables.mdx index 2095b9e51..4cf359700 100644 --- a/.scaffold/docs/content/workflows/variables.mdx +++ b/.scaffold/docs/content/workflows/variables.mdx @@ -194,26 +194,6 @@ Default value: `./.data` Defined in: `.env`, `scripts/drevops/download-db-acquia.sh`, `scripts/drevops/download-db-curl.sh`, `scripts/drevops/download-db-docker-registry.sh`, `scripts/drevops/download-db-ftp.sh`, `scripts/drevops/download-db-lagoon.sh`, `scripts/drevops/download-db.sh`, `scripts/drevops/provision.sh` -### `DREVOPS_DB_DOCKER_IMAGE` - -Name of the database docker image to use. - -See https://github.com/drevops/mariadb-drupal-data to seed your DB image. - -Default value: `UNDEFINED` - -Defined in: `.env`, `scripts/drevops/download-db-docker-registry.sh`, `scripts/drevops/export-db.sh`, `scripts/drevops/info.sh`, `scripts/drevops/provision.sh` - -### `DREVOPS_DB_DOCKER_IMAGE_BASE` - -Name of the database fall-back docker image to use. - -If the image specified in [`$DREVOPS_DB_DOCKER_IMAGE`](#drevops_db_docker_image) does not exist and base
image was provided - it will be used as a "clean slate" for the database. - -Default value: `UNDEFINED` - -Defined in: `.env`, `scripts/drevops/download-db-docker-registry.sh` - ### `DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME` Acquia database name to download the database from. @@ -354,7 +334,7 @@ Defined in: `scripts/drevops/download-db-lagoon.sh` ### `DREVOPS_DB_DOWNLOAD_SOURCE` -Note that "docker_registry" works only for database-in-Docker-image
database storage (when [`$DREVOPS_DB_DOCKER_IMAGE`](#drevops_db_docker_image) variable has a value). +Note that "docker_registry" works only for database-in-Docker-image
database storage (when [`$DREVOPS_DB_IMAGE`](#drevops_db_image) variable has a value). Default value: `curl` @@ -432,6 +412,26 @@ Default value: `db.sql` Defined in: `.env`, `scripts/drevops/download-db-acquia.sh`, `scripts/drevops/download-db-curl.sh`, `scripts/drevops/download-db-ftp.sh`, `scripts/drevops/download-db-lagoon.sh`, `scripts/drevops/provision.sh` +### `DREVOPS_DB_IMAGE` + +Name of the database docker image to use. + +See https://github.com/drevops/mariadb-drupal-data to seed your DB image. + +Default value: `UNDEFINED` + +Defined in: `.env`, `scripts/drevops/download-db-docker-registry.sh`, `scripts/drevops/export-db.sh`, `scripts/drevops/info.sh`, `scripts/drevops/provision.sh` + +### `DREVOPS_DB_IMAGE_BASE` + +Name of the database fall-back docker image to use. + +If the image specified in [`$DREVOPS_DB_IMAGE`](#drevops_db_image) does not exist and base
image was provided - it will be used as a "clean slate" for the database. + +Default value: `UNDEFINED` + +Defined in: `.env`, `scripts/drevops/download-db-docker-registry.sh` + ### `DREVOPS_DEBUG` Set to `1` to print debug information in DrevOps scripts. diff --git a/.scaffold/tests/bats/_helper.bash b/.scaffold/tests/bats/_helper.bash index 56cde1699..822be2e39 100644 --- a/.scaffold/tests/bats/_helper.bash +++ b/.scaffold/tests/bats/_helper.bash @@ -119,7 +119,7 @@ setup() { # Isolate variables set in CI. unset DREVOPS_DB_DOWNLOAD_SOURCE - unset DREVOPS_DB_DOCKER_IMAGE + unset DREVOPS_DB_IMAGE unset DREVOPS_DB_DOWNLOAD_FORCE # Tokens required for tests are set explicitly within each tests with a TEST_ prefix. unset GITHUB_TOKEN diff --git a/.scaffold/tests/bats/docker-compose.bats b/.scaffold/tests/bats/docker-compose.bats index 6318ea384..4d8bf61fd 100644 --- a/.scaffold/tests/bats/docker-compose.bats +++ b/.scaffold/tests/bats/docker-compose.bats @@ -51,7 +51,7 @@ load _helper.bash echo "COMPOSE_PROJECT_NAME=the_matrix" >>.env echo "DREVOPS_WEBROOT=docroot" >>.env - echo "DREVOPS_DB_DOCKER_IMAGE=myorg/my_db_image" >>.env + echo "DREVOPS_DB_IMAGE=myorg/my_db_image" >>.env echo "XDEBUG_ENABLE=1" >>.env echo "SSMTP_MAILHUB=false" >>.env echo "DRUPAL_SHIELD_USER=jane" >>.env diff --git a/.scaffold/tests/bats/install.initial.bats b/.scaffold/tests/bats/install.initial.bats index bbc2fffe5..3dfc86076 100644 --- a/.scaffold/tests/bats/install.initial.bats +++ b/.scaffold/tests/bats/install.initial.bats @@ -221,24 +221,24 @@ load _helper.bash @test "Install into empty directory; db from curl; storage is Docker image" { export DREVOPS_DB_DOWNLOAD_SOURCE=curl - export DREVOPS_DB_DOCKER_IMAGE="drevops/drevops-mariadb-drupal-data-demo-10.x:latest" + export DREVOPS_DB_IMAGE="drevops/drevops-mariadb-drupal-data-demo-10.x:latest" run_installer_quiet assert_file_contains ".env" "DREVOPS_DB_DOWNLOAD_SOURCE=curl" assert_file_contains ".env" "DREVOPS_DB_DOWNLOAD_CURL_URL=" - assert_file_contains ".env" "DREVOPS_DB_DOCKER_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" + assert_file_contains ".env" "DREVOPS_DB_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" } @test "Install into empty directory; db from Docker image; storage is Docker image" { export DREVOPS_DB_DOWNLOAD_SOURCE=docker_registry - export DREVOPS_DB_DOCKER_IMAGE="drevops/drevops-mariadb-drupal-data-demo-10.x:latest" + export DREVOPS_DB_IMAGE="drevops/drevops-mariadb-drupal-data-demo-10.x:latest" run_installer_quiet assert_file_contains ".env" "DREVOPS_DB_DOWNLOAD_SOURCE=docker_registry" assert_file_not_contains ".env" "DREVOPS_DB_DOWNLOAD_CURL_URL=" - assert_file_contains ".env" "DREVOPS_DB_DOCKER_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" + assert_file_contains ".env" "DREVOPS_DB_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" } @test "Install into empty directory; DrevOps scripts are not modified" { diff --git a/.scaffold/tests/bats/workflow.storage.curl.bats b/.scaffold/tests/bats/workflow.storage.curl.bats index b37531b18..9a71058d3 100644 --- a/.scaffold/tests/bats/workflow.storage.curl.bats +++ b/.scaffold/tests/bats/workflow.storage.curl.bats @@ -27,7 +27,7 @@ load _helper.workflow.bash # @todo: build.sh may need to have a support to create a local image if # it does not exist. # Use a test image. Image always must use a tag. - export DREVOPS_DB_DOCKER_IMAGE="drevops/drevops-mariadb-drupal-data-test-10.x:latest" + export DREVOPS_DB_IMAGE="drevops/drevops-mariadb-drupal-data-test-10.x:latest" # Explicitly specify that we do not want to login into the public registry # to use test image. @@ -42,15 +42,15 @@ load _helper.workflow.bash assert_file_not_exists .data/db.sql substep "Remove any existing images to download the fresh one." - docker_remove_image "${DREVOPS_DB_DOCKER_IMAGE}" + docker_remove_image "${DREVOPS_DB_IMAGE}" prepare_sut "Starting download from curl, storage in Docker image cached WORKFLOW tests in build directory ${BUILD_DIR}" assert_file_exists .data/db.sql assert_file_contains ".env" "DREVOPS_DB_DOWNLOAD_SOURCE=curl" - assert_file_contains ".env" "DREVOPS_DB_DOCKER_IMAGE=${DREVOPS_DB_DOCKER_IMAGE}" + assert_file_contains ".env" "DREVOPS_DB_IMAGE=${DREVOPS_DB_IMAGE}" # Assert that demo config was removed as a part of the installation. - assert_file_not_contains ".env" "DREVOPS_DB_DOCKER_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" + assert_file_not_contains ".env" "DREVOPS_DB_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" assert_file_contains ".env" "DREVOPS_DB_DOWNLOAD_CURL_URL=" assert_ahoy_build diff --git a/.scaffold/tests/bats/workflow.storage.image.bats b/.scaffold/tests/bats/workflow.storage.image.bats index 0486a609b..c3f3a247d 100644 --- a/.scaffold/tests/bats/workflow.storage.image.bats +++ b/.scaffold/tests/bats/workflow.storage.image.bats @@ -23,7 +23,7 @@ load _helper.workflow.bash export DREVOPS_DB_DOWNLOAD_SOURCE=docker_registry # Use a test image. Image always must use a tag. - export DREVOPS_DB_DOCKER_IMAGE="drevops/drevops-mariadb-drupal-data-test-10.x:latest" + export DREVOPS_DB_IMAGE="drevops/drevops-mariadb-drupal-data-test-10.x:latest" # Do not use demo database - testing demo database discovery is another test. export DREVOPS_INSTALL_DEMO_SKIP=1 @@ -38,7 +38,7 @@ load _helper.workflow.bash assert_file_not_exists .data/db.sql substep "Remove any existing images to download the fresh one." - docker_remove_image "${DREVOPS_DB_DOCKER_IMAGE}" + docker_remove_image "${DREVOPS_DB_IMAGE}" prepare_sut "Starting download from image, storage in docker image WORKFLOW tests in build directory ${BUILD_DIR}" @@ -48,9 +48,9 @@ load _helper.workflow.bash rm .env.local >/dev/null assert_file_contains ".env" "DREVOPS_DB_DOWNLOAD_SOURCE=docker_registry" - assert_file_contains ".env" "DREVOPS_DB_DOCKER_IMAGE=${DREVOPS_DB_DOCKER_IMAGE}" + assert_file_contains ".env" "DREVOPS_DB_IMAGE=${DREVOPS_DB_IMAGE}" # Assert that demo config was removed as a part of the installation. - assert_file_not_contains ".env" "DREVOPS_DB_DOCKER_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" + assert_file_not_contains ".env" "DREVOPS_DB_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" assert_file_not_contains ".env" "DREVOPS_DB_DOWNLOAD_CURL_URL=" assert_ahoy_build @@ -71,7 +71,7 @@ load _helper.workflow.bash # Other stack assertions - these run only for this Docker image-related test. assert_gitignore - assert_ahoy_info "web" "${DREVOPS_DB_DOCKER_IMAGE}" + assert_ahoy_info "web" "${DREVOPS_DB_IMAGE}" assert_ahoy_docker_logs diff --git a/.scaffold/tests/bats/workflow.storage.image_cached.bats b/.scaffold/tests/bats/workflow.storage.image_cached.bats index 653c98177..908aefbba 100644 --- a/.scaffold/tests/bats/workflow.storage.image_cached.bats +++ b/.scaffold/tests/bats/workflow.storage.image_cached.bats @@ -25,7 +25,7 @@ load _helper.workflow.bash export DREVOPS_DB_DOWNLOAD_SOURCE=docker_registry # Use a test image. Image always must use a tag. - export DREVOPS_DB_DOCKER_IMAGE="drevops/drevops-mariadb-drupal-data-test-10.x:latest" + export DREVOPS_DB_IMAGE="drevops/drevops-mariadb-drupal-data-test-10.x:latest" # Do not use demo database - testing demo database discovery is another test. export DREVOPS_INSTALL_DEMO_SKIP=1 @@ -40,7 +40,7 @@ load _helper.workflow.bash assert_file_not_exists .data/db.sql substep "Remove any existing images to download the fresh one." - docker_remove_image "${DREVOPS_DB_DOCKER_IMAGE}" + docker_remove_image "${DREVOPS_DB_IMAGE}" prepare_sut "Starting download from image, storage in Docker image, use cached image WORKFLOW tests in build directory ${BUILD_DIR}" @@ -50,15 +50,15 @@ load _helper.workflow.bash rm .env.local >/dev/null assert_file_contains ".env" "DREVOPS_DB_DOWNLOAD_SOURCE=docker_registry" - assert_file_contains ".env" "DREVOPS_DB_DOCKER_IMAGE=${DREVOPS_DB_DOCKER_IMAGE}" + assert_file_contains ".env" "DREVOPS_DB_IMAGE=${DREVOPS_DB_IMAGE}" # Assert that demo config was removed as a part of the installation. - assert_file_not_contains ".env" "DREVOPS_DB_DOCKER_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" + assert_file_not_contains ".env" "DREVOPS_DB_IMAGE=drevops/drevops-mariadb-drupal-data-demo-10.x:latest" assert_file_not_contains ".env" "DREVOPS_DB_DOWNLOAD_CURL_URL=" step "Initial build to use data image." assert_ahoy_build - assert_output_contains "Using Docker data image ${DREVOPS_DB_DOCKER_IMAGE}" - assert_output_contains "Not found ${DREVOPS_DB_DOCKER_IMAGE}" + assert_output_contains "Using Docker data image ${DREVOPS_DB_IMAGE}" + assert_output_contains "Not found ${DREVOPS_DB_IMAGE}" assert_output_contains "Not found archived database Docker image file ./.data/db.tar." assert_output_contains "Finished building project" @@ -82,7 +82,7 @@ load _helper.workflow.bash run ahoy export-db "db.tar" assert_success assert_output_contains "Found mariadb service container with id" - assert_output_contains "Committing exported Docker image with name docker.io/${DREVOPS_DB_DOCKER_IMAGE}" + assert_output_contains "Committing exported Docker image with name docker.io/${DREVOPS_DB_IMAGE}" assert_output_contains "Committed exported Docker image with id" assert_output_contains "Exporting database image archive to file ./.data/db.tar." assert_output_contains "Saved exported database image archive file ./.data/db.tar." @@ -90,16 +90,16 @@ load _helper.workflow.bash substep "Remove existing image and assert that exported DB image file still exists." ahoy clean - docker_remove_image "${DREVOPS_DB_DOCKER_IMAGE}" + docker_remove_image "${DREVOPS_DB_IMAGE}" assert_file_exists .data/db.tar step "Re-run build to use previously exported DB image from file." assert_ahoy_build - assert_output_contains "Using Docker data image ${DREVOPS_DB_DOCKER_IMAGE}" - assert_output_contains "Not found ${DREVOPS_DB_DOCKER_IMAGE}" + assert_output_contains "Using Docker data image ${DREVOPS_DB_IMAGE}" + assert_output_contains "Not found ${DREVOPS_DB_IMAGE}" assert_output_contains "Found archived database Docker image file ./.data/db.tar. Expanding" - assert_output_contains "Loaded image: ${DREVOPS_DB_DOCKER_IMAGE}" - assert_output_contains "Found expanded ${DREVOPS_DB_DOCKER_IMAGE}" + assert_output_contains "Loaded image: ${DREVOPS_DB_IMAGE}" + assert_output_contains "Found expanded ${DREVOPS_DB_IMAGE}" assert_output_contains "Finished building project" diff --git a/docker-compose.yml b/docker-compose.yml index 328a8d88e..044da80ab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -150,7 +150,7 @@ services: context: . dockerfile: .docker/mariadb.dockerfile args: - IMAGE: "${DREVOPS_DB_DOCKER_IMAGE:-uselagoon/mariadb-drupal:24.4.0}" # Use custom database image (if defined) or fallback to standard database image. + IMAGE: "${DREVOPS_DB_IMAGE:-uselagoon/mariadb-drupal:24.4.0}" # Use custom database image (if defined) or fallback to standard database image. <<: *default-user environment: <<: *default-environment diff --git a/scripts/drevops/download-db-docker-registry.sh b/scripts/drevops/download-db-docker-registry.sh index e4e7d7f8c..32f02646e 100755 --- a/scripts/drevops/download-db-docker-registry.sh +++ b/scripts/drevops/download-db-docker-registry.sh @@ -12,7 +12,7 @@ set -eu [ "${DREVOPS_DEBUG-}" = "1" ] && set -x # The Docker image containing database passed in a form of `/`. -DREVOPS_DB_DOCKER_IMAGE="${DREVOPS_DB_DOCKER_IMAGE:-}" +DREVOPS_DB_IMAGE="${DREVOPS_DB_IMAGE:-}" # The username of the docker registry to download the database from. DOCKER_USER="${DOCKER_USER:-}" @@ -43,11 +43,11 @@ info "Started Docker data image download." [ -z "${DOCKER_USER}" ] && fail "Missing required value for DOCKER_USER." && exit 1 [ -z "${DOCKER_PASS}" ] && fail "Missing required value for DOCKER_PASS." && exit 1 -[ -z "${DREVOPS_DB_DOCKER_IMAGE}" ] && fail "Destination image name is not specified. Please provide docker image name as a first argument to this script in a format /." && exit 1 +[ -z "${DREVOPS_DB_IMAGE}" ] && fail "Destination image name is not specified. Please provide docker image name as a first argument to this script in a format /." && exit 1 -docker image inspect "${DREVOPS_DB_DOCKER_IMAGE}" >/dev/null 2>&1 && - note "Found ${DREVOPS_DB_DOCKER_IMAGE} image on host." || - note "Not found ${DREVOPS_DB_DOCKER_IMAGE} image on host." +docker image inspect "${DREVOPS_DB_IMAGE}" >/dev/null 2>&1 && + note "Found ${DREVOPS_DB_IMAGE} image on host." || + note "Not found ${DREVOPS_DB_IMAGE} image on host." image_expanded_successfully=0 if [ -f "${DREVOPS_DB_DIR}/db.tar" ]; then @@ -57,30 +57,30 @@ if [ -f "${DREVOPS_DB_DIR}/db.tar" ]; then # Check that image was expanded and now exists on the host or notify # that it will be downloaded from the registry. - if docker image inspect "${DREVOPS_DB_DOCKER_IMAGE}" >/dev/null 2>&1; then - note "Found expanded ${DREVOPS_DB_DOCKER_IMAGE} image on host." + if docker image inspect "${DREVOPS_DB_IMAGE}" >/dev/null 2>&1; then + note "Found expanded ${DREVOPS_DB_IMAGE} image on host." image_expanded_successfully=1 else - note "Not found expanded ${DREVOPS_DB_DOCKER_IMAGE} image on host." + note "Not found expanded ${DREVOPS_DB_IMAGE} image on host." fi fi -if [ ! -f "${DREVOPS_DB_DIR}/db.tar" ] && [ -n "${DREVOPS_DB_DOCKER_IMAGE_BASE:-}" ]; then +if [ ! -f "${DREVOPS_DB_DIR}/db.tar" ] && [ -n "${DREVOPS_DB_IMAGE_BASE:-}" ]; then # If the image archive does not exist and base image was provided - use the # base image which allows "clean slate" for the database. - note "Database Docker image was not found. Using base image ${DREVOPS_DB_DOCKER_IMAGE_BASE}." - export DREVOPS_DB_DOCKER_IMAGE="${DREVOPS_DB_DOCKER_IMAGE_BASE}" + note "Database Docker image was not found. Using base image ${DREVOPS_DB_IMAGE_BASE}." + export DREVOPS_DB_IMAGE="${DREVOPS_DB_IMAGE_BASE}" fi if [ "${image_expanded_successfully}" -eq 0 ]; then - note "Downloading ${DREVOPS_DB_DOCKER_IMAGE} image from the registry." + note "Downloading ${DREVOPS_DB_IMAGE} image from the registry." export DOCKER_USER="${DOCKER_USER}" export DOCKER_PASS="${DOCKER_PASS}" export DOCKER_REGISTRY="${DOCKER_REGISTRY}" ./scripts/drevops/login-docker.sh - docker pull "${DOCKER_REGISTRY}/${DREVOPS_DB_DOCKER_IMAGE}" + docker pull "${DOCKER_REGISTRY}/${DREVOPS_DB_IMAGE}" fi pass "Finished Docker data image download." diff --git a/scripts/drevops/download-db.sh b/scripts/drevops/download-db.sh index d3bb2f145..9d49c7e7b 100755 --- a/scripts/drevops/download-db.sh +++ b/scripts/drevops/download-db.sh @@ -14,7 +14,7 @@ set -eu [ "${DREVOPS_DEBUG-}" = "1" ] && set -x # Note that `docker_registry` works only for database-in-Docker-image -# database storage (when $DREVOPS_DB_DOCKER_IMAGE variable has a value). +# database storage (when $DREVOPS_DB_IMAGE variable has a value). DREVOPS_DB_DOWNLOAD_SOURCE="${DREVOPS_DB_DOWNLOAD_SOURCE:-curl}" # Force DB download even if the cache exists. diff --git a/scripts/drevops/export-db.sh b/scripts/drevops/export-db.sh index 417182e0a..fba291a0b 100755 --- a/scripts/drevops/export-db.sh +++ b/scripts/drevops/export-db.sh @@ -14,7 +14,7 @@ set -eu # Name of the database docker image to use. Uncomment to use an image with # a DB data loaded into it. # @see https://github.com/drevops/mariadb-drupal-data to seed your DB image. -DREVOPS_DB_DOCKER_IMAGE="${DREVOPS_DB_DOCKER_IMAGE:-}" +DREVOPS_DB_IMAGE="${DREVOPS_DB_IMAGE:-}" # ------------------------------------------------------------------------------ @@ -33,17 +33,17 @@ for cmd in docker; do command -v ${cmd} >/dev/null || { info "Started database export." -if [ -z "${DREVOPS_DB_DOCKER_IMAGE}" ]; then +if [ -z "${DREVOPS_DB_IMAGE}" ]; then # Export database as a file. docker compose exec -T cli ./scripts/drevops/export-db-file.sh "$@" else # Export database as a Docker image. - DREVOPS_DB_EXPORT_DOCKER_IMAGE="${DREVOPS_DB_DOCKER_IMAGE}" ./scripts/drevops/export-db-docker.sh "$@" + DREVOPS_DB_EXPORT_DOCKER_IMAGE="${DREVOPS_DB_IMAGE}" ./scripts/drevops/export-db-docker.sh "$@" # Deploy docker image. # @todo Move deployment into a separate script. if [ "${DREVOPS_EXPORT_DB_DOCKER_DEPLOY_PROCEED:-}" = "1" ]; then - DREVOPS_DEPLOY_DOCKER_MAP=mariadb=${DREVOPS_DB_DOCKER_IMAGE} \ + DREVOPS_DEPLOY_DOCKER_MAP=mariadb=${DREVOPS_DB_IMAGE} \ ./scripts/drevops/deploy-docker.sh fi fi diff --git a/scripts/drevops/info.sh b/scripts/drevops/info.sh index e62db2b18..09d8795a6 100755 --- a/scripts/drevops/info.sh +++ b/scripts/drevops/info.sh @@ -38,8 +38,8 @@ note "DB username : ${MARIADB_USERNAME}" note "DB password : ${MARIADB_PASSWORD}" note "DB port : ${MARIADB_PORT}" note "DB port on host : ${DREVOPS_HOST_DB_PORT} ${sequelace}" -if [ -n "${DREVOPS_DB_DOCKER_IMAGE:-}" ]; then - note "DB-in-docker image : ${DREVOPS_DB_DOCKER_IMAGE}" +if [ -n "${DREVOPS_DB_IMAGE:-}" ]; then + note "DB-in-docker image : ${DREVOPS_DB_IMAGE}" fi if [ -n "${DREVOPS_HOST_SOLR_PORT:-}" ]; then note "Solr URL on host : http://127.0.0.1:${DREVOPS_HOST_SOLR_PORT}" diff --git a/scripts/drevops/provision.sh b/scripts/drevops/provision.sh index 5e0a0ae11..f4012a11e 100755 --- a/scripts/drevops/provision.sh +++ b/scripts/drevops/provision.sh @@ -95,8 +95,8 @@ note "Profile : ${DRUPAL_PROFILE}" note "Private files directory : ${DREVOPS_DRUPAL_PRIVATE_FILES}" note "Config path : ${DREVOPS_DRUPAL_CONFIG_PATH}" note "DB dump file path : ${DREVOPS_DB_DIR}/${DREVOPS_DB_FILE} ($([ -f "${DREVOPS_DB_DIR}/${DREVOPS_DB_FILE}" ] && echo "present" || echo "absent"))" -if [ -n "${DREVOPS_DB_DOCKER_IMAGE:-}" ]; then - note "DB dump Docker image : ${DREVOPS_DB_DOCKER_IMAGE}" +if [ -n "${DREVOPS_DB_IMAGE:-}" ]; then + note "DB dump Docker image : ${DREVOPS_DB_IMAGE}" fi echo note "Drush version : ${drush_version}"