We are using TeamCity Enterprise v.9.1.1
Is there a way to trigger some action after build is complete?
I have tried adding last build step but it executed before artifacts are published.
Update: I am not looking for deployment solution. I need a way to specify generic action on build completion.
There's no generic solution at the moment.
You might want vote for the Post build task feature.
Possible workarounds include:
adding dependent build configuration (using Trigger)
creating new TeamCity plugin (e.g. custom notifier plugin, such as teamcity-slack-integration one)
Related
I am working on TFS 2017 and using release pipeline feature.
I have enabled "Continuous Deployment" and as soon as a new artifact version is available it trigger the release pipeline irrespective of whether it is generated by shelveset or by main code but I need to trigger only when the artifact is generated by main code not by shelveset .
Please Note - I cannot write ne(variables['Build.Reason'],'Shelveset') in publish task of Build definition because the manual tester needs artifacts.
Any help is appreciated
Thanks
The following is a good approach to take in TFS, using the workflow and task-based approach. Basically, you are defining a tag when that is automatically assigned to a build when a build successfully completes based on certain conditions, in the below example only if a build is scheduled, but you can customize the condition to run on all build reasons except shelveset builds too if you want.
At the end of your Build Definition create a new task for "PowerShell Script" and in the Inline Script put in the following:
Write-Host "##vso[build.addbuildtag]TriggerRelease"
Further down go to the Control Options and change the "Run this Task" to custom tasks and put the following: More variables can be found here, this is the page that details the different build.reason variables that are accessible. The conditions and how to use them can be found here
and(succeeded(), in(variables['Build.Reason'], 'Schedule'))
We used to run XAML Builds, there you could start one Build from another, for example let a GC run an Integration Test workflow afterwards and so on.
In VNext there is no way to trigger other Buils.
How can we make this happen?
This Feature is under plan, but don't have yet.
Check this User Voice, and the QA on this website:
Can I chain builds so that one build triggers another?
Not yet.
You can use powershell for that task: more information
We are using Hudson for our builds and deploys. Currently we have four main jobs: BUILD, DEPLOY-DEV, DEPLOY-TEST, and DEPLOY-PROD.
The BUILD job is parameterized, so we can assign new version numbers and augment them with the BUILD_NUMBER managed by Hudson. This works very well. We also have a "nightlybuild" parameter that defaults to false. Our intention is to only set this via another Hudson job.
We are trying to have an automated NIGHTLY-BUILD job that first calls our BUILD job with the "nightlybuild" parameter set and once that is successful, call the DEPLOY-DEV job. We also want to call out to a SONAR job to analyze the code, but for this question, the 2-step solution is sufficient.
For the NIGHTLY-BUILD job, the only way to call a parameterized job that I can figure out is the post-build action of "Trigger parameterized build on other projects". I can't trigger off of the BUILD job directly because the "nightlybuild" default is false and I also don't want to trigger off any manula builds. I also have a NIGHTLY-DEPLOY that has a build trigger of "Build after other projects are built" on NIGHTLY-BUILD. Since these are both ultimately post build actions they trigger at the same time instead of consecutively.
Started by user anonymous
Triggering a new build of BUILD #49
Triggering a new build of NIGHTLY-DEPLOY #3
Triggering a new build of NIGHTTY-SONAR #3
[DEBUG] Skipping watched dependency update; build not configured with trigger: NIGHTLY-BUILD #5
Finished: SUCCESS
When I start the build, it completes in a few seconds and starts the BUILD and DEPLOY concurrently, so as a new version is building, the old version is deploying. Not what I want.
I looked at and downloaded the "Build Pipeline Plugin", but it looks like it just relies on the same post build actions for the automatic transitions and adds new functionality for manual transitions.
Does anyone have any suggestions on how to resolve this issue?
Use Parameterized Trigger plugin as a build step, not post-build step. Then it has an option to wait for the downstream build to complete.
Note: this works with Jenkins, I can't guarantee that this option exists in the Hudson version of the plugin.
I have project configured in Jenkins that polls an SCM and begins a build when a change is posted. There is a post build action to build another project. The question I have is, the project that is being built afterwards has its own parameters. How do I know which parameter is specified when the post-build action triggers? Right now if if I use 'Choices', is it just picking the first one? How do I have it pick other ones?
OK, let's take it one by one :)
If you want to see which parameter were used, You can install this plugin: Show Build Parameters Plugin
If you want to trigger a build with a specific parameters, use this plugin: Parameterized Trigger Plugin
The group that I work in has standardized on Jenkins for Continuous Integration builds. Code check-in triggers a standard build, Cobertura analysis and publish to an Artifactory SNAPSHOT repo. I've just finished adding a new target to the master build file that'll kick off a Sonar run but I don't want that running on every check-in.
Is there a way to schedule a nightly build of a specific build target in Jenkins? Jenkins obviously facilitates scheduled builds but it'll run the project's regular build every time. I'd like to be able to schedule the Sonar build target to run nightly.
I could, of course, create a separate Jenkins project just to run the Sonar target on a schedule but I'm trying to avoid that if I can. Our Jenkins server already has several hundred builds on it; doubling that for the sake of scheduling nightly builds isn't very desirable. I looked for a Jenkins plug-in that might facilitate this but I couldn't find anything. Any suggestions?
Here's one way to do it, if you are ok with triggering the build using cron or some other scheduling tool:
Make the build parameterized, and use a parameter in your build file to decide if the Sonar build target should run or not.
Trigger the build remotely by HTTP POST:ing the parameter values as a form to http://[jenkins-host]/jobs/[jobname]/buildWithParameters. Depending on your Jenkins version and configuration, you might need to add an Authentication Token and include this in your url.
Authenticate your POST using a username and password.
wget --auth-no-challenge --http-user=USERNAME --http-password=PASSWORD "https://[jenkins-host]/job/[jobname]/buildWithParameters?token=<token defined in job configuration>&<param>=<value>&<param2>=<value2>"
I am also looking for a solution for this. My current solution in my mind is to create 2 triggers in the regular build, one is the nightly build, another one is Polling SCM
In the sonar plugin configuration, it has the options to skip the builds triggered by the SCM change. Therefore, only the nightly build will start a sonar analysis.
I didn't get a chance to test it now, but I suppose this will work.
Updated on 12/19/2011
The above solution doesn't work if the sonar analysis is invoked as a standalone build step. To make the sonar analysis run conditionally, you could use the following 2 plugins:
Conditional BuildStep Plugin - this allows the sonar analysis to be run conditionally
Jenkins Environment Injector Plug-in - this allows you to inject the variables to indicate how the build is triggered.