Jenkins : ClearCase plugin Upgrade notes

Upgrade guide to 1.3.7

As this new version introduces view metadata management, you may face issues when migrating from an older version.

Here are a few things that you need to know :

  • By default, new views will now use the job setting to store metadata (instead of using automatic storage location)
  • Therefore, it is recommended to review the view metadata location in the global settings, then apply the following script to apply these settings to all your jobs
    import jenkins.model.*;
    import hudson.plugins.clearcase.*;
    
    jenkins = jenkins.model.Jenkins.instance
    allItems = jenkins.items
    
    println("Getting global values for view metadata")
    winStorageDir = jenkins.getDescriptor(ClearCaseSCM.class).defaultWinDynStorageDir
    unixStorageDir = jenkins.getDescriptor(ClearCaseSCM.class).defaultUnixDynStorageDir
    println("Windows : " + winStorageDir)
    println("Unix : " + unixStorageDir)
    
    println("Applying global view metadata settings to all jobs using clearcase as scm")
    allItems.each{ job->
      if (job.scm in AbstractClearCaseScm) {
        boolean changed = false;
        if(job.scm.viewStorageFactory.winStorageDir \!= winStorageDir) {
          job.scm.viewStorageFactory.winStorageDir = winStorageDir
          changed = true
        }
        if (job.scm.viewStorageFactory.unixStorageDir \!= unixStorageDir) {
          job.scm.viewStorageFactory.unixStorageDir = unixStorageDir
          changed = true
        }
        if (changed) {
          println(job.name + " updated.")
          job.save()
        }
      }
    }