Skip to content

Instantly share code, notes, and snippets.

@smulvih2
Last active August 14, 2024 18:08

Revisions

  1. smulvih2 revised this gist Aug 14, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions azure-pipelines.yml
    Original file line number Diff line number Diff line change
    @@ -15,8 +15,8 @@ resources:
    repositories:
    - repository: site-XYZ
    type: github
    endpoint: ECCCDrupalWxT
    name: openplus/site-XYZ
    endpoint: XYZDrupalWxT
    name: smulvih2/site-XYZ

    variables:
    - name: GIT_TAG
  2. smulvih2 created this gist Aug 14, 2024.
    70 changes: 70 additions & 0 deletions azure-pipelines.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@
    # Starter pipeline for the drupalwxt/docker-scaffold appsvc image

    trigger:
    tags:
    include:
    - '*'

    pr: none

    # Use a generic Ubuntu pool provided by Azure DevOps
    pool:
    vmImage: 'ubuntu-latest'

    resources:
    repositories:
    - repository: site-XYZ
    type: github
    endpoint: ECCCDrupalWxT
    name: openplus/site-XYZ

    variables:
    - name: GIT_TAG
    value: ''

    steps:
    - task: DockerInstaller@0
    displayName: 'Update Docker'
    inputs:
    dockerVersion: '23.0.1'
    releaseType: 'stable'

    - bash: |
    export GIT_TAG=$(echo $(Build.SourceBranch) | sed -e "s/^refs\/tags\///")
    echo "Using git tag $GIT_TAG"
    echo "##vso[task.setvariable variable=GIT_TAG]$GIT_TAG"
    displayName: 'Export github tag name'

    - checkout: site-XYZ
    path: site-XYZ
    displayName: 'Checkout XYZ application code'

    - script: |
    echo "Fetching tag " $(GIT_TAG)
    git checkout $(GIT_TAG)
    displayName: 'Switch git tag'

    - script: export COMPOSER_MEMORY_LIMIT=-1 && composer install --ignore-platform-reqs
    displayName: 'Install dependencies with composer'

    - script: make build
    displayName: 'Setup environment'

    - script: |
    docker compose -f docker-compose.appsvc.yml build --no-cache
    docker compose -f docker-compose.appsvc.yml up -d
    docker tag site-XYZ-web:latest $(XYZ_ACR_ENV)/site-XYZ:$(GIT_TAG)-appsvc
    docker ps -a
    sleep 10
    displayName: 'Create and tag appsvc image'
    env:
    GIT_TAG: $(Build.SourceBranch)

    - task: Docker@2
    env:
    GIT_TAG: $(Build.SourceBranch)
    inputs:
    command: 'push'
    containerRegistry: 'Drupal ACR'
    repository: 'site-XYZ'
    tags: $(GIT_TAG)-appsvc