Signaling the need to archive
Each development team is unique. Teams have their own way of doing business. In many organizations, there are one-off tasks that need to be done periodically. For example, at the end of each year, making a full backup of the entire filesystem.
This recipe details a script that for the last successful run of any job; if the year is different to the current year, then a warning is set at the beginning of the job's description. Thus, it is hinting to you that it's time to perform an action, such as archiving and then deleting. You can of course programmatically do the archiving. However, for high-value actions, it is worth forcing interceding, letting the Groovy scripts focus your attention.
Getting ready
Log in to Jenkins with an administrative account.
How to do it...
- Within the
Manage Jenkins
page, click on theScript Console
link and run the following script:
def warning='[You can ARCHIVE this Job]' def now=new Date() for (job in hudson.model.Hudson.instance...