Within an Azure Pipeline, I have an agent job called "job_3" which I want to run if it fulfills the following conditions:
- If Job_1(agent job) is successful or
- If Job_1(agent job) fails but Job_2(agentless job) succeeds. Job_2 runs only if Job_1 fails.
To start Job_3 in the pipeline I used custom variable expressions for it to trigger:
The expression I used:
and( eq(dependencies.Job_1.result,'Succeeded'), eq(dependencies.Job_2.result,'Succeeded') )
I get an error saying that there are cycle dependencies. What can i do to mitigate the issue?
CodePudding user response:
An error saying that there are cycle dependencies.
The cause of this issue could be that there are cycle dependencies in the dependencies set by your jobs.
For example: Job_1 depend on Job_2 , Job2 depend on Job_1.
Based on your requirements, you can reset the following dependencies to fix this issue.
Job2 depend on Job 1 and Job 3 depend on Job 1 and Job 2.
In this case , the job_2 will run depend on the result of Job_1 and the Job_3 will depend on the result of job_1 and job_2.
YAML sample:
jobs:
- job: job1
- job: job2
dependsOn: job1
- job: job3
dependsOn:
- job1
- job2
Classic Sample:
Job_1
Job_2
Job_3