VSTS continuous integration triggers not working - azure-devops

I'm pretty sure this setup was working at one point for us. I changed our builds a bit to reflect some operational changes and now the CI git branch trigger isn't working. I'm trying to get it so when a PR is merged into master it triggers the release build. I can trigger this build manually but not when submitting a PR to master from dev and then accepting the PR (on github).
Is anyone else having issues or know whats wrong?

Adding an answer so this more visible. #starain-MSFT comment was the solution.
I added a new build with the same trigger and it fixed the other one not getting triggered. Then deleted the new build I had added and everything is working.

Cloning my build definition didn't work, unfortunately, and neither did saving a trivial change to the build definition. Instead, I had to explicitly disable the CI trigger, save, then re-enable it and save it again. (Annoying, because I had to redefine all the rules.) But give it a try if the accepted answer doesn't do it for you.
I also wonder if adding a random branch to the triggering branches list, saving, then removing the random branch and saving again would work (and save you from having to redefine everything).

Related

VSTS build step changes log trails

In VSTS builds, is there a way I can know who have make changes in build steps?
Can I get history builds?
The reason for this is, we have a big team. Many time it happens that someone changes the build step for some reason and we never know who made the changes and why.
Like in git repo, we know which file is changed by who and why (in comments).
In VSTS builds, is there a way I can know who have make changes in build steps? Can I get history builds?
The answer is yes. You could check the History of the build definition:
Click on the three horizontal dots and we will get an option compare difference, through which we can know the details of the pipeline modification. If the modifier adds a note when saving the modification, we can also know the reason for the build pipeline modification.

First build with Azure Devops

I'm running builds with AzureDevops piplines. When I'm creating new pipline I'm not queueing it and just saving. If CI trigger is selected pipline will run if anything is checked in.
But on the very first run/chack-in pipline will be liked (associated) to ALL check-ins (changesets/commits) that happened before the current one and to all workitems of those chack-ins.
This behaviour is not desired for me. Is there a way to disable it?
On all subsequent check-ins build will be associated only with the one that triggered the pipline. And this is what I want for the first build as well, for it to be associated only with the chack-in that triggered it.
Without seeing exactly what's happening, it's hard to provide advice. It could also behave differently if you're using Git or TFSVC variants. Here's a few things to try:
Disable the CI trigger, do your first check-in, then re-enable the trigger. That might skip the change-set and work item affiliation one time.
Delete the offending build after it runs or do the laborious task of manually deleting all links in it.
If you're using Git, you can also limit the CI trigger by using a Pull Request with Squash merge. This will consolidate the commits down to one.
There isn't the way to disable it. It would compare previous run, then include all changesets between them. So, for first run, it must includes all previous changesets.
You may create a new branch for a folder, then configure build for that branch. Learn about branching strategies for Team Foundation Version Control (TFVC) and how to select an effective strategy

in Azure Devops, how to apply automated build to existing pull request

I have an existing pull request that I would prefer not to have to abandon and restart. There was no automated build set in the branch policy when the PR was created. However, I have since linked an automated build. Is there a way to make this change to the branch policies take effect without abandoning and recreating the PR? I've already shared and posted the link for the PR, so I was hoping I could seamlessly make this change apply.
Thanks!
It appears if you just abandon your pull request then reactivate it right away, that makes all new branch policy changes apply.

VSTS - Continuous Delivery - Release Trigger not working with tags

UPDATE 2017/02/28
The tags in the release triggers are not source control tags, they are tags that can be generated by your build step. You can tag your builds automatically (see below), or manually during a build, I haven't tried this yet.
My assumption about the tags were flawed, which makes this question pretty much invalid. However I am going to try and see if I can find some sort of workaround for my exact scenario, and then I will post it here.
Background
I am setting up our CI/CD pipeline using VSTS, and part of our branching strategy is that only release/* branches that are tagged will be deployed to production.
Problem
I am trying to trigger a release using the VSTS Continuous Deployment feature, which should be able to work with branches and tags. At first I tried this, thinking that I could use a wildcard for everything:
Attempt 1
The trigger never worked, so I decided that it is probably not supported (because I can't find any documentation around it). So I tried an explicit tag.
Attempt 2
That didn't work either, so I decided to abandon the release/* wildcard altogether and just attempt it with a specific release branch.
Attempt 3
Still didn't work. I am either missing some really important steps here, or it is broken. Please help.
PS - For every attempt, I made sure that I committed a new file in git, tagged the commit, and kicked off a new CI build.
PS - Specifying a wildcard for branches like release/* works perfectly, as long as you leave the tag field empty
It is filtered by the build tag instead of source tag/label.
For example, a release definition CD with myTag filter, then the corresponding new build need to have myTag.
To add the tag to build, you can refer to these steps:
Edit your build definition
Add PowerShell step (Inline Script: Write-Host "##vso[build.addbuildtag]myTag")

Stop Jenkins from Looping due to push trigger

My goal for Jenkins is to trigger a build from a github branch automatically, build the application, make a update to the source and then push the source update to the same branch.
All is working except I find myself in a loop. I'm using the build trigger "Build when a change is pushed to GitHub".
When I push the update to the same branch from within the job, it then triggers the build again putting the whole process into a loop.
What I'm looking to do is somehow put this trigger on hold until the whole job is complete.
(I happen to be building an xcode project and updating the build version number in the plist... not sure that is directly relevant to the problem at hand)
When I push the update to the same branch from within the job, it then triggers the build again putting the whole process into a loop.
Then it would be best to push to a different branch, considering that, even if the GitHub webhook fires again, at least it will fire a JSON payload, with, for the push event, with a different branch name
ref string The full Git ref that was pushed. Example: “refs/heads/master”
By checking the name of the branch push in that payload, you will be able to avoid the loop.
I found myself in the same conondrum, and found the answer:
https://liviutudor.com/2015/12/09/jenkins-ci-trick-to-prevent-task-from-triggering-itself-on-scm-commit/#sthash.j7YTr3l0.dpbs
Basically you can choose the option "Polling ignores commits from specific users", and add your bot's username =]
Simple & elegant