- stage: PublishStage
dependsOn: [PreStage, CheckTestProjects, TestStage]
condition: |
and(
succeeded(),
or(
eq(dependencies.TestStage.result, 'succeeded'),
eq(dependencies.TestStage.result, 'skipped')
)
)
jobs:
- template: PublishNuget_jobs_template.yml@templates
parameters:
buildConfiguration: '${{ variables.buildConfiguration }}'
feed: '${{ variables.feed }}'
The pipeline always skips the publish stage.
What i would like to achieve:
- If the TestStage was skipped (for eg.: testproject did not exist) publish stage should run
- If TestStage was successfull it needs to run
- If TestStage failed don’t run publish
Any Idea?
I have tried:
- stage: PublishStage
dependsOn: [PreStage, CheckTestProjects, TestStage]
condition: and(not(failed('TestStage')))
jobs:
- template: PublishNuget_jobs_template.yml@templates
parameters:
buildConfiguration: '${{ variables.buildConfiguration }}'
feed: '${{ variables.feed }}'
What I would like to achieve:
- If the TestStage was skipped (for eg.: testproject did not exist) publish stage should run
- If TestStage was successfull it needs to run
- If TestStage failed don’t run publish
You can use the condition like the following sample to achieve what you need. For more details, please refer Stage to stage dependencies
- stage: PublishStage
dependsOn: [PreStage, CheckTestProjects, TestStage]
condition: in(dependencies.TestStage.result, 'Succeeded', 'Skipped')
jobs:
- template: PublishNuget_jobs_template.yml@templates
parameters:
buildConfiguration: '${{ variables.buildConfiguration }}'
feed: '${{ variables.feed }}'
My test result: