azure-devops-cli-extension icon indicating copy to clipboard operation
azure-devops-cli-extension copied to clipboard

Azure pipelines job dependsOn are not explicit

Open moerketh opened this issue 2 years ago • 0 comments

As a learning experience I have cloned this project to Azure DevOps and found inconsistencies in the Azure Pipelines.

The pipelines break when only a single build agent is available because the job order is not explicit. From what I have seen mostly "Run_Style_Check" is run before the builds artifacts are created in the jobs 'Build_Publish_Azure_CLI_Test_SDK' and 'Build_Publish_Azure_DevOps_CLI_Extension' fairly consistently. Here is a screenshot to illustrate: image

For example in azure-pipelines-merge.yml: job: 'Run_Test_Mac_Azure_CLI_Released_Version' should depend on both dependencies but has one. job: 'Code_Coverage' should depend on both dependencies but has one. job: 'Run_Style_Check' is missing depends on for both jobs job: 'Run_Test_From_Old_Release' should depend on both dependencies but has one.

Same for other pipelines.

This dependsOn is required because the templates/download-install-local-azure-test-sdk.yml and templates/download-install-local-azure-devops-cli-extension-with-pip.yml are directly or indirectly used by the jobs. Both jobs download artifacts created by referenced jobs.

You have probably never encountered this because you have multiple build agents available and the reference build tasks complete quickly, before any build artifact downloads are executed. This may still break when the build and\or upload process is delayed or when less build agents are available. Anyways, I think it the job order should be made explicit in the pipeline yaml, so logging this issue for you to consider.

I can send a PR for the dependsOn fixes if needed.

A more DRY solution could be to use stages, for example "build" and "testing" or to use a job template (with it's dependencies included in the template) instead of a steps template. But that might require more changes to the pipelines than strictly needed to fix this.

moerketh avatar Feb 07 '22 18:02 moerketh