I have a build configuration that is triggered on a schedule (nightly).
It is marked to only execute when there are pending changes.
The VCS root that is attached to this build configuration is set to monitor a bunch of different git branches:
Notice that the default branch is 'integration', which has no changes, but other branches do have changes. I would expect the build to trigger using the branch with the pending changes, and not using the default branch, which has nothing new on it.
Why is the build triggered on the wrong branch then? did i configure something wrong ?
Could you try this?
Triggers -> Schedule Trigger -> Additional Options -> Show Advanced options
Add the branch specification:
Related
I have 2 CICD pipeline (Build A & Build B) based on the branch X. However I would like to make sure only Build A is triggered every time there is a pull request.
Yes, I can disable the pipeline from triggering changing the settings like this, however if I do that I cant manually trigger the build.
Is there a way to disable automatic trigger yet keep the option of manually triggering open?
I have 2 CICD pipeline (Build A & Build B) based on the branch X
Agree with Krzysztof Madej.
If you create pull request and the build B is automatically triggered. We could set pr: none or check the branch policy Build Validation
if PR is completed and the Build B is automatically triggered, we could set trigger: none to disable the CI Trigger.
Yes, of course you should set pr: none. Please check PR triggers here
In the same way you can control CI triggers
I am not able to find a way to stop the auto triggering of the pipeline whenever I push code to bitbucket.
My assumption is that you want more control over when your pipeline does certain things.
Rather than achieving this through stopping the pipeline from getting triggered, I'd recommend using either stage transitions or manual approvals to achieve this control inside the pipeline.
Stage transitions are better when you want to "turn off" a pipeline and have the latest thing run through when you turn it back on.
Manual approvals are better when you want the version to be locked while waiting for approval so you can run tests without worrying that the version will change.
You mentioned in your comment that you wanted to only run your pipeline at certain times, so a way you could do that is to enable and disable the stage transition after source on a schedule.
https://docs.aws.amazon.com/codepipeline/latest/userguide/transitions.html
https://docs.aws.amazon.com/codepipeline/latest/userguide/approvals.html
You can disable DetectChanges parameter on your Source action as explained here. Extract with the relevant context:
DetectChanges: Controls automatically starting your pipeline when a new commit is made on the configured repository and branch. If unspecified, the default value is true, and the field does not display by default.
This works on Bitbucket, GitHub, and GitHub Enterprise Server actions. I have a CloudFormation template configured with this option and works. Not sure about the same option on AWS console, because I saw that some configurations are only available from CloudFormation or aws cli. As you can read "this field does not display by default".
I have created a build pipeline.
have master, develop and feature/* branches in my Azure repo.
I have created a branch policy to require a build for feature/* branches.
How do I trigger an automatic build on pull request? Or even how do I queue a build manually on the pull request?
I can't see such option on my pull request screen in DevOps.
As far as I know the build policy should appear above Work Items on the right hand side. My policy does not appear there and I have no even a possibility to trigger the build manually.
I am not sure what I am doing wrong? Or what is missing?
The screenshot you provided shows that the PR is for the develop branch. If you want a PR for develop to trigger a build, then set a policy on the develop branch.
Branch policies apply to the target branch, not the source branch.
I have a YAML build definition in VSTS working fine for some times.
I recently started to tag my repo from my release definition using this task.
It is working pretty fine, except that each time this task add a new lightweight tag to my repo, it also trigger my CI on that tag. The branch associated to the build is refs/tags/mytag.
I tried to prevent that behavior by adding trigger branch filter in my YAML definition:
trigger:
branches:
include:
- master
- release
exclude:
- refs/tags/*
But my build is still being triggered.
Any idea about how to prevent triggering a build definition when creating a new tag?
Note
I also tried by creating a Tag myself from the VSTS portal (which in that case is NOT a lightweight tag). The build is still being triggered, but in a different way because it is failing with error message Expected a Commit, but objectId f768714f0bac926164dea5b77e696da7a73db426 resolved to a Tag.
Also the version string is not properly computed in that case and result in a simple int instead of my formatted version string.
For now, there has no options to specify tags include/exclude to trigger the CI build.
And there has the user vice Trigger build when pushing tag to git which suggest the feature to specify tags in CI build, you can vote and follow up.
The workaround for now is override YAML Continuous Integration trigger from Triggers Tab:
In your YAML build definition -> Triggers Tab -> Override YAML Continuous Integration trigger from here -> Include the branches you want to trigger the branch (master and release branches for your situation) -> Save build definition.
Now only commits are pushed to master or release branch will trigger the CI build, and tags creation will not trigger CI build.
Im trying to figure out how to chain multiple 'promotions' (by a user clicking) whilst ensuring that ever build in the chain is not queued. By current setup is as follows, NOTE as my application is a white label the configuration described below is repeated for every site.
Build & Test - Creates zipped artifact
Deploy to Testing - Has artifact and snapshot dependency
Deploy to Staging - Has artifact and snapshot dependency
Deploy to Production Has artifact dependency
When promoting to production i want to do this across all websites (without having to manually click promote on each build).
I am currently trying the following strategy, to set the 'deploy to production' build to have a Artifact dependency, without a snapshot dependency so it doesn't queue down the chain. I have set the artifact to depend on the 'Build & Test' configuration to gain access to the zipped project and i have set it to build with a specific build number referencing a parameter in the production build.
After doing some googleing i found out that i am able to get the stagings build number using the rest api as follows:
http://teamcity_url/httpAuth/app/rest/builds/buildType:build_configuration_id/resulting-properties/build.number
And this works great, however i don't understand how i can get this value into the parameter?
Also i dont know if my approach is correct? is there a better way?
Set up the artifact dependencies chronologically (Build -> Test -> Staging -> Production) and all your snapshot dependencies to Build & Test. Depending on exact needs you might have a snapshot dependency on both Build and the one your artifact dependency is on.
Also make sure you enable "Do not run new build if there is a suitable one. This should keep it from queuing down the chain without intention.
Using the build chain tab will be important because the main project page only shows the last build ran. So clicking run from there will que the chain because you are asking for a new build, even though to you it might feel like your asking for the next step to be ran. The build chain tab helps keep things clear.