diff --git a/.ahoy.yml b/.ahoy.yml index 271a13373..ddf4d96c6 100644 --- a/.ahoy.yml +++ b/.ahoy.yml @@ -144,12 +144,7 @@ commands: provision: usage: Provision a site from the database dump or profile. - cmd: | - if [ -f .data/db.sql ]; then - docker compose exec cli mkdir -p .data - docker compose cp -L .data/db.sql cli:/app/.data/db.sql - fi - ahoy cli ./scripts/drevops/provision.sh + cmd: ahoy cli ./scripts/drevops/provision.sh export-db: usage: Export database dump or database image (if DREVOPS_DB_DOCKER_IMAGE variable is set). diff --git a/.circleci/config.yml b/.circleci/config.yml index db2d1b433..70a647aba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,7 +54,7 @@ aliases: # This container has all the necessary tools to run a dockerized environment. # @see https://github.com/drevops/ci-runner # @see https://hub.docker.com/repository/docker/drevops/ci-runner/tags?page=1&ordering=last_updated - - image: drevops/ci-runner:24.3.0 + - image: drevops/ci-runner:24.4.0 auth: username: ${DOCKER_USER} password: ${DOCKER_PASS} @@ -171,8 +171,8 @@ jobs: name: Export DB after download command: | [ ! -f /tmp/download-db-success ] && echo "==> Database download semaphore file is missing. DB export will not proceed." && exit 0 - docker compose up -d - sleep 15 + ./scripts/drevops/login-docker.sh + 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 @@ -227,6 +227,9 @@ jobs: - v1.19.0-db10-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-{{ checksum "/tmp/db_cache_timestamp" }} - v1.19.0-db10-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}- #;> !PROVISION_USE_PROFILE + - run: + name: Login to Docker registry + command: ./scripts/drevops/login-docker.sh - run: name: Build stack command: docker compose up -d @@ -292,8 +295,7 @@ jobs: - run: name: Process test logs and artifacts command: | - mkdir -p "${DREVOPS_CI_TEST_RESULTS}" - mkdir -p "${DREVOPS_CI_ARTIFACTS}" + mkdir -p "${DREVOPS_CI_TEST_RESULTS}" "${DREVOPS_CI_ARTIFACTS}" if docker compose ps --services --filter "status=running" | grep -q cli && docker compose exec cli test -d /app/.logs; then docker compose cp cli:/app/.logs/. "${DREVOPS_CI_ARTIFACTS}/" if docker compose exec -T cli sh -c '[ -d /app/.logs/test_results/ ]'; then @@ -307,7 +309,7 @@ jobs: path: *artifacts - run: name: Upload code coverage reports to Codecov - command: if [ -d /tmp/artifacts/coverage ]; then codecov -Z -s /tmp/artifacts/coverage; fi + command: if [ -n "${CODECOV_TOKEN}" ] && [ -d /tmp/artifacts/coverage ]; then codecov -Z -s /tmp/artifacts/coverage; fi - persist_to_workspace: root: /tmp/workspace paths: diff --git a/.gitignore b/.gitignore index 5e95b2da6..57afd5053 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ web/themes/**/node_modules web/themes/**/build .data .logs +.twig-cs-fixer.cache # Ignore local override files. docker-compose.override.yml diff --git a/.lagoon.yml b/.lagoon.yml index 1ea89d989..2a89e1443 100644 --- a/.lagoon.yml +++ b/.lagoon.yml @@ -6,10 +6,10 @@ environment_variables: # Uncomment to login into container registries if using private images. # container-registries: -# dockerhub: -# # Environment variables DOCKER_USER and DOCKER_PASS needs to be set via Lagoon CLI. -# username: DOCKER_USER -# password: DOCKER_PASS +# dockerhub: +# # Environment variables DOCKER_USER and DOCKER_PASS needs to be set via Lagoon CLI. +# username: DOCKER_USER +# password: DOCKER_PASS tasks: post-rollout: diff --git a/.scaffold/docs/docusaurus.config.js b/.scaffold/docs/docusaurus.config.js index e0d0c6221..d9b173a2c 100644 --- a/.scaffold/docs/docusaurus.config.js +++ b/.scaffold/docs/docusaurus.config.js @@ -45,7 +45,7 @@ const config = { path: 'content', // Please change this to your repo. // Remove this to remove the "edit this page" links. - editUrl: 'https://github.com/drevops/scaffold/tree/main/.scaffold/docs/content/', + editUrl: 'https://github.com/drevops/scaffold/tree/develop/.scaffold/docs/', }, blog: false, theme: { diff --git a/.scaffold/tests/bats/_helper.bash b/.scaffold/tests/bats/_helper.bash index a3bc513eb..56cde1699 100644 --- a/.scaffold/tests/bats/_helper.bash +++ b/.scaffold/tests/bats/_helper.bash @@ -1334,3 +1334,31 @@ download_installer() { popd >/dev/null || exit 1 } + +process_ahoyyml() { + [ "${SCAFFOLD_DEV_VOLUMES_MOUNTED}" = "1" ] && return + + # Override the provision command in .ahoy.yml to copy the database file to + # the container for when the volumes are not mounted. + # We are doing this only to replicate developer's workflow and experience + # when they run `ahoy build` locally. + local sed_opts + sed_opts=(-i) && [ "$(uname)" = "Darwin" ] && sed_opts=(-i '') + sed "${sed_opts[@]}" 's|cmd: ahoy cli ./scripts/drevops/provision.sh|cmd: if [ -f .data/db.sql ]; then docker compose exec cli mkdir -p .data; docker compose cp -L .data/db.sql cli:/app/.data/db.sql; fi; ahoy cli \.\/scripts\/drevops\/provision\.sh|g' .ahoy.yml +} + +setup_ssh_key_fixture() { + export HOME="${BUILD_DIR}" + export SSH_KEY_FIXTURE_DIR="${BUILD_DIR}/.ssh" + fixture_prepare_dir "${SSH_KEY_FIXTURE_DIR}" +} + +provision_default_ssh_key() { + ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa" >/dev/null + ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_TEST" >/dev/null +} + +provision_ssh_key_with_suffix() { + local suffix="${1:-TEST}" + ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}" >/dev/null +} diff --git a/.scaffold/tests/bats/_helper.deployment.bash b/.scaffold/tests/bats/_helper.deployment.bash index 9e725e0c5..5634123c2 100644 --- a/.scaffold/tests/bats/_helper.deployment.bash +++ b/.scaffold/tests/bats/_helper.deployment.bash @@ -140,6 +140,7 @@ install_and_build_site() { export DREVOPS_PROVISION_POST_OPERATIONS_SKIP=1 + process_ahoyyml ahoy build sync_to_host fi @@ -147,13 +148,6 @@ install_and_build_site() { popd >/dev/null || exit 1 } -setup_ssh_key_fixture() { - # Create a fixture directory for ssh keys - export HOME="${BUILD_DIR}" - export SSH_KEY_FIXTURE_DIR="${BUILD_DIR}/.ssh" - fixture_prepare_dir "${SSH_KEY_FIXTURE_DIR}" -} - setup_robo_fixture() { export HOME="${BUILD_DIR}" fixture_prepare_dir "${HOME}/.composer/vendor/bin" @@ -161,18 +155,6 @@ setup_robo_fixture() { chmod +x "${HOME}/.composer/vendor/bin/robo" } -provision_default_ssh_key() { - # Generate fixture keys. - ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa" - # Generate SSH key with TEST suffix. - ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_TEST" -} - -provision_ssh_key_with_suffix() { - local suffix="${1:-TEST}" - ssh-keygen -t rsa -b 4096 -N "" -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}" -} - provision_docker_config_file() { export HOME="${BUILD_DIR}" fixture_prepare_dir "${HOME}/.docker" diff --git a/.scaffold/tests/bats/_helper.workflow.bash b/.scaffold/tests/bats/_helper.workflow.bash index 1d61b197f..8cf28fe1f 100644 --- a/.scaffold/tests/bats/_helper.workflow.bash +++ b/.scaffold/tests/bats/_helper.workflow.bash @@ -99,6 +99,7 @@ assert_ahoy_build() { export DOCKER_USER="${TEST_DOCKER_USER?Test Docker user is not set}" export DOCKER_PASS="${TEST_DOCKER_PASS?Test Docker pass is not set}" + process_ahoyyml run ahoy build run sync_to_host diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env.json b/.scaffold/tests/bats/fixtures/docker-compose.env.json index 6fb2088be..0b8db3844 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env.json @@ -23,41 +23,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -96,41 +66,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -171,41 +111,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -253,41 +163,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -332,41 +212,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -421,41 +271,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -520,41 +340,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env_local.json b/.scaffold/tests/bats/fixtures/docker-compose.env_local.json index 512425b03..0b8db3844 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env_local.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env_local.json @@ -23,49 +23,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DOCKER_PASS": "", - "DOCKER_USER": "", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_ACQUIA_KEY": "", - "DREVOPS_ACQUIA_SECRET": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FORCE": "1", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PASS": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_FTP_USER": "", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "1", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", - "GITHUB_TOKEN": "", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -104,49 +66,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DOCKER_PASS": "", - "DOCKER_USER": "", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_ACQUIA_KEY": "", - "DREVOPS_ACQUIA_SECRET": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FORCE": "1", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PASS": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_FTP_USER": "", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "1", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", - "GITHUB_TOKEN": "", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -187,49 +111,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DOCKER_PASS": "", - "DOCKER_USER": "", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_ACQUIA_KEY": "", - "DREVOPS_ACQUIA_SECRET": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FORCE": "1", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PASS": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_FTP_USER": "", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "1", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", - "GITHUB_TOKEN": "", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -277,49 +163,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DOCKER_PASS": "", - "DOCKER_USER": "", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_ACQUIA_KEY": "", - "DREVOPS_ACQUIA_SECRET": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FORCE": "1", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PASS": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_FTP_USER": "", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "1", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", - "GITHUB_TOKEN": "", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -364,49 +212,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DOCKER_PASS": "", - "DOCKER_USER": "", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_ACQUIA_KEY": "", - "DREVOPS_ACQUIA_SECRET": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FORCE": "1", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PASS": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_FTP_USER": "", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "1", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", - "GITHUB_TOKEN": "", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -461,49 +271,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DOCKER_PASS": "", - "DOCKER_USER": "", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_ACQUIA_KEY": "", - "DREVOPS_ACQUIA_SECRET": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FORCE": "1", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PASS": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_FTP_USER": "", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "1", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", - "GITHUB_TOKEN": "", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -568,49 +340,11 @@ "entrypoint": null, "environment": { "CI": "true", - "DOCKER_PASS": "", - "DOCKER_USER": "", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_ACQUIA_KEY": "", - "DREVOPS_ACQUIA_SECRET": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FORCE": "1", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PASS": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_FTP_USER": "", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "1", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "web", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "0", "DRUPAL_SHIELD_PASS": "", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", - "GITHUB_TOKEN": "", "LAGOON_ENVIRONMENT_TYPE": "local", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json b/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json index 9275f7282..cb393ea30 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json @@ -23,43 +23,11 @@ "entrypoint": null, "environment": { "CI": "true", - "COMPOSE_PROJECT_NAME": "the_matrix", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOCKER_IMAGE": "myorg/my_db_image", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "docroot", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "1", "DRUPAL_SHIELD_PASS": "passw", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "jane", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "development", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -98,43 +66,11 @@ "entrypoint": null, "environment": { "CI": "true", - "COMPOSE_PROJECT_NAME": "the_matrix", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOCKER_IMAGE": "myorg/my_db_image", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "docroot", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "1", "DRUPAL_SHIELD_PASS": "passw", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "jane", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "development", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -175,43 +111,11 @@ "entrypoint": null, "environment": { "CI": "true", - "COMPOSE_PROJECT_NAME": "the_matrix", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOCKER_IMAGE": "myorg/my_db_image", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "docroot", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "1", "DRUPAL_SHIELD_PASS": "passw", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "jane", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "development", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -259,43 +163,11 @@ "entrypoint": null, "environment": { "CI": "true", - "COMPOSE_PROJECT_NAME": "the_matrix", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOCKER_IMAGE": "myorg/my_db_image", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "docroot", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "1", "DRUPAL_SHIELD_PASS": "passw", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "jane", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "development", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -340,43 +212,11 @@ "entrypoint": null, "environment": { "CI": "true", - "COMPOSE_PROJECT_NAME": "the_matrix", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOCKER_IMAGE": "myorg/my_db_image", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "docroot", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "1", "DRUPAL_SHIELD_PASS": "passw", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "jane", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "development", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -431,43 +271,11 @@ "entrypoint": null, "environment": { "CI": "true", - "COMPOSE_PROJECT_NAME": "the_matrix", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOCKER_IMAGE": "myorg/my_db_image", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "docroot", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "1", "DRUPAL_SHIELD_PASS": "passw", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "jane", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "development", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -532,43 +340,11 @@ "entrypoint": null, "environment": { "CI": "true", - "COMPOSE_PROJECT_NAME": "the_matrix", - "DREVOPS_ACQUIA_APP_NAME": "", - "DREVOPS_DB_DIR": "./.data", - "DREVOPS_DB_DOCKER_IMAGE": "myorg/my_db_image", - "DREVOPS_DB_DOWNLOAD_ACQUIA_DB_NAME": "your_site", - "DREVOPS_DB_DOWNLOAD_CURL_URL": "https://github.com/drevops/scaffold/releases/download/1.18.0/db_d10.demo.sql", - "DREVOPS_DB_DOWNLOAD_ENVIRONMENT": "prod", - "DREVOPS_DB_DOWNLOAD_FTP_FILE": "db.sql", - "DREVOPS_DB_DOWNLOAD_FTP_HOST": "", - "DREVOPS_DB_DOWNLOAD_FTP_PORT": "21", - "DREVOPS_DB_DOWNLOAD_SOURCE": "curl", - "DREVOPS_DB_FILE": "db.sql", - "DREVOPS_DEPLOY_TYPES": "artifact", - "DREVOPS_LAGOON_PRODUCTION_BRANCH": "main", "DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io", - "DREVOPS_NOTIFY_CHANNELS": "email", - "DREVOPS_NOTIFY_EMAIL_FROM": "webmaster@your-site-url.example", - "DREVOPS_NOTIFY_EMAIL_RECIPIENTS": "webmaster@your-site-url.example", - "DREVOPS_PROJECT": "your_site", - "DREVOPS_PROVISION_OVERRIDE_DB": "0", - "DREVOPS_PROVISION_SANITIZE_DB_EMAIL": "user_%uid@your-site-url.example", - "DREVOPS_PROVISION_SANITIZE_DB_SKIP": "0", - "DREVOPS_PROVISION_USE_MAINTENANCE_MODE": "1", - "DREVOPS_PROVISION_USE_PROFILE": "0", - "DREVOPS_TZ": "Australia/Melbourne", - "DREVOPS_WEBROOT": "docroot", - "DRUPAL_CLAMAV_ENABLED": "1", - "DRUPAL_CLAMAV_MODE": "daemon", - "DRUPAL_PROFILE": "standard", "DRUPAL_REDIS_ENABLED": "1", "DRUPAL_SHIELD_PASS": "passw", - "DRUPAL_SHIELD_PRINT": "Restricted access.", "DRUPAL_SHIELD_USER": "jane", - "DRUPAL_STAGE_FILE_PROXY_ORIGIN": "https://www.your-site-url.example/", - "DRUPAL_THEME": "your_site_theme", "LAGOON_ENVIRONMENT_TYPE": "development", - "LAGOON_PROJECT": "your_site", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", diff --git a/.scaffold/tests/bats/setup-ssh.bats b/.scaffold/tests/bats/setup-ssh.bats index bbea6d0e6..2a2bfb485 100644 --- a/.scaffold/tests/bats/setup-ssh.bats +++ b/.scaffold/tests/bats/setup-ssh.bats @@ -5,45 +5,66 @@ # shellcheck disable=SC2030,SC2031,SC2129,SC2155 load _helper.bash -load _helper.deployment.bash @test "No DREVOPS_SSH_PREFIX" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + setup_ssh_key_fixture + run scripts/drevops/setup-ssh.sh assert_failure assert_output_contains "Missing the required DREVOPS_SSH_PREFIX environment variable" + popd >/dev/null } -@test "Use default SSH Key, SSH Key missing" { +@test "SSH setup in not required" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + setup_ssh_key_fixture - export DREVOPS_SSH_PREFIX="test" + export DREVOPS_SSH_PREFIX="TEST" + export DREVOPS_TEST_SSH_FILE=false + + run scripts/drevops/setup-ssh.sh + assert_success + assert_output_contains "Found variable DREVOPS_TEST_SSH_FILE with value false." + + popd >/dev/null +} + +@test "Default SSH Key, SSH Key missing" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + setup_ssh_key_fixture + export DREVOPS_SSH_PREFIX="TEST" local file=${HOME}/.ssh/id_rsa + run scripts/drevops/setup-ssh.sh assert_failure - assert_output_contains "Using default SSH file ${file}." + + assert_output_contains "Did not find fingerprint variable DREVOPS_TEST_SSH_FINGERPRINT." + assert_output_contains "Did not find a variable DREVOPS_test_SSH_FILE. Using default value ${file}." assert_output_contains "SSH key file ${file} does not exist." popd >/dev/null } -@test "Use default SSH Key, SSH Key exists" { +@test "Default SSH Key, SSH Key exists" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + setup_ssh_key_fixture provision_default_ssh_key - - export DREVOPS_SSH_PREFIX="test" + export DREVOPS_SSH_PREFIX="TEST" local file=${HOME}/.ssh/id_rsa declare -a STEPS=( - "Using default SSH file ${file}." - "Using SSH key file ${file}." + "Did not find fingerprint variable DREVOPS_TEST_SSH_FINGERPRINT." + "Did not find a variable DREVOPS_TEST_SSH_FILE. Using default value ${file}." "@ssh-add -l # ${file}" "SSH agent has ${file} key loaded." ) mocks="$(run_steps "setup")" + run scripts/drevops/setup-ssh.sh assert_success run_steps "assert" "${mocks[@]}" @@ -76,12 +97,14 @@ load _helper.deployment.bash @test "Use SSH Fingerprint, No matching SSH Key, Cannot load to agent" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + setup_ssh_key_fixture - export DREVOPS_SSH_PREFIX="test" + export DREVOPS_SSH_PREFIX="TEST" export DREVOPS_TEST_SSH_FINGERPRINT="DOES_NOT_EXIST" + run scripts/drevops/setup-ssh.sh assert_failure - assert_output_contains "Found variable DREVOPS_TEST_SSH_FINGERPRINT with value ${DREVOPS_TEST_SSH_FINGERPRINT}." + assert_output_contains "Found fingerprint variable DREVOPS_TEST_SSH_FINGERPRINT with value ${DREVOPS_TEST_SSH_FINGERPRINT}." assert_output_contains "Using fingerprint-based deploy key because fingerprint was provided." assert_output_contains "SSH key file ${HOME}/.ssh/id_rsa_${DREVOPS_TEST_SSH_FINGERPRINT} does not exist." @@ -90,20 +113,23 @@ load _helper.deployment.bash @test "Use SSH Fingerprint, SSH Key provided" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + setup_ssh_key_fixture # Assert using fingerprint with ssh key export DREVOPS_TEST_SSH_FINGERPRINT="TEST" provision_ssh_key_with_suffix ${DREVOPS_TEST_SSH_FINGERPRINT} - export DREVOPS_SSH_PREFIX="test" + export DREVOPS_SSH_PREFIX="TEST" local file="${SSH_KEY_FIXTURE_DIR}/id_rsa_${DREVOPS_TEST_SSH_FINGERPRINT}" + declare -a STEPS=( - "Found variable DREVOPS_TEST_SSH_FINGERPRINT with value ${DREVOPS_TEST_SSH_FINGERPRINT}." + "Found fingerprint variable DREVOPS_TEST_SSH_FINGERPRINT with value ${DREVOPS_TEST_SSH_FINGERPRINT}." "Using fingerprint-based deploy key because fingerprint was provided." "Using SSH key file ${file}." "@ssh-add -l # ${file}" "SSH agent has ${file} key loaded." ) mocks="$(run_steps "setup")" + run scripts/drevops/setup-ssh.sh assert_success run_steps "assert" "${mocks[@]}" @@ -113,6 +139,7 @@ load _helper.deployment.bash @test "Loading SSH key to SSH Agent, Key exists, CI environment" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + setup_ssh_key_fixture # Assert does not have key loaded @@ -121,8 +148,9 @@ load _helper.deployment.bash provision_ssh_key_with_suffix ${DREVOPS_IDENTIFIER_SSH_FINGERPRINT} export CI="1" local file="${SSH_KEY_FIXTURE_DIR}/id_rsa_${DREVOPS_IDENTIFIER_SSH_FINGERPRINT}" + declare -a STEPS=( - "Found variable DREVOPS_${DREVOPS_SSH_PREFIX}_SSH_FINGERPRINT with value ${DREVOPS_IDENTIFIER_SSH_FINGERPRINT}." + "Found fingerprint variable DREVOPS_${DREVOPS_SSH_PREFIX}_SSH_FINGERPRINT with value ${DREVOPS_IDENTIFIER_SSH_FINGERPRINT}." "Using fingerprint-based deploy key because fingerprint was provided." "Using SSH key file ${file}." "@ssh-add -l # The agent has no identities." @@ -135,6 +163,7 @@ load _helper.deployment.bash "Finished SSH setup." ) mocks="$(run_steps "setup")" + run scripts/drevops/setup-ssh.sh assert_success run_steps "assert" "${mocks[@]}" @@ -144,22 +173,26 @@ load _helper.deployment.bash @test "Key provided, MD5 Fingerprint, Key not found" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + setup_ssh_key_fixture local suffix="TEST" provision_ssh_key_with_suffix ${suffix} - export DREVOPS_SSH_PREFIX="test" + export DREVOPS_SSH_PREFIX="TEST" export DREVOPS_TEST_SSH_FINGERPRINT="$(ssh-keygen -l -E md5 -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}" | awk '{print $2}')" export DREVOPS_TEST_SSH_FILE="${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}" + export CI="" local ssh_key_file="${DREVOPS_TEST_SSH_FINGERPRINT//:/}" ssh_key_file="${HOME}/.ssh/id_rsa_${ssh_key_file//\"/}" + declare -a STEPS=( - "Found variable DREVOPS_TEST_SSH_FINGERPRINT with value ${DREVOPS_TEST_SSH_FINGERPRINT}." + "Found fingerprint variable DREVOPS_TEST_SSH_FINGERPRINT with value ${DREVOPS_TEST_SSH_FINGERPRINT}." "Found variable DREVOPS_TEST_SSH_FILE with value ${DREVOPS_TEST_SSH_FILE}." "Using fingerprint-based deploy key because fingerprint was provided." "SSH key file ${ssh_key_file} does not exist." ) mocks="$(run_steps "setup")" + run scripts/drevops/setup-ssh.sh assert_failure run_steps "assert" "${mocks[@]}" @@ -169,19 +202,22 @@ load _helper.deployment.bash @test "Key found, SHA256 fingerprint, Not CI environment" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + setup_ssh_key_fixture local suffix="TEST" provision_ssh_key_with_suffix ${suffix} export DREVOPS_SSH_PREFIX="TEST" export DREVOPS_TEST_SSH_FINGERPRINT="$(ssh-keygen -l -E sha256 -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}" | awk '{print $2}')" + export CI="" local md5_fingerprint="$(ssh-keygen -l -E md5 -f "${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}" | awk '{print $2}')" md5_fingerprint="${md5_fingerprint#MD5:}" local ssh_key_file="${md5_fingerprint//:/}" ssh_key_file="${HOME}/.ssh/id_rsa_${ssh_key_file//\"/}" local file="${SSH_KEY_FIXTURE_DIR}/id_rsa_${suffix}" + declare -a STEPS=( - "Found variable DREVOPS_TEST_SSH_FINGERPRINT with value ${DREVOPS_TEST_SSH_FINGERPRINT}." + "Found fingerprint variable DREVOPS_TEST_SSH_FINGERPRINT with value ${DREVOPS_TEST_SSH_FINGERPRINT}." "Using fingerprint-based deploy key because fingerprint was provided." "Searching for MD5 hash as fingerprint starts with SHA256." "Found matching existing key file ${file}." @@ -189,6 +225,7 @@ load _helper.deployment.bash "- Disabling strict host key checking in CI." ) mocks="$(run_steps "setup")" + run scripts/drevops/setup-ssh.sh assert_failure run_steps "assert" "${mocks[@]}" diff --git a/.scaffold/tests/bats/workflow.smoke.bats b/.scaffold/tests/bats/workflow.smoke.bats index 671d69abc..5fa9a95a1 100644 --- a/.scaffold/tests/bats/workflow.smoke.bats +++ b/.scaffold/tests/bats/workflow.smoke.bats @@ -41,11 +41,13 @@ load _helper.workflow.bash step "Build without a GITHUB_TOKEN token" unset GITHUB_TOKEN + process_ahoyyml run ahoy build assert_failure step "Build with a GITHUB_TOKEN token" export GITHUB_TOKEN="${TEST_GITHUB_TOKEN}" + process_ahoyyml run ahoy build assert_success } @@ -66,10 +68,16 @@ load _helper.workflow.bash docker compose exec -T cli composer install --prefer-dist >&3 substep "Provisioning" - if [ -f .data/db.sql ]; then - docker compose exec cli mkdir -p .data - docker compose cp -L .data/db.sql cli:/app/.data/db.sql + + # Copy DB into container for the cases when the volumes are not mounted. + # This will not be a case locally. + if [ "${SCAFFOLD_DEV_VOLUMES_MOUNTED}" != "1" ]; then + if [ -f .data/db.sql ]; then + docker compose exec cli mkdir -p .data + docker compose cp -L .data/db.sql cli:/app/.data/db.sql + fi fi + docker compose exec -T cli ./scripts/drevops/provision.sh >&3 sync_to_host diff --git a/composer.json b/composer.json index 45bcc8ce6..fb4589aba 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "drevops/behat-screenshot": "^1", "drevops/behat-steps": "^2.2", "drupal/core-dev": "^10.2.0", - "drupal/drupal-extension": "^5@rc", + "drupal/drupal-extension": "^5", "mglaman/phpstan-drupal": "^1.2", "palantirnet/drupal-rector": "^0.20", "phpcompatibility/php-compatibility": "^9.3", @@ -73,7 +73,7 @@ "pyrech/composer-changelogs": true }, "platform": { - "php": "8.2.13" + "php": "8.2.17" } }, "autoload": { diff --git a/docker-compose.override.default.yml b/docker-compose.override.default.yml index acc276ae8..39f5b3bde 100644 --- a/docker-compose.override.default.yml +++ b/docker-compose.override.default.yml @@ -1,3 +1,8 @@ +# Local docker services override. +# +# Copy this file to docker-compose.override.yml and set relevant values. +# docker-compose.override.yml is excluded from the repository, + services: chrome: # Chrome image with Apple M1 support. diff --git a/docker-compose.yml b/docker-compose.yml index 73390944e..2ceae2fd8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,13 +36,6 @@ x-user: &default-user # Change this if you are on linux and run with another user than id `1000` user: '1000' -x-environment-files: &default-environment-files - env_file: - - path: .env - required: false - - path: .env.local - required: false - # Environment variables set in all containers during build and runtime. #;< LAGOON # Note that these variables are not read from here in Lagoon environment. @@ -96,7 +89,7 @@ services: GITHUB_TOKEN: "${GITHUB_TOKEN:-}" image: &cli-image ${COMPOSE_PROJECT_NAME:-example_site} user: root - <<: [*default-volumes, *default-environment-files] + <<: *default-volumes environment: <<: *default-environment # Mount volumes from the ssh-agent running in Pygmy to inject host SSH key into container. See https://pygmy.readthedocs.io/en/master/ssh_agent/ @@ -116,7 +109,7 @@ services: args: CLI_IMAGE: *cli-image WEBROOT: "${DREVOPS_WEBROOT:-web}" - <<: [*default-volumes, *default-user, *default-environment-files] + <<: [*default-volumes, *default-user] environment: <<: *default-environment depends_on: @@ -139,7 +132,7 @@ services: dockerfile: .docker/php.dockerfile args: CLI_IMAGE: *cli-image - <<: [*default-volumes, *default-user, *default-environment-files] + <<: [*default-volumes, *default-user] environment: <<: *default-environment depends_on: @@ -158,7 +151,7 @@ services: dockerfile: .docker/mariadb.dockerfile args: IMAGE: "${DREVOPS_DB_DOCKER_IMAGE:-uselagoon/mariadb-drupal:24.3.1}" # Use custom database image (if defined) or fallback to standard database image. - <<: [*default-user, *default-environment-files] + <<: *default-user environment: <<: *default-environment ports: @@ -184,7 +177,6 @@ services: dockerfile: .docker/solr.dockerfile args: CLI_IMAGE: *cli-image - <<: *default-environment-files environment: <<: *default-environment depends_on: @@ -201,10 +193,9 @@ services: #;< CLAMAV clamav: - image: clamav/clamav:1.3.0 + image: clamav/clamav:1.3.1 ports: - "3310" # Find port on host with `docker-compose port clamav 3310`. - <<: *default-environment-files environment: << : *default-environment networks: @@ -221,7 +212,7 @@ services: chrome: image: selenium/standalone-chrome:111.0 shm_size: '1gb' # Increase '/dev/shm' partition size to avoid browser crashing. - <<: [*default-volumes, *default-environment-files] # Use default volumes to provide access to test fixtures. + <<: *default-volumes # Use default volumes to provide access to test fixtures. environment: <<: *default-environment depends_on: diff --git a/phpcs.xml b/phpcs.xml index 7c643c695..46847d7dc 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -10,6 +10,7 @@ + @@ -17,8 +18,9 @@ + - + circle\.yml diff --git a/rector.php b/rector.php index 0d73b3ce7..3131d3b5f 100644 --- a/rector.php +++ b/rector.php @@ -27,6 +27,7 @@ use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector; use Rector\Set\ValueObject\SetList; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; +use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector; return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ @@ -37,6 +38,7 @@ // Provided by Rector. SetList::PHP_80, SetList::PHP_81, + SetList::PHP_82, SetList::CODE_QUALITY, SetList::CODING_STYLE, SetList::DEAD_CODE, @@ -48,6 +50,8 @@ Drupal10SetList::DRUPAL_10, ]); + $rectorConfig->rule(DeclareStrictTypesRector::class); + $drupalFinder = new DrupalFinder(); $drupalFinder->locateRoot(__DIR__); @@ -78,6 +82,7 @@ '*/modules/contrib/*', '*/themes/contrib/*', '*/profiles/contrib/*', + '*/sites/default/default.settings.php', // Files. '*/sites/default/files/*', '*/sites/simpletest/*', diff --git a/scripts/drevops/deploy-artifact.sh b/scripts/drevops/deploy-artifact.sh index f37f683f7..c3b411a51 100755 --- a/scripts/drevops/deploy-artifact.sh +++ b/scripts/drevops/deploy-artifact.sh @@ -75,7 +75,7 @@ info "Started ARTIFACT deployment." [ "$(git config --global user.name)" = "" ] && note "Configuring global git user name." && git config --global user.name "${DREVOPS_DEPLOY_ARTIFACT_GIT_USER_NAME}" [ "$(git config --global user.email)" = "" ] && note "Configuring global git user email." && git config --global user.email "${DREVOPS_DEPLOY_ARTIFACT_GIT_USER_EMAIL}" -DREVOPS_SSH_PREFIX="DEPLOY" ./scripts/drevops/setup-ssh.sh +export DREVOPS_SSH_PREFIX="DEPLOY" && . ./scripts/drevops/setup-ssh.sh note "Installing artifact builder." composer global require --dev -n --ansi --prefer-source --ignore-platform-reqs drevops/git-artifact:^0.7 diff --git a/scripts/drevops/deploy-docker.sh b/scripts/drevops/deploy-docker.sh index edce19a37..e21e7e8d9 100755 --- a/scripts/drevops/deploy-docker.sh +++ b/scripts/drevops/deploy-docker.sh @@ -39,6 +39,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in docker; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started DOCKER deployment." # Only deploy if the map was provided, but do not fail if it has not as this diff --git a/scripts/drevops/deploy-lagoon.sh b/scripts/drevops/deploy-lagoon.sh index f90c236ce..6b30af187 100755 --- a/scripts/drevops/deploy-lagoon.sh +++ b/scripts/drevops/deploy-lagoon.sh @@ -83,7 +83,7 @@ info "Started LAGOON deployment." [ -z "${LAGOON_PROJECT}" ] && fail "Missing required value for LAGOON_PROJECT." && exit 1 { [ -z "${DREVOPS_DEPLOY_BRANCH}" ] && [ -z "${DREVOPS_DEPLOY_PR}" ]; } && fail "Missing required value for DREVOPS_DEPLOY_BRANCH or DREVOPS_DEPLOY_PR." && exit 1 -DREVOPS_SSH_PREFIX="DEPLOY" ./scripts/drevops/setup-ssh.sh +export DREVOPS_SSH_PREFIX="DEPLOY" && . ./scripts/drevops/setup-ssh.sh if ! command -v lagoon >/dev/null || [ -n "${DREVOPS_LAGOONCLI_FORCE_INSTALL}" ]; then note "Installing Lagoon CLI." @@ -102,6 +102,11 @@ if ! command -v lagoon >/dev/null || [ -n "${DREVOPS_LAGOONCLI_FORCE_INSTALL}" ] export PATH="${PATH}:${DREVOPS_LAGOONCLI_PATH}" fi +for cmd in lagoon curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + note "Configuring Lagoon instance." #shellcheck disable=SC2218 lagoon config add --force -l "${DREVOPS_DEPLOY_LAGOON_INSTANCE}" -g "${DREVOPS_DEPLOY_LAGOON_INSTANCE_GRAPHQL}" -H "${DREVOPS_DEPLOY_LAGOON_INSTANCE_HOSTNAME}" -P "${DREVOPS_DEPLOY_LAGOON_INSTANCE_PORT}" diff --git a/scripts/drevops/deploy-webhook.sh b/scripts/drevops/deploy-webhook.sh index 81283da2c..1104f0b7f 100755 --- a/scripts/drevops/deploy-webhook.sh +++ b/scripts/drevops/deploy-webhook.sh @@ -29,6 +29,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started WEBHOOK deployment." # Check all required values. diff --git a/scripts/drevops/doctor.sh b/scripts/drevops/doctor.sh index 2c9fd9998..40426916b 100755 --- a/scripts/drevops/doctor.sh +++ b/scripts/drevops/doctor.sh @@ -72,6 +72,11 @@ fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 warn() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[33m[WARN] %s\033[0m\n" "${1}" || printf "[WARN] %s\n" "${1}"; } # @formatter:on +for cmd in docker pygmy ahoy; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + # # Main entry point. # diff --git a/scripts/drevops/download-db-acquia.sh b/scripts/drevops/download-db-acquia.sh index 89c7c6def..9469d6cb7 100755 --- a/scripts/drevops/download-db-acquia.sh +++ b/scripts/drevops/download-db-acquia.sh @@ -55,6 +55,11 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +for cmd in php curl gunzip; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started database dump download from Acquia." # diff --git a/scripts/drevops/download-db-curl.sh b/scripts/drevops/download-db-curl.sh index 2d7a68001..94f300ba9 100755 --- a/scripts/drevops/download-db-curl.sh +++ b/scripts/drevops/download-db-curl.sh @@ -30,6 +30,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started database dump download from CURL." # Check all required values. diff --git a/scripts/drevops/download-db-docker-registry.sh b/scripts/drevops/download-db-docker-registry.sh index f3cd13bd6..e4e7d7f8c 100755 --- a/scripts/drevops/download-db-docker-registry.sh +++ b/scripts/drevops/download-db-docker-registry.sh @@ -33,6 +33,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in docker; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started Docker data image download." [ -z "${DOCKER_USER}" ] && fail "Missing required value for DOCKER_USER." && exit 1 diff --git a/scripts/drevops/download-db-ftp.sh b/scripts/drevops/download-db-ftp.sh index b28eed2bd..f17b187f3 100755 --- a/scripts/drevops/download-db-ftp.sh +++ b/scripts/drevops/download-db-ftp.sh @@ -41,6 +41,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + # Check all required values. [ -z "${DREVOPS_DB_DOWNLOAD_FTP_USER}" ] && fail "Missing required value for DREVOPS_DB_DOWNLOAD_FTP_USER." && exit 1 [ -z "${DREVOPS_DB_DOWNLOAD_FTP_PASS}" ] && fail "Missing required value for DREVOPS_DB_DOWNLOAD_FTP_PASS." && exit 1 diff --git a/scripts/drevops/download-db-lagoon.sh b/scripts/drevops/download-db-lagoon.sh index e7798157c..eebcb50c7 100755 --- a/scripts/drevops/download-db-lagoon.sh +++ b/scripts/drevops/download-db-lagoon.sh @@ -76,6 +76,11 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +for cmd in ssh rsync; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started database dump download from Lagoon." mkdir -p "${DREVOPS_DB_DIR}" @@ -86,7 +91,7 @@ if [ -f ".env.local" ]; then t=$(mktemp) && export -p >"${t}" && set -a && . ".env.local" && set +a && . "${t}" && rm "${t}" && unset t fi -DREVOPS_SSH_PREFIX="DB_DOWNLOAD" ./scripts/drevops/setup-ssh.sh +export DREVOPS_SSH_PREFIX="DB_DOWNLOAD" && . ./scripts/drevops/setup-ssh.sh ssh_opts=(-o "UserKnownHostsFile=/dev/null") ssh_opts+=(-o "StrictHostKeyChecking=no") diff --git a/scripts/drevops/export-db-docker.sh b/scripts/drevops/export-db-docker.sh index 86735080f..444a682e0 100755 --- a/scripts/drevops/export-db-docker.sh +++ b/scripts/drevops/export-db-docker.sh @@ -33,6 +33,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in docker; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started Docker database image export." [ -z "${DREVOPS_DB_EXPORT_DOCKER_IMAGE}" ] && fail "Destination image name is not specified. Please provide docker image as a variable DREVOPS_DB_EXPORT_DOCKER_IMAGE in a format /." && exit 1 diff --git a/scripts/drevops/export-db.sh b/scripts/drevops/export-db.sh index 20b02c13b..417182e0a 100755 --- a/scripts/drevops/export-db.sh +++ b/scripts/drevops/export-db.sh @@ -25,6 +25,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in docker; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started database export." if [ -z "${DREVOPS_DB_DOCKER_IMAGE}" ]; then diff --git a/scripts/drevops/github-labels.sh b/scripts/drevops/github-labels.sh index af269f8ab..618fcaec1 100755 --- a/scripts/drevops/github-labels.sh +++ b/scripts/drevops/github-labels.sh @@ -35,6 +35,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + # Array of labels to create. If DELETE_EXISTING_LABELS=1, the labels list will # be exactly as below, otherwise labels below will be added to existing ones. labels=( diff --git a/scripts/drevops/login-docker.sh b/scripts/drevops/login-docker.sh index b087f3a31..b4f7cbeb2 100755 --- a/scripts/drevops/login-docker.sh +++ b/scripts/drevops/login-docker.sh @@ -29,6 +29,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in docker; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + # Check all required values. [ -z "${DOCKER_REGISTRY}" ] && echo "Missing required value for DOCKER_REGISTRY." && exit 1 diff --git a/scripts/drevops/mirror-code.sh b/scripts/drevops/mirror-code.sh index 639395775..154af9b25 100755 --- a/scripts/drevops/mirror-code.sh +++ b/scripts/drevops/mirror-code.sh @@ -44,6 +44,11 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +for cmd in git rsync; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started code mirroring." # Check all required values. @@ -57,7 +62,7 @@ info "Started code mirroring." [ "$(git config --global user.name)" == "" ] && note "Configuring global git user name." && git config --global user.name "${DREVOPS_MIRROR_CODE_GIT_USER_NAME}" [ "$(git config --global user.email)" == "" ] && note "Configuring global git user email." && git config --global user.email "${DREVOPS_MIRROR_CODE_GIT_USER_EMAIL}" -DREVOPS_SSH_PREFIX="MIRROR_CODE" ./scripts/drevops/setup-ssh.sh +export DREVOPS_SSH_PREFIX="MIRROR_CODE" && . ./scripts/drevops/setup-ssh.sh # Create a temp directory to copy source repository into to prevent changes to source. SRC_TMPDIR=$(mktemp -d) diff --git a/scripts/drevops/notify-github.sh b/scripts/drevops/notify-github.sh index e489451d7..bbbe3b15d 100755 --- a/scripts/drevops/notify-github.sh +++ b/scripts/drevops/notify-github.sh @@ -43,7 +43,11 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on -command -v curl >/dev/null || (fail "curl command is not available." && exit 1) +for cmd in php curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + [ -z "${DREVOPS_NOTIFY_GITHUB_TOKEN}" ] && fail "Missing required value for DREVOPS_NOTIFY_GITHUB_TOKEN" && exit 1 [ -z "${DREVOPS_NOTIFY_REPOSITORY}" ] && fail "Missing required value for DREVOPS_NOTIFY_REPOSITORY" && exit 1 [ -z "${DREVOPS_NOTIFY_REF}" ] && fail "Missing required value for DREVOPS_NOTIFY_REF" && exit 1 diff --git a/scripts/drevops/notify-jira.sh b/scripts/drevops/notify-jira.sh index bbe22a649..6bbf185f5 100755 --- a/scripts/drevops/notify-jira.sh +++ b/scripts/drevops/notify-jira.sh @@ -53,7 +53,11 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on -command -v curl >/dev/null || (fail "curl command is not available." && exit 1) +for cmd in php curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + [ -z "${DREVOPS_NOTIFY_JIRA_USER}" ] && fail "Missing required value for DREVOPS_NOTIFY_JIRA_USER" && exit 1 [ -z "${DREVOPS_NOTIFY_JIRA_TOKEN}" ] && fail "Missing required value for DREVOPS_NOTIFY_JIRA_TOKEN" && exit 1 [ -z "${DREVOPS_NOTIFY_BRANCH}" ] && fail "Missing required value for DREVOPS_NOTIFY_BRANCH" && exit 1 diff --git a/scripts/drevops/notify-newrelic.sh b/scripts/drevops/notify-newrelic.sh index 97ffb9fa4..2db0a7074 100755 --- a/scripts/drevops/notify-newrelic.sh +++ b/scripts/drevops/notify-newrelic.sh @@ -52,7 +52,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on -command -v curl >/dev/null || (fail "curl command is not available." && exit 1) +#shellcheck disable=SC2043 +for cmd in curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + [ -z "${DREVOPS_NOTIFY_NEWRELIC_PROJECT}" ] && fail "Missing required value for DREVOPS_NOTIFY_NEWRELIC_PROJECT" && exit 1 [ -z "${DREVOPS_NOTIFY_NEWRELIC_APIKEY}" ] && fail "Missing required value for DREVOPS_NOTIFY_NEWRELIC_APIKEY" && exit 1 [ -z "${DREVOPS_NOTIFY_NEWRELIC_REF}" ] && fail "Missing required value for DREVOPS_NOTIFY_NEWRELIC_REF" && exit 1 diff --git a/scripts/drevops/reset.sh b/scripts/drevops/reset.sh index 97579dbf5..7784750f6 100755 --- a/scripts/drevops/reset.sh +++ b/scripts/drevops/reset.sh @@ -18,6 +18,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +#shellcheck disable=SC2043 +for cmd in git; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + is_hard_reset="$([ "${1:-}" == "hard" ] && echo "1" || echo "0")" info "Started reset." diff --git a/scripts/drevops/setup-ssh.sh b/scripts/drevops/setup-ssh.sh index 9e15d0b75..65b43dc09 100755 --- a/scripts/drevops/setup-ssh.sh +++ b/scripts/drevops/setup-ssh.sh @@ -38,7 +38,9 @@ info "Started SSH setup." fingerprint_var="DREVOPS_${DREVOPS_SSH_PREFIX}_SSH_FINGERPRINT" if [ -n "${!fingerprint_var-}" ]; then fingerprint="${!fingerprint_var}" - note "Found variable ${fingerprint_var} with value ${fingerprint}." + note "Found fingerprint variable ${fingerprint_var} with value ${fingerprint}." +else + note "Did not find fingerprint variable ${fingerprint_var}." fi file_var="DREVOPS_${DREVOPS_SSH_PREFIX}_SSH_FILE" @@ -47,7 +49,13 @@ if [ -n "${!file_var-}" ]; then note "Found variable ${file_var} with value ${file}." else file="${HOME}/.ssh/id_rsa" - note "Using default SSH file ${file}." + note "Did not find a variable ${file_var}. Using default value ${file}." +fi + +if [ "${file}" = false ]; then + pass "SSH key is set to false meaning that it is not required. Skipping setup." + export "${file_var}=${file}" + [ "${BASH_SOURCE[0]}" != "$0" ] && return 0 || exit 0 fi if [ -n "${fingerprint-}" ]; then diff --git a/scripts/drevops/task-copy-db-acquia.sh b/scripts/drevops/task-copy-db-acquia.sh index dd9e948c9..7abc3cba7 100755 --- a/scripts/drevops/task-copy-db-acquia.sh +++ b/scripts/drevops/task-copy-db-acquia.sh @@ -71,7 +71,11 @@ extract_json_value() { } # Pre-flight checks. -command -v curl >/dev/null || (fail "curl command is not available." && exit 1) +#shellcheck disable=SC2043 +for cmd in curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done # Check that all required variables are present. [ -z "${DREVOPS_ACQUIA_KEY}" ] && fail "Missing value for DREVOPS_ACQUIA_KEY." && exit 1 diff --git a/scripts/drevops/task-copy-files-acquia.sh b/scripts/drevops/task-copy-files-acquia.sh index 55c42994e..006ee6c32 100755 --- a/scripts/drevops/task-copy-files-acquia.sh +++ b/scripts/drevops/task-copy-files-acquia.sh @@ -49,6 +49,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +# Pre-flight checks. +for cmd in php curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started database copying between environments in Acquia." # @@ -67,9 +73,6 @@ extract_json_value() { php -r "\$data=json_decode(file_get_contents('php://stdin'), TRUE); isset(\$data[\"${key}\"]) ? print trim(json_encode(\$data[\"${key}\"], JSON_UNESCAPED_SLASHES), '\"') : exit(1);" } -# Pre-flight checks. -command -v curl >/dev/null || (fail "curl command is not available." && exit 1) - # Check that all required variables are present. [ -z "${DREVOPS_ACQUIA_KEY}" ] && fail "Missing value for DREVOPS_ACQUIA_KEY." && exit 1 [ -z "${DREVOPS_ACQUIA_SECRET}" ] && fail "Missing value for DREVOPS_ACQUIA_SECRET." && exit 1 diff --git a/scripts/drevops/task-custom-lagoon.sh b/scripts/drevops/task-custom-lagoon.sh index 966c08e25..efab258b2 100755 --- a/scripts/drevops/task-custom-lagoon.sh +++ b/scripts/drevops/task-custom-lagoon.sh @@ -67,7 +67,7 @@ info "Started Lagoon task ${DREVOPS_TASK_LAGOON_NAME}." [ -z "${DREVOPS_TASK_LAGOON_COMMAND}" ] && echo "Missing required value for DREVOPS_TASK_LAGOON_COMMAND." && exit 1 [ -z "${DREVOPS_TASK_LAGOON_PROJECT}" ] && echo "Missing required value for DREVOPS_TASK_LAGOON_PROJECT." && exit 1 -DREVOPS_SSH_PREFIX="TASK" ./scripts/drevops/setup-ssh.sh +export DREVOPS_SSH_PREFIX="TASK" && . ./scripts/drevops/setup-ssh.sh if ! command -v lagoon >/dev/null || [ -n "${DREVOPS_LAGOONCLI_FORCE_INSTALL}" ]; then note "Installing Lagoon CLI." @@ -86,6 +86,11 @@ if ! command -v lagoon >/dev/null || [ -n "${DREVOPS_LAGOONCLI_FORCE_INSTALL}" ] export PATH="${PATH}:${DREVOPS_LAGOONCLI_PATH}" fi +for cmd in curl lagoon; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + note "Configuring Lagoon instance." #shellcheck disable=SC2218 lagoon config add --force -l "${DREVOPS_TASK_LAGOON_INSTANCE}" -g "${DREVOPS_TASK_LAGOON_INSTANCE_GRAPHQL}" -H "${DREVOPS_TASK_LAGOON_INSTANCE_HOSTNAME}" -P "${DREVOPS_TASK_LAGOON_INSTANCE_PORT}" diff --git a/scripts/drevops/task-purge-cache-acquia.sh b/scripts/drevops/task-purge-cache-acquia.sh index 3a1428c03..a7e528f95 100755 --- a/scripts/drevops/task-purge-cache-acquia.sh +++ b/scripts/drevops/task-purge-cache-acquia.sh @@ -49,6 +49,12 @@ pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03 fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on +# Pre-flight checks. +for cmd in php curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + info "Started cache purging in Acquia." # @@ -67,9 +73,6 @@ extract_json_value() { php -r "\$data=json_decode(file_get_contents('php://stdin'), TRUE); isset(\$data[\"${key}\"]) ? print trim(json_encode(\$data[\"${key}\"], JSON_UNESCAPED_SLASHES), '\"') : exit(1);" } -# Pre-flight checks. -command -v curl >/dev/null || (fail "curl command is not available." && exit 1) - # Check that all required variables are present. [ -z "${DREVOPS_ACQUIA_KEY}" ] && fail "Missing value for DREVOPS_ACQUIA_KEY." && exit 1 [ -z "${DREVOPS_ACQUIA_SECRET}" ] && fail "Missing value for DREVOPS_ACQUIA_SECRET." && exit 1 diff --git a/scripts/drevops/update-scaffold.sh b/scripts/drevops/update-scaffold.sh index 014433100..0f220de0f 100755 --- a/scripts/drevops/update-scaffold.sh +++ b/scripts/drevops/update-scaffold.sh @@ -24,6 +24,11 @@ DREVOPS_INSTALLER_URL="${DREVOPS_INSTALLER_URL:-https://install.drevops.com}" export DREVOPS_INSTALLER_URL export DREVOPS_INSTALL_COMMIT +for cmd in php curl; do command -v ${cmd} >/dev/null || { + fail "Command ${cmd} is not available" + exit 1 +}; done + curl -L "${DREVOPS_INSTALLER_URL}"?"$(date +%s)" >/tmp/install php /tmp/install --quiet rm /tmp/install >/dev/null diff --git a/tests/behat/bootstrap/FeatureContext.php b/tests/behat/bootstrap/FeatureContext.php index 530a71f17..a7e2f408b 100644 --- a/tests/behat/bootstrap/FeatureContext.php +++ b/tests/behat/bootstrap/FeatureContext.php @@ -5,6 +5,8 @@ * YOURSITE Drupal context for Behat testing. */ +declare(strict_types=1); + use DrevOps\BehatSteps\ContentTrait; use DrevOps\BehatSteps\FieldTrait; use DrevOps\BehatSteps\FileTrait; diff --git a/tests/phpunit/CircleCiConfigTest.php b/tests/phpunit/CircleCiConfigTest.php index 1c97274e3..92c554f4a 100644 --- a/tests/phpunit/CircleCiConfigTest.php +++ b/tests/phpunit/CircleCiConfigTest.php @@ -1,5 +1,7 @@