Schedule Fortnightly Build in Bamboo - continuous-integration

I'm looking at automating the bamboo release in my team currently it is manually triggered. Releases happen every second Wednesday and a custom variable is set to signify this. If the variable is present an automatic merge to the release branch is triggered.
There are two issues I am running in to
There doesn't seem to be a way to schedule a fortnightly build in bamboo.
I don't see a way set a custom variable with a scheduled build. I just need some sort of flag to say this was the weekly build and not the automated build that happens on check in.
There are a lot of builds so I don't want to make an additional build plan for each plan.

It's possible to create Schedule trigger with cron expression. Try to use expression which executes your build on 1st and 16th day of month
1 1 11 1,16 * ?
There is no way to set variable value for scheduled builds

a) There doesn't seem to be a way to schedule a fortnightly build in bamboo.
You can use cron job expression for scheduling fortnightly builds.
b) I don't see a way set a custom variable with a scheduled build. I just need some sort of flag to say this was the weekly build and not the automated build that happens on check in.
You must be having some admin user which runs automatically triggered
bamboo builds. You can use Bamboo variable
{bamboo.ManualBuildTriggerReason.userName}. If this variable name is
equal to Bamboo admin user name then this build was triggered at
scheduled time. otherwise it was triggered by user/developer.

Related

Jenkins different schedule for different configurations

I am working with a multi-configuration Jenkins project. The two configuration axes are Win/Linux and 32/64-bit. I would like to build the primary configuration (32-bit Windows) whenever version control changes, but to only build the other configurations once weekly (just to make sure that they stay reasonably up to date).
Is it possible to achieve this schedule without breaking the project up into multiple individual projects?
Unfortunately not through Jenkins directly at this point AFAIK. There is only one time handler per job, and the multi-configuration is a single job, it has a single timer.
There is a hack, but it will be tough, and I'm not sure of the exact script required, but if you can check the day of the week, you could try something like this in your script:
if (day == Sunday |OR| $NODE_NAME == win32), then:
<carry out build steps here>
finish
This way:
If the day is Sunday, all steps will be carried out regardless of Node.
If the node name is win32, the step swill be carried out too.
However, if day is not Sunday and $NODE_NAME is win64 or linux32 or linux64, no steps will be carried out.
Note that $NODE_NAME is a standard Jenkins environment variable. However, this assumes that your build is done through either "Execute Shell" or "Execute Windows Batch"
Is there any reason the others shouldn't build at the same time?
You could create two jobs, one for your primary so it is a free-style job, and the other as a multi-configuration with Win64/Linux and leave that on a separate, weekly timer.
Please consider this:
Why not build ALL available configurations EVERY time?
- after all, that is the whole idea of Continuous Integration...
Can drop the artifacts of those builds after a short period of time,
so they don't clog your disk, but if anything breaks your build - you will know it right away.
Can also set the slaves' queue to run a single job at a time, so the builds don't overload the build-servers.
The other solution requires:
Two "starters" for your build
All slaves to be available
Set Job_A1 as a weekly scheduler that triggers Job_B (the main multi-configuration build process).
Set Job_A2 to run Job_B whenever there are source-code changes.
Set Job_B to know if it was triggered by Job_A1 or Job_A2 (can pass its name as a parameter),
and also set Job_B to ignore calls from Job_A2 ("exit 0"), if the current config. differs from Windows-32bit.
This way, all 4 configurations will run whenever there are source-control changes, but only one will actually build.
Good luck!

Teamcity build trigger after a certain number of check ins

Is there a way to trigger a teamcity build only after a certain number of check ins. I tried checking build triggering in teamcity but can't find anything where I can specify the number of check in after whcih I want to trigger a build.
I don't think there is a built in solution to this, but there are some things you could do.
Build your own build trigger plugin as described in the documentation
You may be able to simulate what you want by setting a long quiet period in the VCS trigger.
Use a scheduled trigger to run every hour or more and set it to only run the build if changes are detected
Only the first option will trigger on a specific number of checkins, but the other two could reduce the number of builds you do a day.
You can also look into the artifact clean up rules to reduce the number of artifacts kept. Another option is to use pinned builds to pin one build a day (for example) that will not get cleaned up by the artifact clean up process.

Disable scheduling another build if previous one is running in Jenkins

I have a build that polls SVN and checks for changes every hour. if it finds changes it starts building.
Right now if it sees changes and a previous build (from the same job) is running, it will queue the build and start it when the previous build finishes.
Is there an option to disable the queuing of multiple builds ?
Here's a workaround: let one job (Trigger) do the polling and then call the main job (MainJob) that will do the updating and building. You can even use the Parameterized Trigger Plugin to pass the SVN revisions and URIs. You then check off Block build when downstream project is building in Trigger.
To propagate change-sets from Trigger to MainJob use BlameSubversion Plugin.
(BTW, here's a neat trick: Trigger does not have to check out the whole SVN tree, you can check it out by hand with --set-depth empty in the working copy of Trigger).

Schedule specific build target in Jenkins?

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.

Control when to execute a windows batch command in hudson

I currently use Hudson CI and would like to know if it's possible to conditionally execute a build step depending on if there are changes in the build or not. We currently have an automatic build process that is scheduled to run daily, and the batch command automatically tags each build. However, I don't need it to tag a build if there are no changes.
Thanks
If you want a periodic build that only runs if there has been an SCM change you can switch from a periodic build trigger to a "Poll SCM" trigger, with the SCM polling schedule set to the same cron pattern as your existing build.

Resources