I've tried multi repo trigger using azure devops.
resources: repositories:
- repository: ToolsRepo
name: ToolsRepo
type: git
trigger:
batch: true
branches:
include:
- master
trigger does not work. It works only if I remove batch: true line. How could I make it work together with batching?
According to the test result, if you set batch: true to other repos (not the repo where the current yaml pipeline file is located), then CI trigger from other repos will not trigger the pipeline.
The CI trigger from the current repo can trigger the pipeline normally.
So I am afraid that batch: true is currently not supported in multi-repo trigger. In addition, the batch argument is not specified in the multi-repo trigger yaml syntax.
You could add your request for this feature on our UserVoice site, which is our main forum for product suggestions. The product team would provide the updates if they view it. Thank you for helping us build a better Azure DevOps.
Related
I have a website project with two pipelines
1.- PROD pipeline, which is triggered on every master branch push. This builds the site, deploys it and sends an email to the whole company informing about the new version. This works perfectly so far ✅
2.- DEV pipeline: should be triggered on a push to ANY branch that is not master. Builds the site, deploys the site to a DEV stage and sends an email to the author of the commit.
Following the docs, this trigger configuration should trigger the DEV pipeline on all branches but master.
trigger:
branches:
exclude:
- master
include:
- '*'
However, if I then try run the pipeline in any branch that is not master, I get the following error: Encountered error(s): Could not find valid pipeline YAML file for this branch/tag
How can I setup the pipeline, so that it gets triggered by all branches but the master branch?
Thanks in advance for your help!
D
You have to have the YAML file in every branch you want it to trigger for, you cannot just have it in the master branch and expect it to trigger on another branch.
I am trying to extend a template on a Azure DevOps pipeline which exists on a repository hosted on Azure Devops. Code looks like below.
resources:
repositories:
- repository: devops
type: git
name: otherProject/repositoryXYZ
ref: main
parameters:
- name: environment
type: string
values:
- "UAT"
- "Production"
default: "UAT"
trigger:
- none
pr: none
extends:
template: folder/template.yml#devops
parameters:
environment: ${{ parameters.environment }}
When I deploy this pipeline on the same project on which repository repositoryXYZ exists, I get a successful run.
For example I have a project A which holds 5 pipelines. One of the pipelines is the above and can download the repository and run successfully. This pipeline exists in project A where repositoryXYZ is located.
When I deploy the same pipeline from a different project project B within the same Azure Devops organization, I get the below error.
/azure-repo.yml: The repository DevOps in project f1809f72 could not be retrieved. Verify the name and credentials being used.
The id of the project on the logs is for project B. (f1809f72).
I tried to alter DevOps repository permissions and to append project
build collection administrators full access. (repositoryXYZ)
Then I tried to place the repository on github and I got the same
issue (added a PAT and changed the directories for the repository)
I also tried to edit project settings and deactivate the limit jobs
options. (all limit job aithorization settings have been deactivated for both projects)
Do I miss something? How can I use my pipeline to extend the template which will be downloaded from an Azure Devops repository of another project within the same devops organization?
The pipeline cannot start running at all, so I guess something should be wrong with the permissions.
My error was the referencing repository on the template.yml file. On the build pipeline I was pointing the correct repository, but on the template I was pointing a false one that could not be retrieved. I corrected that and I was able to trigger the pipeline.
My current implementation of Azure pipelines is to trigger only when a pull request is made to Develop branch. But, I want to run the pipeline on every new push on any branch. How to trigger that?
My current implementation of the Azure YAML file
trigger:
- none
pr:
- branches:
include:
- dev
and below that steps are configured.
You need to specify the trigger something like this. So for example, if there is anything pushed in dev branch a build will get triggered. Ref
trigger:
- dev
or to be more explicit:
trigger:
branches:
include:
- dev
- another-branch
If no triggers are specified it will by default run for all branches. It can be explicitly defined as:
trigger:
branches:
include:
- '*'
In my case, using Azure DevOps, I have this on my .yaml file:
trigger:
- '*'
pool:
vmImage: 'windows-latest'
So, it gets triggered no matter to which branch I'm pushing to.
I hope it might help.
Note: the pool part is not relevant; I just added to give more context.
If you have git and a repo created in your project, you can easily connect git to azure dev ops. So let's say you want to deploy every push you give to the master branch of your repo. You can connect your master branch to the azure DevOps so it deploys it automatically.
This link will provide additional information
I have checked this link Azure DevOps: 1 Solution Multiple Projects CI/CD which is related to one solution with multiple project.
Can we use multiple solution in single CI CD pipeline ? where we have different artifacts for each solution and app servers to deploy.
Please advise.
As long as the code is in the same repository there are no issues to using multiple .net solutions or any other type.
You can also publish multiple artifacts from the same pipeline
If you are using YAML pipeline, you can check out multiple repositories in your pipeline.
Pipelines often rely on multiple repositories. You can have different repositories with source, tools, scripts, or other items that you need to build your code. By using multiple checkout steps in your pipeline, you can fetch and check out other repositories in addition to the one you use to store your YAML pipeline.
Repository declared using a repository resource :
resources:
repositories:
- repository: MyGitHubRepo # The name used to reference this repository in the checkout step
type: github
endpoint: MyGitHubServiceConnection
name: MyGitHubOrgOrUser/MyGitHubRepo
- repository: MyAzureReposGitRepository
type: git
name: MyProject/MyAzureReposGitRepo
steps:
- checkout: MyGitHubRepo
- checkout: MyAzureReposGitRepository
Repository declared using inline syntax :
If your repository doesn't require a service connection, you can declare it inline with your checkout step.
steps:
- checkout: git://MyProject/MyRepo # Azure Repos Git repository in the same organization
For details ,please refer to this official document.
When defining a GUI release I can make it be triggered by an Azure Artifact, is there a way to replicate this for pipelines in YML?
I am building in one AZDO tenant, pushing universal packages to another tenant, where the release definitions will be defined, I'm hoping this can be in YAML. But I don't see an obvious way to do this at the moment?
I see there is a design document that makes mention of packages, but no further details are provided
https://github.com/microsoft/azure-pipelines-yaml/blob/master/design/pipeline-resources.md
Cheers
Edit-
Is there a way to trigger pipeline using Azure Artifacts in YML?-But I don't see an obvious way to do this at the moment?
Yes, Yes. You are right !
That because the content in this document are speculative, designs, and future features.
If you check the upper level of design document you provided, there is a state:
Azure Pipelines YAML - Design Docs
The design docs within this repo are created at different times during
the development of Azure Pipelines, to support collaborative
contributions to the design process. Designs documents are for,
features considered for implementation but never implemented
already implemented features
future ideas for features
The design docs in this repo may not represent the current state
of an Azure Pipelines feature.
When you check the officially release document YAML schema reference-Resources, it only list:
resources:
pipelines: [ pipeline ]
repositories: [ repository ]
containers: [ container ]
So, Azure Artifacts source in YAML should be a future feature at this moment. Hope MS can achieve it one day earlier.
Hope this answer clear your question.
Build completion triggers are not yet supported in YAML syntax. After you create your YAML build pipeline, you can use the classic editor to specify a build completion trigger.
Reference:
https://learn.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=azure-devops&tabs=yaml#build-completion-triggers
Though i would suggest you to use below mechanism to trigger the release:
Resource triggers
Resources trigger will be helpful in below scenario:
I would like to trigger my pipeline when an artifact is published by ‘Helm-CI’ pipeline that ran on releases/* branch.
I would like to trigger my pipeline when an artifact is published and tested as part of Helm-CI pipeline and tagged as 'Production'.
I would like to trigger my pipeline when ‘TFS-Update’ pipeline has completed ‘Ring2’ stage so that I can run some diagnostics.
https://github.com/microsoft/azure-pipelines-yaml/blob/master/design/pipeline-triggers.md
Webhook triggers
At the end of the CI piepleing , you can add a task to hit webhook url which can trigger your CD is one way.
Hope it helps.
You can use a multi-stage pipeline to achieve this.
One stage would include a task that will push your artifacts to the feed. The next stage will contain other jobs that you want to be executed after pushing the Artifacts.
eg:
stages:
#Stage for preparing the Artifact
- stage: prepare
jobs:
- job: prepare
pool:
vmImage: xx
steps:
- task: PublishBuildArtifacts#1
inputs:
pathToPublish: xx
artifactName: xx
# Next stage in your pipeline
- stage: build
dependsOn: prepare
jobs:
steps:
- task: xx
Note that the second stage build dependsOn the stage prepare.
ps: Multi-Stage pipeline is currently under preview. If you enable it from the preview feature, you will also be able to see a nice visual representation of the stages.