1

I have 2 separate projects in AzDo, project-1 contains repo to build docker image and tag it accordingly like 1.0.0 , 1.0.1 etc. and in another projects-2 there are 2 separate repos which uses these tags. currently this is manual in repos@project-2.

My question is how can I automate the process in AzDo, that means if there is a new tag for docker in repo@project1 then it will automatically build the repos in project-2 with this new docker tag.

e.g. currently project-1 has image:1.0.0 and this is used in 2 repos in project-2 manually referring to 1.0.0. Now I build a fresh tag in project-1 with tag 2.0.0, so how can I automatically build 2 repos@project-2 with this new 2.0.0 . Is there any link/signal from one build/release pipeline to another pipeline/project?

Any advice is greatly appreciated.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
change198
  • 1,647
  • 3
  • 21
  • 60

2 Answers2

1

The easiest way it will be to use pipeline triggers which allow you to trigger one pipeline after another. You may have an issue fetching docket image tag but simply you may resolve this by hitting your container registry.

Please check out also stages filter, maybe they will provide a value for your case.

In this sprint, we added support for 'stages' as a filter for pipeline resources in YAML. With this filter, you don't need to wait for the entire CI pipeline to be completed to trigger your CD pipeline. You can now choose to trigger your CD pipeline upon completion of a specific stage in your CI pipeline.

Another option will be to use webhook when your image is pushed to container registry and trigger another pipeline over REST API.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
1

According to your description, seems you are talking about two different team project.

Is there any link/signal from one build/release pipeline to another pipeline/project?

You want to trigger a pipeline in another team project.

In the classic editor, pipeline triggers are called build completion triggers. You can select any other build in the same project to be the triggering pipeline.

Thus you have to specify pipeline triggers directly within the YAML file instead of configuring build completion triggers in the UI.

# this is being defined in app-ci pipeline
resources:
  pipelines:
  - pipeline: securitylib   # Name of the pipeline resource
    source: security-lib-ci # Name of the pipeline referenced by the pipeline resource
    trigger: 
      branches:
      - releases/*
      - master

To trigger a pipeline upon the completion of another, specify the triggering pipeline as a pipeline resource.

Note: If the triggering pipeline is in another Azure DevOps project, you must specify the project name using project: OtherProjectName.

More detail sample and limitation refer: https://stackoverflow.com/a/61398607/5391065


For Classic editor, you need to use some 3rd-paty extension such as this one--Trigger Azure DevOps Pipeline, it's able to select other project where the pipeline resides.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • yes, you are right, I'm referring to two different team projects. I think your suggestions looks promising, I will give it a try and let you know. Thanks. – change198 Aug 27 '20 at 06:36
  • 1
    Hi change198, Thanks for your quick response, forget to add one important part. If the triggering pipeline is in another Azure DevOps project, you must specify the project name using `project: OtherProjectName`. For more information, see [pipeline resource](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema#resources-pipelines). Have updated. – PatrickLu-MSFT Aug 27 '20 at 06:44
  • Trigger pipeline is exactly what I wanted and it's working just as fine. But now comes another part how can I consume the artifact created `project-1` in `project-2`? Let's say I have a `snapshot-1.0` version from `project-1` from my feature branch and when it finished it, triggers a repo from `project-2` I wanted that repo in project-2 is considering the snapshot-1.0. Is there any way I can retrieve this artifact information? – change198 Aug 31 '20 at 22:07
  • @change198 It seems [**Download Pipeline Artifacts task**](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/download-pipeline-artifact?view=azure-devops) which used to download pipeline artifacts from earlier stages in this pipeline, or from another pipeline, will be helpful in this situation. Also take a look at artifacts part of SijuMathew's answer: https://stackoverflow.com/a/59534724/5391065 – PatrickLu-MSFT Sep 01 '20 at 09:47