From 2d88f69073a4d84c5fdca03b6ff7c437527f0ce0 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen.haas@lakedrops.com> Date: Mon, 10 Mar 2025 13:39:12 +0100 Subject: [PATCH] gitlab-ci-cd/drupal#78 Add support to always install new site for testing --- lakedrops-execute.yml | 3 +++ lakedrops.yml | 1 + test-and-deploy.yml | 36 ++++++++++++++++++++++++++++++++++++ tests/lakedrops.yml | 4 ++++ 4 files changed, 44 insertions(+) diff --git a/lakedrops-execute.yml b/lakedrops-execute.yml index 958fc9c..511f807 100644 --- a/lakedrops-execute.yml +++ b/lakedrops-execute.yml @@ -43,6 +43,9 @@ Import DB NG: Import Local DB: extends: '.importdbLocal' +Import Install DB: + extends: '.importdbInstall' + Update DB: extends: '.updatedb' diff --git a/lakedrops.yml b/lakedrops.yml index 71e7219..60884bc 100644 --- a/lakedrops.yml +++ b/lakedrops.yml @@ -1,4 +1,5 @@ variables: + ALWAYS_INSTALL_IN_PIPELINE: 0 COMPOSE_PROJECT_NAME: ${PROJECT_NAME}_$CI_COMMIT_REF_SLUG COMPOSER_EXIT_ON_PATCH_FAILURE: 1 COMPOSER_PATCHES_SKIP_REPORTING: 1 diff --git a/test-and-deploy.yml b/test-and-deploy.yml index 4d9a847..9cfbb96 100644 --- a/test-and-deploy.yml +++ b/test-and-deploy.yml @@ -172,6 +172,8 @@ Debug: GITLABTESTSDISABLED="yes" elif [[ "$DISABLE_CI_TEST_BACKSTOP" == "1" && "$DISABLE_CI_TEST_CYPRESSE2E" == "1" ]]; then echo "DB not required" + elif [[ "$ALWAYS_INSTALL_IN_PIPELINE" == "yes" ]]; then + DBREQUIRED="yes" elif [[ "$CI_COMMIT_REF_NAME" == "main" ]]; then DBREQUIRED="yes" elif [[ "$CI_COMMIT_MESSAGE" == *"[PULL_DB]"* ]]; then @@ -437,6 +439,8 @@ Debug: when: never - if: '$LOCALDBFILE != "none"' when: never + - if: '$ALWAYS_INSTALL_IN_PIPELINE == "yes"' + when: never - if: '$DISABLE_CI_TESTS != "1"' .dumpdbNG: @@ -469,6 +473,8 @@ Debug: when: never - if: '$LOCALDBFILE != "none"' when: never + - if: '$ALWAYS_INSTALL_IN_PIPELINE == "yes"' + when: never - if: '$DISABLE_CI_TESTS != "1"' .importdb: @@ -486,6 +492,8 @@ Debug: when: never - if: '$LOCALDBFILE != "none"' when: never + - if: '$ALWAYS_INSTALL_IN_PIPELINE == "yes"' + when: never - if: '$DISABLE_CI_TESTS != "1"' dependencies: - 'Build Site' @@ -506,6 +514,8 @@ Debug: when: never - if: '$LOCALDBFILE != "none"' when: never + - if: '$ALWAYS_INSTALL_IN_PIPELINE == "yes"' + when: never - if: '$DISABLE_CI_TESTS != "1"' dependencies: - 'Build Site' @@ -518,6 +528,30 @@ Debug: before_script: - cp ${LOCALDBFILE} ${PROJECT_NAME}.sql.gz - gunzip ${PROJECT_NAME}.sql.gz + rules: + - if: '$DBREQUIRED == "no"' + when: never + - if: '$TESTSDISABLED == "yes"' + when: never + - if: '$LOCALDBFILE != "none"' + when: never + - if: '$ALWAYS_INSTALL_IN_PIPELINE == "yes"' + when: never + - if: '$DISABLE_CI_TESTS != "1"' + dependencies: + - 'Build Site' + +.importdbInstall: + stage: prepare + tags: + - default + image: registry.lakedrops.com/docker/gitlab-drupal-ci/php-${PHP_MAJOR_VERSION}.${PHP_MINOR_VERSION} + cache: {} + variables: + GIT_STRATEGY: fetch + script: + - ${INITIAL_SETUP_COMMAND} + - drush cr rules: - if: '$DBREQUIRED == "no"' when: never @@ -525,6 +559,8 @@ Debug: when: never - if: '$LOCALDBFILE == "none"' when: never + - if: '$ALWAYS_INSTALL_IN_PIPELINE == "no"' + when: never - if: '$DISABLE_CI_TESTS != "1"' dependencies: - 'Build Site' diff --git a/tests/lakedrops.yml b/tests/lakedrops.yml index 9d37670..5d84d62 100644 --- a/tests/lakedrops.yml +++ b/tests/lakedrops.yml @@ -69,6 +69,8 @@ Test Backstop: optional: true - job: Import Local DB optional: true + - job: Import Install DB + optional: true - job: Update DB optional: true script: @@ -96,6 +98,8 @@ Test Cypress E2E: optional: true - job: Import Local DB optional: true + - job: Import Install DB + optional: true - job: Update DB optional: true - job: Test Backstop -- GitLab