Jump to: navigation, search

Display job parameters

This scripts displays the parameters for all the jobs along with their default values (if applicable).

import hudson.model.*

for(item in Hudson.instance.items) {
  prop = item.getProperty(ParametersDefinitionProperty.class)
  if(prop != null) {
    println("--- Parameters for " + item.name + " ---")
    for(param in prop.getParameterDefinitions()) {
      try {
        println(param.name + " " + param.defaultValue)
      }
      catch(Exception e) {
        println(param.name)
      }
    }
    println()
  }
}

Sample ouput produced:

--- Parameters for GRA-00-UploadIntoClearCase ---
ONCSDAP1_USER jdoe
ONCSDAP1_PASSWORD 
GRA_ZIP_NAME GRA_Delivery_r.2.0.0_28-5_impl.zip
GRA_RELEASE n.28

--- Parameters for IN8-03-DeployXnetWebAppToRecette ---
STOP_START_AS