I have 3 task below. What I want to do is when npm1 succeeds it will perform npm2a and skip npm2b. And when npm1 fails, it will skip npm2a and execute npm2b.
How can this be done in Azure pipelines? Please don't point me to a tutorial.
CodePudding user response:
How to do perform a task branching in azure pipelines in case of failure?
You could add a command-line or inline PowerShell task between npm1
and npm2a
to invoke
And set a variable testvar
with default value npm2a
.
Besides, set the condition for the task npm2a
and npm2b
:
and(succeeded(), eq(variables['testvar'], 'npm2a'))
and(failed(), eq(variables['testvar'], 'npm2b'))