I have a PR checker triggered when someone creates a pull request in Github. My yml file is on GitHub and the pipeline is on Azure DevOps. So, here is my trigger:
PR check
pr:
branches:
include:
- main
paths:
include:
- src/Web
trigger: none
But, when someone makes changes in other directories that are not included in the path above, let's say in src/API or docs it triggers the pipeline and runs a build check. It's not supposed to be checked as I have another pipeline for it.
Can someone point out where the error is?
Related
trigger:
branches:
include:
- master
tags:
include:
- Showcase
pr:
branches:
include:
- master
the code above is from my yaml azure pipeline with using bitbucket repo. Anytime I do a PR in my bitbucket repository I expect build pipeline to run automatically in azure devops but it's not the case. Currently, I have to run the pipeline manually to complete PR validation. creating pipeline with the same line of code under another repo works correctly. I'm not sure what the problem is.
I created anoter dummy pipeline with a new project, the pr triggered build automatically when pr to the the master. the webhohook seems to be working fine. the trigger option doesn't override the yaml pipeline. I can't think of anything else to check.
am experiencing an issue with the Azure pipeline wasn't triggered when the PR moved from draft to open
Here is the yaml configuration I used:
trigger: none
pr:
drafts: false
branches:
include:
- main
- hotfix/*
does anyone has idea what is going wrong with it?
I've got a problem where I cannot get my pipeline to run when I want it to.
Background
I have a repo in GitHub, and I'm running my pipelines in ADO.
I have two branch - main branch, feature branch.
I want a pull request to trigger a pipeline called "pull-request" when I make a pull request in github.com. I want the pipeline to exclude any changes that happen to a file called azure-pipeline-pull-request.yml (which is the pipeline file).
I don't want it to run any other time.
I have tried many different combos in the yml file, but I cannot get the pipeline to run when a PR happens.
This is the code at the top of the YAML file.
trigger:
branches:
include:
- main
paths:
exclude:
- azure-pipelines-pull-request.yml
pr:
branches:
include:
- main
paths:
exclude:
- azure-pipelines-pull-request.yml
I've tried it without the trigger section. I could do with some help in explaining what is happening.
I tried your code and successfully triggered the pipeline to run. So some other reasons caused the pipeline not running automatically instead of your script.
There are several possible reasons for the issue. Click I just created a new YAML pipeline with CI/PR triggers, but the pipeline is not being triggered. for detailed information and steps. Here is a brief overview of the content of the document:
Go to "Triggers" in UI. Turn off the "Override the YAML trigger from here" setting.
Check whether your Github repository is connected to multiple Azure DevOps organizations. If so, remove the service connection and re-establish it.
Check whether there is a failure in Webhooks in Github.
Make sure that the YAML file in the correct branch has the necessary CI or PR configuration.
Did you use templates for your YAML file? If so, make sure that your triggers are defined in the main YAML file.
I'm working for the first time with Azure Devops Pipelines. I'm using a .yml file. But I can't figure out why the pipeline won't run when I checkout and push a branch from develop to "releases/*. It just won't trigger even when there are changes in src/ which are inside my new releases/newbranch
But when I merge my change from "customers/feature-branch" with customers/moa-prototype-client1/release the pipeline will run.
My trigger is:
trigger:
branches:
include:
- customers/moa-prototype-client1/release
- releases/*
paths:
include:
- src/*
- src/customers/moa-prototype-client1/*
exclude:
- '*.yml'
- src/customers/*
What can cause this?
So in short: It will trigger when I merge from Customers/Customername/Develop to Customers/Customername/Release. But won't when I merge from Develop to Releases/*
Our repo:Gitflow
From your description, it seems that this issue exists in the Release/* branch. And the customers branch could work as expected.
During my testing, I encounter a similar situation. If the Release/* branch doesn't contain the Yaml file with triggers, the changes in the release branches will not trigger the build.
For example:
Doesn't work
To solve this issue, you could copy the same yaml file from other branches to all release branches.
Then the changes in the Release branches could trigger the build successfully.
On the other hand, as Kontekst said, the Path filters are case-sensitive. You could check them at the same time.
Hope this helps
Solution: After checking the links and possible solution some users suggested, I got it to work. But I was not totaly happy whit this fix, because I wanted to run my pipeline though my .yml file and not override my triggers though the pipeline settings.
When I looked at my .yml again and noticed a space behind releases/*, I removed this space and committed this to my repo and all was working as it should!
I'd like to push the build status automatically from Azure Devops to the github repository, so that pull requests can check for a build success before they can be merged.
I realise this can be done writing some custom code and calling the github status api, but there is a checkbox for it in the edit pipeline stage. It doesn't seem to work with Github though. See this image .
Other build tools like Bamboo have an out of the box plugin for doing this.
You need to define branch policy. You can read about this on my blog. You need to selected existing pipeline here in GitHub settings:
and then when you make PR you will get this:
You need to correctly define trigger options in your yaml file. For isntance:
this will run for all non master branch (with each commit pushed to GitHub pipeline will run)
for each merge to master will trigger pipeline too
trigger:
branches:
include:
- '*'
exclude:
- master
pr:
branches:
include:
- master
paths:
include:
- gated-checkin/*
exclude:
- gated-checkin/azure-pipelines.yml