Ga naar de hoofdinhoud
Twyzer

Blog

Skipped jobs in Azure DevOps pipeline

Technologie

Geschreven door

Don van Meel - Managing Director

Recently I stumbled upon a skipped job in my Azure DevOps pipeline, while there was no condition that could explain this. It took me quite some headache to find out what the reason was, so I’ll describe my search for the solution in this blog.

Situation

To explain my problem, I will use a very simple pipeline, containing a single stage with 4 jobs:

JobB depends on JobA, JobC depends on JobB, and JobD depends on JobC.

JobB has a condition that causes this job to be skipped.
JobC has a condition that it is never skipped.

JobD does not have any condition at all.

Below is the yml file I used for this:

Results

My expectation of this pipeline was that jobs A, C, and D would run, because jobD does not have a condition at all.

The actual result is shown in the picture: jobD is skipped. But why?

The reason appears to be that a job without a condition will have an implicit condition succeeded(). This condition means: all previous jobs must succeed. For some reason a job that is skipped is not successful. This means that JobD fails, because one of the upstream jobs is skipped.

How to fix this

The fix for this problem is relatively easy: add an explicit condition to JobD. For example, check that JobC is successful:

Conclusion

If you expect that a job might be skipped in a dependency tree, always add an explicit condition to downstream jobs.

Bouw verder op een fundament dat klopt

Je wilt vooruit met data en AI. Maar wel vanuit een omgeving waarop je kunt vertrouwen. Wij helpen je grip te houden, juist wanneer keuzes complex worden. Laten we samen kijken welke stap jouw organisatie nu verder helpt.

Isometrische illustratie van servers, cloudopslag en databeheer voor IT-infrastructuur