Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save silverham/594537309d76c04b6e528d43d1b3af7b to your computer and use it in GitHub Desktop.

Select an option

Save silverham/594537309d76c04b6e528d43d1b3af7b to your computer and use it in GitHub Desktop.

Revisions

  1. @markf3lton markf3lton revised this gist Oct 27, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion acquia-blt-in-azure-devops-pipelines.md
    Original file line number Diff line number Diff line change
    @@ -49,7 +49,9 @@ Save your azure-pipelines.yml file.

    You can read more about CI solutions on Acquia Docs: https://docs.acquia.com/blt/tech-architect/ci/

    ### The following azure-pipelines.yml file is a good way to get started with BLT on Azure Pipeline
    ### azure-pipelines.yml

    The file felow is a good way to get familiar with Azure Pipelines running some BLT commands.

    ```
    # PHP
  2. @markf3lton markf3lton revised this gist Oct 27, 2019. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions acquia-blt-in-azure-devops-pipelines.md
    Original file line number Diff line number Diff line change
    @@ -26,21 +26,26 @@ https://docs.acquia.com/acquia-cloud/manage/ssh/generate/

    Under Pipelines > Library, upload the private key as a secure file.

    First I make a copy of it...
    First I make a copy of it, I am using WSL/Ubuntu on Windows 10 so I can use standard bash commands:

    ```
    cp ~/.ssh/id_rsa /mnt/c/Users/mfelton001/Documents/private-key.txt
    ```

    You will need to toggle the option to "Authorize for use in all Pipelines" and click on the Security settings. Administrators are fine, but the group members marked as "Reader" should be changed to "User" so they can use these secure files.
    You will need to toggle the option to "Authorize for use in all Pipelines".

    Also on the Security settings. Administrators are fine, but the group members who are marked as "Reader" should be changed to "User" so they can use these secure files...


    ### Set up your Pipeline

    Click the button to add a new Pipeline, select the Azure Repo, Choose PHP (the first option)

    Click on line 27, search widgets for SSH, choose "Install SSH Key"
    Click on line 27, search widgets for SSH, choose the option "Install SSH Key"

    You will need to have `known_hosts` entry for your Acquia SVN repo, and of course your passphrase.

    You will need to the known_hosts data from your Acquia SVN repo, and of course your passphrase.
    Save your azure-pipelines.yml file.

    You can read more about CI solutions on Acquia Docs: https://docs.acquia.com/blt/tech-architect/ci/

  3. @markf3lton markf3lton renamed this gist Oct 27, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt → acquia-blt-in-azure-devops-pipelines.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Run Acquia BLT in Azure DevOps with Pipelines
    # Acquia BLT in Azure DevOps Pipelines

    This guide will get you started with Acquia BLT and AzDo (Azure DevOps).

  4. @markf3lton markf3lton created this gist Oct 27, 2019.
    155 changes: 155 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,155 @@
    # Run Acquia BLT in Azure DevOps with Pipelines

    This guide will get you started with Acquia BLT and AzDo (Azure DevOps).

    I wrote a guide for running [BLT on Windows](https://gist.github.com/markf3lton/1bc0f8c7a41038464b2c5500f2706eec) that will complement this tutorial.

    I also wrote a [Getting Started with BLT](https://gist.github.com/markf3lton/1a3f73e0825baaf1adeada0ebe47efe8) guide.


    ### Set up your Azure Repo

    The industry standard is Github but many folks use Bitbucket, Gitlab, or even Azure DevOps. My guide for Github is [here](https://gist.github.com/markf3lton/1a3f73e0825baaf1adeada0ebe47efe8#create-the-github-repo).

    Create a BLT project and push it to your Azure Repo.

    You will want to set your `origin` to Azure and also set `acquia` as a remote:

    ```
    git remote add acquia [email protected]:woburn.git
    ```

    ### Set up your SSH key as a Secure File

    I assume you have created a public/private key pair using the `ssh-keygen` instructions on this page:
    https://docs.acquia.com/acquia-cloud/manage/ssh/generate/

    Under Pipelines > Library, upload the private key as a secure file.

    First I make a copy of it...

    ```
    cp ~/.ssh/id_rsa /mnt/c/Users/mfelton001/Documents/private-key.txt
    ```

    You will need to toggle the option to "Authorize for use in all Pipelines" and click on the Security settings. Administrators are fine, but the group members marked as "Reader" should be changed to "User" so they can use these secure files.

    ### Set up your Pipeline

    Click the button to add a new Pipeline, select the Azure Repo, Choose PHP (the first option)

    Click on line 27, search widgets for SSH, choose "Install SSH Key"

    You will need to the known_hosts data from your Acquia SVN repo, and of course your passphrase.

    You can read more about CI solutions on Acquia Docs: https://docs.acquia.com/blt/tech-architect/ci/

    ### The following azure-pipelines.yml file is a good way to get started with BLT on Azure Pipeline

    ```
    # PHP
    # Test and package your PHP project.
    # Add steps that run tests, save build artifacts, deploy, and more:
    # https://docs.microsoft.com/azure/devops/pipelines/languages/php

    trigger:
    - master

    pool:
    vmImage: 'ubuntu-16.04'
    COMPOSER_BIN: $(Build.Repository.LocalPath)/vendor/bin
    BLT_DIR: $(Build.Repository.LocalPath)/vendor/acquia/blt
    LOCAL_BLT_DIR: $(Build.Repository.LocalPath)/blt/src

    variables:
    phpVersion: 7.2

    steps:
    - script: |
    sudo update-alternatives --set php /usr/bin/php$(phpVersion)
    sudo update-alternatives --set phar /usr/bin/phar$(phpVersion)
    sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion)
    sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion)
    sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion)
    php -version
    displayName: 'Use PHP version $(phpVersion)'


    - task: CmdLine@2
    inputs:
    script: |
    echo ' '
    echo Write your commands here!!
    mysql --version
    echo ' '
    displayName: 'Testing some commands'


    - script: composer install --no-interaction --prefer-dist
    displayName: 'composer install'


    - task: InstallSSHKey@0
    inputs:
    knownHostsEntry: 'svn-8018.devcloud.hosting.acquia.com,54.54.86.113 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZLDJOkdLKbvf2hEclleJJ2zOJjr9omVSfAFmJPe/HqDJTinSEihJuyYkORzOCBm789mQYcVPPodEwDEP20pW38f2hz+fYqK4hB2cDV/epUv4GL7ebJfto8UUnGQTWSRUHf2wVyYQwMGV9XA6MsiHYLd3xgvL4RZ47TbsfukL0mzlsc0lq3nPrzi0WxKS+614Eqg2mBpSLNGOUOGbz64h8bnpa/5ww2GCscymYGWcM403x2dDEliOplFNlKztgs+of5Zf9AT8Eh1O20jiBz85dUL1eintKSOau/jzrz5IP+SkpM9u+80H1hUe39w4t5/UdWHTYtlRqjflXjt/A8iZj'
    sshPublicKey: 'ssh-rsa AAABBgmw=='
    sshPassphrase: '12345'
    sshKeySecureFile: 'id_rsa'
    displayName: 'Install the SSH key that we need for the external git repo'


    - task: CmdLine@2
    inputs:
    script: |
    echo ' '
    cat ~/.ssh/known_hosts | awk '{print $1}'
    echo ' '
    # Verify that BLT was installed
    vendor/bin/blt
    echo ' '
    displayName: 'Preflight before continuing to the next step'


    - task: CmdLine@2
    inputs:
    script: |
    set -ev

    # Set the git configuration
    git config --global user.name "Azure-CI"
    git config --global user.email "[email protected]"

    # Create a MySQL database for drupal to use
    mysql -u root -proot -e "CREATE DATABASE drupal; CREATE USER 'drupal'@'localhost' IDENTIFIED BY 'drupal'; GRANT ALL ON drupal.* TO 'drupal'@'localhost';"

    set +ev
    displayName: 'Set up the environment for Drupal'


    - task: CmdLine@2
    inputs:
    script: |
    set -ev

    vendor/bin/blt validate:all --no-interaction
    # Run "blt setup"
    vendor/bin/blt setup --no-interaction --ansi --verbose

    # Run "blt doctor"
    # vendor/bin/blt doctor

    set +v
    displayName: 'Install Drupal!'


    - task: CmdLine@2
    inputs:
    script: |
    set -ev

    # Run blt artifact:deploy
    vendor/bin/blt artifact:deploy --commit-msg "Automated commit by Azure Devops CI for Build" --tag "azure-build-${BUILD_BUILDID}" --ignore-dirty --no-interaction --verbose

    set +v
    displayName: 'Build, then tag, then deploy the build artifact!'
    ```