I want to trigger a build in Teamcity by doing a manual action(not a commit or pullrequests). Like if i click a button in github it should trigger a build config in teamcity or something similar(by passing the branch). I dont want the process to be automatic for every commits, instead just manually trigger for custom branches.
If there is a possibility for this, pls let me know as it would be much helpfull..
Thanks in advance!
Yes you can do that by leaving your Triggers menu empty...
Go to Build --> Edit settings --> Triggers and make shore that there are no triggers. You can alway manually run build by clicking on icon RUN
If you want trigger just for couple of branches you can add trigger to your VCS like this
so my list contains branches develop, qa, release and master and rule +:*/merge is for every open Pull Request
Related
Is there a way I can set up a build in Azure DevOps to automatically run every time a PR is merged and completed and contains a specific keyword in the name? for example: "Some PR name here [RUN_BUILD_123]"
Edit:
The reason for this is because I have different builds on top of the same branch so instead of triggering all the builds I just want to trigger those that I know need to be rebuilt based on the particular projects getting changed.
A PR has a target-branch. If you want to trigger a build after a PR is completed just configure a build with a ci-trigger for that target-branch. You can't check for certain keywords in the PR-name unfortunately
Agree with D.J. For detailed setting, you can check the Enable continous intergration option in the Triggers settings, then select the target branch you want ci-trigger build in the Branch filters.This will automatically trigger the build after pr is completed.
But you can't do it if you want to include special keywords in pr name.
Topic is a bit old, but if there is anyone who want's to archive this stumbling over this topic - here is my approach how I would solve this:
The basic of all are scripted pipelines, so if you still do it in the GUI - that's wasted time. Create a .yml build and put it into your Git. The M$ documentation is really helpful with this.
Create the trigger for your branch
Put this on the first line, so the pipeline will be executed when master (or your branch) has a new commit
trigger:
branches:
include:
- master
Read out the commit message via the VSTS variables
Trigger the builds, based on their ID via REST API (you can use the pipeline token for authentication)
In our Azure DevOps Build pipeline, I set "Enable continuous integration" to true, and set a filter to include only feature branches.
This is working fine as expected - a build kicks off every time a user pushes changes from the local to remote feature branch.
The only issue I see is on branch creation - when a user creates a new branch from within their work item in the online DevOps in the Development pane, it triggers a new build as well. The branch is Based on "Development" branch, in pic above.
How can I avoid a build on branch creation, and only have a build when changes are checked in?
How can I avoid a build on branch creation, and only have a build when changes are checked in?
I am afraid we could not achieve this at this moment. That because this is the current Azure Devops default design behavior, all files and paths in this branch are "new", which is also seen as a new change.
You can submit a user voice here:
https://developercommunity.visualstudio.com/content/idea/post.html?space=21
How to avoid a build on new branch creation
The workaround for this issue, you can create the Development branch with following construction Development/Test01:
Then set the Branch filters like Development/*:
Manually add in the textbox that allow you to "Filter my branches" and press Enter button:
Then if you create a new branch based on 'Development/Test01' branch, like 'Development/Test02':
The new created branch will not trigger a new build.
Hope this helps.
I have branch validation in the form of a PR Build, which means I have duplicated my original build and removed some steps (such as pushing to my docker registry).
I would prefer to simply be able to automatically add a tag / some kind of identifier to a PR build and exclude the step on the original build using custom conditions.
Does anyone know if this is possible, and if so how to achieve it? I'd really rather not duplicate each and every build.
If I understand your question correctly, you would like to run a build step based on a custom condition. In this case, the custom condition is whether the build is a PR build or not.
You can check the pre-defined build variables available in Azure Devops here and you can see that there is a Build.Reason variable.
I am listing a few variables here.
Manual: A user manually queued the build.
IndividualCI: Continuous integration (CI) triggered by a Git push or a TFVC check-in.
PullRequest: The build was triggered by a Git branch policy that requires a build.
You can specify the condition in custom condition settings of your build step like this.
More examples available in the docs
In VSTS online, I have in my Release process (Under Triggers) the Continuous Deployment checked. On the Set trigger on artifact source, I put a Tag condition (with tags) set to Automated.
I also have a tag in the Build Process. (Correctly adds the Tag to the build)
But my release is not triggered automatically? In the Deployments status (In my Build) it says "Tags set for release trigger did not match the tags in build branch". But they match (See pictures). What could be the issue?
This is because you added the tag Automated after the build is finished (by label source or manually). This can’t trigger CD release. Tags should be add during a build (not a build is finished). So you can add a power shell task with inline script in your build definition:
Write-Host "##vso[build.addbuildtag]Automatd"
Then the release will be trigger after build is finished.
I do this a different way very similar to:
How to trigger VSTS build and release when pushing tags?
In my Release Pipeline I add a branch filter to 'refs/tags/' or 'refs/tags/v' for the Continuous Deployment Trigger, or anywhere else where I want to filter action in my Release Pipeline. The good thing is that you can apply your Git Tag AFTER your build is complete, just like you prefer. This is optional, but I use Git in conjunction with GitVersion.
Also, please be aware that Git Tags and Build Tags are not the same. Git Tags are stored in the Git repository while Build Tags are associated with a VSTS/Azure build summary. Don't get confused with the two.
For future readers it looks like you can now trigger a release even when a tag is added to a build at any time (not just during a build).
Create a release when tags are added to an existing build. Upon enabling this option, a release gets created when tags are added to an existing build that has not been released. This could lead to deployment of an older build to the environments.
In my Teamcity build configuration I have three VCS configured:
If any of those would have a check-in - the trigger would fire and my build would be running.
What I need to know - which from those repositories had fired the trigger.
What I can know is the type of the trigger event: echo %teamcity.build.triggeredBy% (in case if the build was triggered automatically it would say "GIT") , however, I don't' see any option to know which VCS had triggered the build.
Any thoughts how this could be achieved?