Skip to content

Instantly share code, notes, and snippets.

@wrossmck
Created October 9, 2018 18:29
Show Gist options
  • Save wrossmck/b7f5f00b851295baf0aaa484fabe7294 to your computer and use it in GitHub Desktop.
Save wrossmck/b7f5f00b851295baf0aaa484fabe7294 to your computer and use it in GitHub Desktop.
promote all plugins available on jenkins update center (CJOC)
// promote all update center plugins
import com.cloudbees.plugins.updatecenter.PluginData
// Example of an update center "myUpdateCenter" at root level, could be parameter to this job
def updateCenterFullName = "myUpdateCenter"
jenkins.model.Jenkins.instance.getItemByFullName("${updateCenterFullName}").getPluginsData().each { PluginData pluginData ->
if(pluginData.getVersions() != null && !pluginData.getVersions().isEmpty()) {
println "Promoting '${pluginData.getName()}' to version '${pluginData.getVersions().lastKey()}'"
pluginData.setPromotedVersion("${pluginData.getVersions().lastKey()}")
} else {
println "(Plugin '${pluginData.getName()}' is not pulled yet. Not promoting)"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment