Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Now it is possible to skip approval and deployment if there are no changes in the Terraform plan #4

Description

@HoussemDellai

It's not currently possible to skip approval and deployment if there are no changes in the Terraform plan, because of limitations in multi-stage pipelines (stages cannot be conditioned on the outputs of previous stages). You could cancel the pipeline (through the REST API) in that case, but that would prevent extending the pipeline to include activities beyond Terraform.

Actually this is now possible!

Here is a sample pipeline that can do that:

trigger:
- master
resources:
- repo: self
pool:
  vmImage: 'ubuntu-16.04'

variables:
  **MyVar**: 'MyVal'
 
stages:
- stage: Save_Variable
 
  jobs:
  - job: Save_Variable
    steps:
      - pwsh: Write-Host "##vso[task.setvariable variable=**MyVar**;isOutput=true]NewVal"
        name: MyOutputVar
 
- stage: Read_Variables
  dependsOn: Save_Variable
   
  jobs:
    - job: Read_Variable
      variables:
        **prevStageVar**: $[stageDependencies.Save_Variable.Save_Variable.outputs['MyOutputVar.**MyVar**']]
      steps:
      - powershell: 'Write-Host "Get Stage variable: **$(prevStageVar)**"'

And here is a video I made for that (skipping terraform apply, but not across stages here) :
Video: Skip terraform apply in Azure DevOps pipelines

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions