Search code examples
azure-devopsazure-pipelinesazure-pipelines-yaml

Azure DevOps YAML - can I trigger a job on another agent?


Currently my DevOps pipeline uses two servers to run things in parallel:

jobBuildAll on server 1:

  • build Debug version
  • run all unit tests

jobBuildAll on server 2:

  • build Release version
  • run static code analysis

It's a large Windows C++ project, each server is busy for over 8 hours - the debug build takes around 2, and the unit tests 6 hours, the release build 4 hours, with another 4 hours for the static code analysis.

I also have to run functional tests on a dedicated third server, they take around 6 hours.

What I would like to do is:

  • Publish the subset of artifacts required for the functional tests, as soon as they are built (1 hour)
  • make that trigger jobFunctionalTests on server 3, to run those tests in parallel with the unit tests on server 1, and the static analysis on server 2.

As far as I know there is no "official" way, is there any, however unofficial, to achieve the this?


Solution

  • The artifacts required for the functional tests are executables, and DLLs generated during the debug build.

    Your debug build takes around 2 hours, but the artifacts required for the functional tests are built in 1 hour which is less.

    Hence, if you would like to publish artifacts and trigger function test job as soon as they are built, you could consider below options:

    1. If possible, split the debug build task to two or more jobs, if your artifacts are generated in job1, then function test job are dependsOn the job1. Once artifacts are generated when job1 complete, the function test job will start.

    2. The other option is you can consider to put the functional tests in a new pipeline. As you are using local agent, you can generate artifacts to a new folder wher the new pipeline is monitoring, the change will trigger the function test pipeline.

    3. Similar as option2, you can generate the artifact in specific stage in 1st build, and in new pipeline, use Resource pipeline completion trigger to monitor on the stage, once it's completed, trigger the function test pipeline.