18

How to Manually Clear Locks in Jenkins

 3 years ago
source link: https://zwischenzugs.com/2017/12/11/how-to-manually-clear-locks-in-jenkins/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Problem

Recently I got into a situation where I hit a bug with Jenkins where Jenkinsfile locks were not released if the job was terminated.

I tried:

  • Restarting Jenkins
  • Reinstalling the plugin
  • Removing the locks manually from the top level Jenkins page
  • Raising a bug

None of these worked.

I found a solution that involved manually hacking files.

Solution

  1. Find the file named:
    org.jenkins.plugins.lockableresources.LockableResourcesManager.xml

    In the /var/jenkins_home​ folder (or wherever Jenkins is installed).

    It will look like this:

  2. <org.jenkins.plugins.lockableresources.LockableResource>
      <name>cookbook_openshift3_test_lock_1</name>
      <description></description>
      <labels></labels>
      <queueItemId>0</queueItemId>
      <buildExternalizableId>cookbook-openshift3/master#208</buildExternalizableId>
      <queuingStarted>1512325412</queuingStarted>
      <queuedContexts/>
    </org.jenkins.plugins.lockableresources.LockableResource>

    Remove the line in bold containing the buildExternalizableId attribute.

  3. Change the queuingStarted item
    <queuingStarted>1512325412</queuingStarted>

    <queuingStarted>0</queuingStarted>

  4. Restart Jenkins

Author is currently working on the second edition of Docker in Practice 

Get 39% off with the code: 39miell2

5d342-0v9jkbliyi3uzefqq.jpg?w=640

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK