Jenkins Build Periodically - Once - jenkins

I am trying to schedule a Jenkins Deployment task to run only once.
Why? So no one has to log in remotely to do after hours deployments (No Fun!)
So my question is: Is there a way to specify year within jenkins' cron syntax?
More info:
Under Build Triggers -> Build Periodically
If I schedule a build for today(Thursday, June 10th) at 10:52 AM
The cron syntax would be 52 10 10 6 2
However, the next June 10th will occur in the year 2025, so technically, the build will still be scheduled for 11 years from now, unless I manually remove the schedule.
This is not a huge problem, it just doesn't make sense to me someone hasn't come up with a solution for it yet.
I am not looking for hacks, scheduled tasks, or scripting... All of that would be more work then just manually removing the schedule. I would like to keep this completely inside of jenkins
If this is truly impossible, I will consider writing a plugin for this specific use-case.

Well after much digging I finally found it:
https://wiki.jenkins-ci.org/display/JENKINS/Schedule+Build+Plugin
It adds ^^ the schedule build button to all projects which provides a nice UI to set a date and time, instead of dealing with that ridiculous cron syntax.
Jenkins' Modo should be "There's a plugin for that"

Related

How to abort a Jenkins Job programmatically at a specified time

I want to abort my Jenkins Job before clock hits a particular time. I didn't find anything which stops it automatically at a specified time(I don't want to do it manually). Is there anything like that?
I have read this post, but none of the answer solves my problem How to stop an unstoppable zombie job on Jenkins without restarting the server?
If you want to stop a long running job, let's say, it is running more than 3 hours, then below jenkins plugins does exactly that for you.
Abort a build if it is likely stuck
Or, if you want certain build to abort on a specific time (i.e, no build should run at 5 pm daily), then you can configure groovy script to do that.

Continuous Integration in Jenkins, Test Cases from 2 Builds are stacking up

I have Continuous Integration Set up in Jenkins which is Triggered every time there is Code change, However if the change is done Frequently then the Test Cases from 2 Builds are stacking up. Is there a way to Cancel/Stop the Previous Builds Test Cases from Running, and just Continue with the latest Build
Try to use the 'Quiet Period' option. This is available from the 'Advanced' section of 'Configure'.
Here, you can specify how many seconds Jenkins should wait before actually starting its task after a commit has been made. So, if you provide 30 minutes (30*60 = 1800) as the quiet period, and you have made a commit at 8PM, Jenkins would wait till 8:30 PM before starting its task. In the meantime, if you make 2-3 more commits, they will be stacked together and considered during the 8:30 PM run.
Hope this helps

Automerge to another branch after a successfull build

Every monday, our team merges the dev-Branch to a "main"-branch, which is used by our test-team for testing purposes. You could say, that every monday our main branch has exactly the same files as our dev branch.
I am thinking of automating this task. I would like to create a build definition. The definition will run every sunday, build my dev-Branch and if it succeeds, it will automatically merge all changes made during that week to the main-branch.
I found a script: https://geekygulati.com/2013/02/17/automerging-in-tfs/ but it's not designed for TFS-build script, more for independent systems.
So I would like to know, if there is any easy way with the TFS, I am not a great expert. Any suggestions on how to do it? I am sure there are alot of ways to achieve something like that, I would like to know, how you would do it?
If you are using TFS 2013 or higher I believe you have an option to run a PowerShell script after the build. You could use this extension point to run the script you referenced.
It sounds like you are more advanced in your development practices. I would suggest working from a single Main branch all the time. We cautiously made this transition 2 years ago and have loved it. This was our first big step to Continuous Delivery. The trick is you have to make sure your changes are "Release Ready". Check it out - https://dotnetcatch.com/2016/02/16/are-you-release-ready/

Build-timeout Plugin in Jenkins: how long is 'too long'?

I would like to take advantage of this plug-in but the 'Abort the build if it's stuck' option doesn't set any timer and the description of the plug-in doesn't say how long is the timer, it just says: 'This plugin allows you to automatically abort a build if it's taking too long'
My question is how long is that? 1 hour, less/more?
Can I set up my own time?
Is that timer for the overall job or every line in the batch file has that timer?
Build-timeout plugin has multiple options (taken from help documentation of Build Timeout Plugin)
Absolute time. Use this if you know exactly how much time your build should not exceed in advance
Elastic time. Use this option if you want Jenkins to decide on the time. It basically averages out on the last n builds and will stop a
build if it exceeds given percentage. If you do not know in advance
how much time your build takes, use this option
Likely Stuck. Use Jenkins' Executor.html#isLikelyStuck() heuristics based approach to detect build is suspiciously taking for a long time
In your case, option two seems to be best initially.
I upgraded my jenkins installations recently to 1532 and noticed on jobs that the radio to set time has gone missing. I may file this as a bug.
This is what it should look like on your jobs:
https://github.com/jenkinsci/build-timeout-plugin/pull/14#issuecomment-24114825
I just upgraded to Jenkins 1535 and with that a new upgrade of the plug-in was available. That upgrade fixed the problem I was having. The timeout time is now available.

Calendar View for Jenkins jobs

Is there a plugin to jenkins(hudson) that can visually show all jobs and there runs in future as well as in the past.
ex: if Job A is scheduled to run once every day at 8 AM. The plugin should show the previous run of the job as well as scheduled runs in the future.
I searched in Jenkins Plugins Link and found Google Calendar but there are two things different about this plugin
It is linked to job status hence I am presuming it will only show previous runs
It needs an online calendar account.
No, you would have to write such a plugin.
"Next executions" plugin helpful a bit:
https://wiki.jenkins-ci.org/display/JENKINS/Next+Executions
The plug-in calendar-view is doing what you are looking for.
Features as of version Version: 0.3.1:
Features
Provides a month, week and day view of past and future builds
Indicates status of past builds by color
Displays when future scheduled builds will happen
Shows estimated duration of future scheduled builds
Configurable date and time settings

Resources