Loading...

Overriding the AutoDevOps pipeline to use BLT

The Auto DevOps pipeline replaced BLT commands with Acquia CLI commands as of March 3, 2025. Acquia recommends that you remove BLT from your project. For more information, visit You don't need BLT on Acquia Cloud.

To override the Auto DevOps pipeline to use BLT:

  1. Create a file in your project and name it .blt-gitlab-ci.yml.
  2. Add the following content to the file:

    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
    
  3. Click Settings > CI/CD.
  4. In the General pipelines section, click Expand.
  5. In the CI/CD configuration file field, enter the path to the custom .blt-gitlab-ci.yml file.
  6. Click Save changes.

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation