diff --git a/jenkins/controller/plugins.txt b/jenkins/controller/plugins.txt index 24674ee22..7804a5109 100644 --- a/jenkins/controller/plugins.txt +++ b/jenkins/controller/plugins.txt @@ -22,12 +22,12 @@ # [2] https://github.com/openshift/jenkins/blob/master/2/contrib/openshift/base-plugins.txt # [3] https://github.com/openshift/jenkins#plugin-installation-for-centos7-v410 basic-branch-build-strategies:1.3.2 -generic-webhook-trigger:2.2.0 +generic-webhook-trigger:1.84.2 github-oauth:0.39 -kubernetes-credentials-provider:1.262.v2670ef7ea_0c5 -pipeline-github:2.8-159.09e4403bc62f +kubernetes-credentials-provider:1.199.v4a_1d1f5d074f +pipeline-github:2.8-138.d766e30bb08b slack:625.va_eeb_b_168ffb_0 -timestamper:1.26 +timestamper:1.20 splunk-devops-extend:1.9.9 splunk-devops:1.9.9 antisamy-markup-formatter:162.v0e6ec0fcfcf6 diff --git a/jobs/bump-jenkins-plugins.Jenkinsfile b/jobs/bump-jenkins-plugins.Jenkinsfile index d052518c5..06c6af191 100644 --- a/jobs/bump-jenkins-plugins.Jenkinsfile +++ b/jobs/bump-jenkins-plugins.Jenkinsfile @@ -1,11 +1,11 @@ repo = "coreos/fedora-coreos-pipeline" fork_repo = "coreosbot-releng/fedora-coreos-pipeline" botCreds = "github-coreosbot-releng-token-username-password" -pr_branch = "pluginst" +pr_branch = "JenkinsPluginsUpdate" /* Function to extract the plugin version from the plugin URL */ def getVersionFromPluginUrl(pluginUrl) { - //example url : https://updates.jenkins.io/download/plugins/${pluginName}/latest/${pluginName}.hpi + /* example url : https://updates.jenkins.io/download/plugins/${pluginName}/latest/${pluginName}.hpi */ def parts = pluginUrl.split("/") def pluginVersion if (parts.size() >= 4) { @@ -24,12 +24,12 @@ node { userRemoteConfigs: [[url: "https://github.com/${fork_repo}.git"]], extensions: [[$class: 'WipeWorkspace']] ] - // Load utility functions + /* Load utility functions */ pipeutils = load("utils.groovy") properties([ pipelineTriggers([ - // Schedule to check once a month + /* Schedule to check once a month */ pollSCM('H H 1 * *') ]), buildDiscarder(logRotator( @@ -50,7 +50,7 @@ node { def plugins_lockfile = "jenkins/controller/plugins.txt" stage("Read plugins.txt") { - // Clone the repository and switch to the '${pr_branch}' branch + /* Clone the repository and switch to the '${pr_branch}' branch */ shwrapCapture(""" git clone --depth=1 --branch ${pr_branch} https://github.com/${fork_repo}.git cd fedora-coreos-pipeline @@ -59,14 +59,13 @@ node { git reset --hard upstream/main """) - // // Read the plugins from the lockfile + /* Read the plugins from the lockfile */ pluginslist = shwrapCapture("grep -v ^# ${plugins_lockfile}").split('\n') } stage("Check for plugin updates") { def pluginUrl - def sedCommands = [] - + def pluginsUpdateList = [] pluginslist.each { plugin -> def parts = plugin.split(':') if (parts.size() != 2) { @@ -76,45 +75,36 @@ node { def currentVersion = parts[1] /* Retrieve the download URL for the most recent version of a Jenkins plugin from the Jenkins update center. - After following all redirects, curl prints the final URL to stdout. The final URL is captured in the pluginUrl variable for further use. */ + After following all redirects, curl prints the final URL to stdout. The final URL is captured in the pluginUrl variable for further use. */ pluginUrl = shwrapCapture("curl -Ls -I -f -o /dev/null -w '%{url_effective}' https://updates.jenkins.io/download/plugins/${pluginName}/latest/${pluginName}.hpi") def latestVersion = getVersionFromPluginUrl(pluginUrl) if (latestVersion.toString() != currentVersion.toString()) { - // Update the plugin version in the lockfile + /* Update the plugin version in the lockfile */ pluginsToUpdate["${pluginName}"] = [currentVersion, latestVersion] println("Plugin: ${pluginName} current version is ${currentVersion}, it will be updated to latest version: ${latestVersion}") -/* - shwrap(""" - cd fedora-coreos-pipeline - sed -i '/${pluginName}:/ s/${currentVersion}/${latestVersion}/g' ${plugins_lockfile} - """) -*/ - //sedCommands.add("s/${pluginName}:${currentVersion}/${pluginName}:${latestVersion}/g") - def sedCom = "-e s/${pluginName}:${currentVersion}/${pluginName}:${latestVersion}/g" - println("Adding sed command: ${sedCom}") - sedCommands.add(sedCom) + + /* Construct Plugins List to update for find/replace operations */ + pluginsUpdateList.add("-e s/${pluginName}:${currentVersion}/${pluginName}:${latestVersion}/g") + } else { println("The latest version of ${pluginName} is already installed: ${currentVersion}") } } } - if (!sedCommands.isEmpty()) { - println("sedcommand edit starts") - def sedCommand = "sed -i " + sedCommands.join(' ') - println("Executing sed command: ${sedCommand}") + if (!pluginsUpdateList.isEmpty()) { + def pluginUpdate = "sed -i " + pluginsUpdateList.join(' ') shwrap(""" cd fedora-coreos-pipeline - ls -l ${plugins_lockfile} - ${sedCommand} ${plugins_lockfile} + ${pluginUpdate} ${plugins_lockfile} """) } } stage("Open a PR") { if (shwrap("git diff --exit-code") != 0){ - // Commit and push changes, and open a PR + /* Commit and push changes, and open a PR */ def message = "jenkins/plugins: update to latest versions" shwrap(""" cd fedora-coreos-pipeline