Snippets Collections
cd $(vr_path)

branchName=$(System.PullRequest.SourceBranch)
SourceRepositoryURI=$(System.PullRequest.SourceRepositoryURI)

echo branchName is $branchName
echo SourceRepositoryURI is $SourceRepositoryURI

baseUrl="https://${branchName##*/}-bmc-org.pantheonsite.io/"
echo base url is $baseUrl

export PERCY_TOKEN=$(PERCY_TOKEN)
npx percy exec -- cypress run --config baseUrl=$baseUrl
    # Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- none

variables:
- name: src
  value: $(System.DefaultWorkingDirectory)/tests/visual_regression_tests
- name: branchName
  value: $(Build.SourceBranchName)
  
pool:
  vmImage: ubuntu-latest

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '14.x'
  displayName: 'Install Node.js'

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'brew install pantheon-systems/external/terminus'

- script: |
    terminus auth:login --machine-token=$(TERMINUS_TOKEN)
  displayName: 'Terminus Authentication'
  workingDirectory: $(src)

- script: |
    PANTHEON_MULTIDEV_LIST="$(terminus multidev:list -n bmc-org --format=list --field=Name)"
    echo PANTHEON_MULTIDEV_LIST
  displayName: 'Terminus check available multidevs'
  workingDirectory: $(src)

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      #!/bin/bash
      
      # Exit on error
      set -e

      # Stash list of all Pantheon sites in the org
      PANTHEON_SITES="$(terminus multidev:list -n bmc-org --format=list --field=Name)"
        FOUND="false"
        
      # Loop through each site in the list
      while read -r PANTHEON_SITES
      do
      # if the branch is found then let user know that this branch exists and exit the script.
        if [ $PANTHEON_SITES == $(branchName) ];
        then
            echo "Multidev was found!"
            FOUND="true"
            echo "Existing multidev URL: https://$(branchName)-bmc-org.pantheonsite.io/"
            break
        fi

      done <<< "$PANTHEON_SITES"

      #if the branch was not found then create a branch with the desired name
      if [ $FOUND == "false" ];
      then
        terminus multidev:create bmc-org.live $(branchName)
        echo "New multidev URL: https://$(branchName)-bmc-org.pantheonsite.io/"
      fi

- script: |
    npm install
    export PERCY_TOKEN=$(PERCY_TOKEN)
    export PERCY_TARGET_BRANCH=$(PERCY_TARGET_BRANCH)
    npx percy exec -- cypress run --config baseUrl="https://$(branchName)-bmc-org.pantheonsite.io/"
  displayName: 'NPM Install and Percy Setup and Execute'
  workingDirectory: $(src)
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- none

pool:
  vmImage: ubuntu-latest

variables:
- name: branchName
  value: $(Build.SourceBranchName)

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '14.x'
  displayName: 'Install Node.js'

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'brew install pantheon-systems/external/terminus'

- script: |
    terminus auth:login --machine-token=$(TERMINUS_TOKEN)
  displayName: 'Terminus Authentication'

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      #!/bin/bash
      
      # Exit on error
      set -e
      MULTIDEV_EXISTS="false"
      
      # Stash list of all Pantheon sites in the org
      PANTHEON_SITES="$(terminus multidev:list -n bmc-org --format=list --field=Name)"
        
      # Loop through each site in the list
      while read -r PANTHEON_SITES
      do
      # if the branch is found then let user know that this branch exists and exit the script.
        if [ $PANTHEON_SITES == $(branchName) ];
        then
            MULTIDEV_EXISTS="true"
            echo "Existing multidev URL: https://$(branchName)-bmc-org.pantheonsite.io/"
            break
        fi
      
      done <<< "$PANTHEON_SITES"
      
      if [ $MULTIDEV_EXISTS == "true" ];
      then
        echo "Multidev was found!"
        "$(terminus env:clone-content --verbose bmc-org.live abc)"
      else 
        echo "Error:  multidev environment named "$(branchName)" was not found."
        exit 1
      fi
    failOnStderr: true
  continueOnError: false

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      #!/bin/bash
      
      PANTHEON_PIPELINE_CLONE="$(terminus env:clone-content --verbose healthcity.live pipelines)"
      echo $(PANTHEON_PIPELINE_CLONE)
  continueOnError: false
  displayName: 'Updating Multidev Environments'

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension