DevOps

Jenkins TRACKING YOUR JOBS CONFIGURATION

More often than not, you’ll find yourself (or your fellow colleagues) making a lot of changes to the various jobs that you have on Jenkins.

Sometimes you may want to revert a change or more, other times you may encounter a problem with a job and you want to trace the changes that were made to that job.

For those scenarios and others that require you to keep track of your job’s configuration, you can utilize the jobConfigHistory plugin.

This plugin enables you to view all the changes that have happened to the job’s config.xml file and also revert to a previous version of that file.

To install the plugin, follow these steps:

  1. Navigate to the plugin manager page.
  2. Search for jobConfigHistory in the Available tab.
  3. Check the plugin name.
  4. Click install without restart.

Once the plugin is installed, you can configure it as follows:

  1. Go to Configure System (from Manage Jenkins).
  2. Scroll down to the Job Config History section.

You have several options to configure, the most important of which are:

  • Use different history directory than default: You can specify a custom directory for storing your history. Ensure that Jenkins has permissions to access and write to that path.
  • Max number of history entries to keep: This determines the highest number of changes that the system will keep for you. Leaving it blank will save all changes.
  • Max number of days to keep history entries: This specifies the length of time (in days) that the system should keep the job history. Leaving it blank will keep the changes indefinitely.

Now let’s test the plugin:

  1. Go to the hello-world-integration job and add a description. Save the job.
  2. Navigate to Job Config History by clicking on the navigational link in the left column.
  • Click “Show job configs only” to filter the output. You’ll see a record reporting a change for this job.
  1. Go to the same job again and delete the description. Save the configuration.
  • Return to Job Config History. You’ll notice that we have two entries, and the first entry has a “Fast backward” button. Clicking this button will restore the job to the state it was in when the snapshot was taken.
  1. Click the restore button and ensure that the job has the description back.

Ali Imran
Over the past 20+ years, I have been working as a software engineer, architect, and programmer, creating, designing, and programming various applications. My main focus has always been to achieve business goals and transform business ideas into digital reality. I have successfully solved numerous business problems and increased productivity for small businesses as well as enterprise corporations through the solutions that I created. My strong technical background and ability to work effectively in team environments make me a valuable asset to any organization.
https://ITsAli.com

Leave a Reply