Last active
November 6, 2019 06:24
-
-
Save jetersen/f2034d3d8d8cd61a99a08a2f48c49d23 to your computer and use it in GitHub Desktop.
Produces a Jenkins plugins.txt with the updated versions of plugins.
This file contains 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
//this will produce dependencies xml to be put into a dependencies block inside a pom.xml with the updated plugin version. | |
def plugins = Jenkins.instance.pluginManager.plugins.toSorted() | |
plugins.each { plugin -> | |
def attrs = plugin.getManifest().mainAttributes | |
def update = plugin.updateInfo | |
def version = "${plugin.version}" | |
if (update != null) { | |
version = "${update.version}" | |
println "<!-- Upgraded ${plugin.shortName} from ${plugin.version} to ${update.version} -->" | |
} | |
println "<dependency>" | |
println " <groupId>${attrs.getValue('Group-Id')}</groupId>" | |
println " <artifactId>${plugin.shortName}</artifactId>" | |
println " <version>${version}</version>" | |
println "</dependency>" | |
println "" | |
} |
This file contains 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
//this will produce plugins.txt with the updated plugin version. | |
def plugins = Jenkins.instance.pluginManager.plugins.toSorted() | |
plugins.each { plugin -> | |
def update = plugin.updateInfo | |
def version = "${plugin.version}" | |
if (update != null) { | |
version = "${update.version}" | |
println "# Upgraded ${plugin.shortName} from ${plugin.version} to ${update.version}" | |
} | |
println "${plugin.shortName}:${version}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment