Even though I set System.Debug=True I get no other information than "The job was skipped". Literally just these four words.
I created a YAML-Release pipeline on Azure Devops which basically runs the jobs:
- job: build_release
- jobs: deployment: deploy_test
- jobs: deployment: deploy_stage
To test the behavior I first only ran the first two jobs and deployed to TEST. Now I want to deploy to STAGE but it seems that the pipeline is only working when I start from the beginning / create a new release. But what I want to do right now is to deploy the already existing release from TEST to STAGE. When I try to do that by rerunning the pipeline Azure just skips all steps. Why is this happening? How can I avoid this and rerun the pipeline? I did not set any conditions.
EDIT with additonal info:
Structure of the pipeline
trigger:
- release/*
variables:
...
resources:
- repo: self
pool:
vmImage: $(vmImageName)
stages:
- stage: build_release
displayName: 'awesome build'
condition: contains(variables['Build.SourceBranchName'], 'release/')
jobs:
- job: build_release
steps:
...
- stage: deploy_test
displayName: 'awesome test deploy'
jobs:
- deployment: deploy_test
environment: 'test'
strategy:
runOnce:
deploy:
steps:
...
- stage: deploy_stage
displayName: 'awesome stage deploy'
jobs:
- deployment: deploy_stage
environment: 'stage'
strategy:
runOnce:
deploy:
steps:
...
I tried to trigger it in two different ways which had the same outcome (everything was skipped): A. I created a new release which was a copy of the previously deployed release. B. I clicked on run pipeline.
The issue is caused by the condition
condition: contains(variables['Build.SourceBranchName'], 'release/')
, which you specified for stagebuild_release
.When the trigger is set to
- release/*
. The variablevariables['Build.SourceBranchName']
will be evaluated to the branch name after the/
.For example:
If you triggered your pipeline from branch
release/release1.0
. the value ofvariables['Build.SourceBranchName']
will berelease1.0
instead ofrelease/release1.0
. So the conditioncontains(variables['Build.SourceBranchName'], 'release/')
will always be false, which caused the stagebuild_release
to be skipped.And, if you didnot specify dependency for stage
deploy_test
and stagedeploy_stage
, the next stage will depends on the previous stage by default. So these two stages also got skipped, since stagebuild_release
is skipped. This is why you saw all the steps were skipped.Solution:
Using variable
Build.SourceBranch
in the condition.Change the condition like below: (The yaml file in the release branches should also be changed like below)
Noted: If you mannaly triggered your pipeline. Please make sure your select to trigger the pipeline from release branches. Or the pipeline will be triggered from main branch by default.