include:
- project: 'acquia/standard-template'
file:
- '/gitlab-ci/Auto-DevOps.acquia.gitlab-ci.yml'
# Clone the acquia/standard-template to $STANDARD_TEMPLATE_PATH.
.clone_standard_template:
script:
- echo -e "\e[0Ksection_start:`date +%s`:clone_standard_template[collapsed=true]\r\e[0K\033[1;35m[Code Studio AutoDevOps] Cloning AutoDevOps template\033[0m"
- git clone --depth 50 $STANDARD_TEMPLATE_URL $STANDARD_TEMPLATE_PATH
- echo -e "\e[0Ksection_end:`date +%s`:clone_standard_template\r\e[0K"
# The cache strategy for the test jobs.
.cache_strategy_pull:
extends: .cache_strategy_push
cache:
policy: pull
# Use custom generated ssh key for BLT.
.blt_ssh:
script:
- eval $(ssh-agent -s)
- echo 'echo $SSH_PASSPHRASE' > ~/.ssh/tmp && chmod 700 ~/.ssh/tmp
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | DISPLAY=None SSH_ASKPASS=~/.ssh/tmp ssh-add -
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
"Test Drupal":
stage: "Test Drupal"
extends: .cache_strategy_pull
id_tokens:
VAULT_ID_TOKEN:
aud: https://gitlab-acquia-vault.cs-gitlab-system.svc.cluster.local:8200
script:
- !reference [.clone_standard_template, script]
- $STANDARD_TEMPLATE_PATH/ci-files/scripts/utility/setup_prereqs.sh
- $STANDARD_TEMPLATE_PATH/ci-files/scripts/utility/config_ssh.sh $VAULT_ID_TOKEN
- $STANDARD_TEMPLATE_PATH/ci-files/scripts/utility/composer_install.sh
- !reference [.blt_ssh, script]
- cat "$STANDARD_TEMPLATE_PATH"/ci-files/gitlab.settings.php >> "$CI_PROJECT_DIR"/docroot/sites/default/settings.php
- $CI_PROJECT_DIR/vendor/bin/blt setup --no-interaction
- $CI_PROJECT_DIR/vendor/bin/blt validate --ansi --verbose --no-interaction
- $CI_PROJECT_DIR/vendor/bin/blt tests --ansi --verbose --no-interaction
"Create artifact from branch":
stage: "Deploy Drupal"
extends: .cache_strategy_pull
id_tokens:
VAULT_ID_TOKEN:
aud: https://gitlab-acquia-vault.cs-gitlab-system.svc.cluster.local:8200
script:
- !reference [.clone_standard_template, script]
- $STANDARD_TEMPLATE_PATH/ci-files/scripts/utility/setup_prereqs.sh
- $STANDARD_TEMPLATE_PATH/ci-files/scripts/utility/config_ssh.sh $VAULT_ID_TOKEN
- !reference [.blt_ssh, script]
- blt artifact:deploy --commit-msg "Automated commit by Code Studio for Pipeline ${CI_PIPELINE_ID}" --branch "${CI_COMMIT_BRANCH}-codestudio-build" --ignore-dirty --no-interaction --verbose
"Create artifact from tag":
stage: "Deploy Drupal"
extends: .cache_strategy_pull
id_tokens:
VAULT_ID_TOKEN:
aud: https://gitlab-acquia-vault.cs-gitlab-system.svc.cluster.local:8200
script:
- !reference [.clone_standard_template, script]
- $STANDARD_TEMPLATE_PATH/ci-files/scripts/utility/setup_prereqs.sh
- $STANDARD_TEMPLATE_PATH/ci-files/scripts/utility/config_ssh.sh $VAULT_ID_TOKEN
- !reference [.blt_ssh, script]
- blt artifact:deploy --commit-msg "Automated commit by Code Studio for Pipeline ${CI_PIPELINE_ID}" --tag "${CI_COMMIT_TAG}-codestudio-build" --ignore-dirty --no-interaction --verbose