Created
October 9, 2018 18:29
-
-
Save wrossmck/b7f5f00b851295baf0aaa484fabe7294 to your computer and use it in GitHub Desktop.
promote all plugins available on jenkins update center (CJOC)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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