-
Notifications
You must be signed in to change notification settings - Fork 64
add updatecli for plugins #1063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3c44270
5a914a7
bff99fa
0efab81
16f2bea
5dc9f0c
5726140
c201430
0793659
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * text eol=lf |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,4 @@ pct-report.* | |
| logs/ | ||
| megawar.war | ||
| pct.jar | ||
|
|
||
| plugin-manager.jar | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| param( | ||
| [string] $JenkinsVersion, | ||
| [string] $PluginManagerJar = './plugin-manager.jar' | ||
| ) | ||
|
|
||
| $JenkinsVersionX = $JenkinsVersion -replace '\d+$', 'x' | ||
|
|
||
| if (Get-Command 'java' -ErrorAction SilentlyContinue) { | ||
| $java = 'java' | ||
| } elseif ($IsLinux) { | ||
| $java = '/usr/bin/java' | ||
| } else { | ||
| $java = 'java' | ||
| } | ||
|
|
||
| $pomPath = "bom-${JenkinsVersionX}/pom.xml" | ||
| $pom = New-Object System.Xml.XmlDocument | ||
| $pom.PreserveWhitespace = $true | ||
| $pom.Load($pomPath) | ||
|
|
||
| # Select Dependencies and Skip BOM | ||
| $dependencies = $pom.Project.DependencyManagement.Dependencies.Dependency | Select-Object -Skip 1 | ||
|
|
||
| foreach ($dependency in $dependencies) { | ||
| $artifact = $dependency.artifactId | ||
| $oldVersion = $dependency.version | ||
| $plugin = "${artifact}:${oldVersion}" | ||
| [string] $output = & $java -jar "$PluginManagerJar" --no-download --available-updates --jenkins-version "$JenkinsVersion" --plugins $plugin | ||
| if ($null -ne $output -and $output -inotlike '*No available updates*') { | ||
| # Example output: | ||
| # Available updates: | ||
| # credentials (2.6.1) has an available update: 2.6.1.1 | ||
|
|
||
| # Grab the version number at the end of the line | ||
| $newVersion = ($output | Select-String -Pattern 'update: (.+)').matches.Groups[1].Value | ||
| Write-Output "Changed $artifact from $oldVersion to $newVersion" | ||
| $dependency.version = $newVersion | ||
| } | ||
| } | ||
|
|
||
| $pom.Save($pomPath) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -eux -o pipefail | ||
|
|
||
| jenkinsVersion="$1" | ||
| jar="${PLUGIN_MANAGER_JAR_PATH:-"./plugin-manager.jar"}" | ||
|
|
||
| # check if jar does not exist | ||
| if [ ! -f "$jar" ]; then | ||
| curl -sSL https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/2.12.3/jenkins-plugin-manager-2.12.3.jar -o "$jar" | ||
| fi | ||
|
|
||
| pwsh -NoProfile -File "./updatecli/updatecli.d/update-plugins.ps1" -JenkinsVersion "${jenkinsVersion}" -PluginManagerJar "${jar}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| --- | ||
| scms: | ||
| github: | ||
| kind: github | ||
| spec: | ||
| user: "{{ .github.user }}" | ||
| email: "{{ .github.email }}" | ||
| owner: "{{ .github.owner }}" | ||
| repository: "{{ .github.repository }}" | ||
| token: "{{ requiredEnv .github.token }}" | ||
| username: "{{ .github.username }}" | ||
| branch: "{{ .github.branch }}" | ||
|
|
||
| sources: | ||
| jenkins2.289.x: | ||
| name: Get Last Jenkins Stable Version | ||
| kind: githubrelease | ||
| spec: | ||
| owner: "jenkinsci" | ||
| repository: "jenkins" | ||
| token: "{{ requiredEnv .github.token }}" | ||
| versionfilter: | ||
| kind: regex | ||
| pattern: 'jenkins-2.289.\d+$' | ||
| transformers: | ||
| - trimPrefix: "jenkins-" | ||
| jenkins2.303.x: | ||
| name: Get Last Jenkins Stable Version | ||
| kind: githubrelease | ||
| spec: | ||
| owner: "jenkinsci" | ||
| repository: "jenkins" | ||
| token: "{{ requiredEnv .github.token }}" | ||
| versionfilter: | ||
| kind: regex | ||
| pattern: 'jenkins-2.303.\d+$' | ||
| transformers: | ||
| - trimPrefix: "jenkins-" | ||
| jenkins2.319.x: | ||
| name: Get Last Jenkins Stable Version | ||
| kind: githubrelease | ||
| spec: | ||
| owner: "jenkinsci" | ||
| repository: "jenkins" | ||
| token: "{{ requiredEnv .github.token }}" | ||
| versionfilter: | ||
| kind: regex | ||
| pattern: 'jenkins-2.319.\d+$' | ||
| transformers: | ||
| - trimPrefix: "jenkins-" | ||
| jenkins2.332.x: | ||
| name: Get Last Jenkins Stable Version | ||
| kind: githubrelease | ||
| spec: | ||
| owner: "jenkinsci" | ||
| repository: "jenkins" | ||
| token: "{{ requiredEnv .github.token }}" | ||
| versionfilter: | ||
| kind: regex | ||
| pattern: 'jenkins-2.332.\d+$' | ||
| transformers: | ||
| - trimPrefix: "jenkins-" | ||
| conditions: | ||
| jenkins2.289.x: | ||
| name: Test if Jenkins stable published | ||
| kind: maven | ||
| sourceid: jenkins2.289.x | ||
| spec: | ||
| url: "repo.jenkins-ci.org" | ||
| repository: "releases" | ||
| groupid: "org.jenkins-ci.main" | ||
| artifactid: "jenkins-war" | ||
| jenkins2.303.x: | ||
| name: Test if Jenkins stable published | ||
| kind: maven | ||
| sourceid: jenkins2.303.x | ||
| spec: | ||
| url: "repo.jenkins-ci.org" | ||
| repository: "releases" | ||
| groupid: "org.jenkins-ci.main" | ||
| artifactid: "jenkins-war" | ||
| jenkins2.319.x: | ||
| name: Test if Jenkins stable published | ||
| kind: maven | ||
| sourceid: jenkins2.319.x | ||
| spec: | ||
| url: "repo.jenkins-ci.org" | ||
| repository: "releases" | ||
| groupid: "org.jenkins-ci.main" | ||
| artifactid: "jenkins-war" | ||
| jenkins2.332.x: | ||
| name: Test if Jenkins stable published | ||
| kind: maven | ||
| sourceid: jenkins2.332.x | ||
| spec: | ||
| url: "repo.jenkins-ci.org" | ||
| repository: "releases" | ||
| groupid: "org.jenkins-ci.main" | ||
| artifactid: "jenkins-war" | ||
| targets: | ||
| jenkins2.289.x: | ||
| name: 'Update 2.289.x plugins' | ||
| sourceid: jenkins2.289.x | ||
| kind: shell | ||
| spec: | ||
| command: bash ./updatecli/updatecli.d/update-plugins.sh | ||
| scmid: github | ||
| jenkins2.303.x: | ||
| name: 'Update 2.303.x plugins' | ||
| sourceid: jenkins2.303.x | ||
| kind: shell | ||
| spec: | ||
| command: bash ./updatecli/updatecli.d/update-plugins.sh | ||
| scmid: github | ||
| jenkins2.319.x: | ||
| name: 'Update 2.319.x plugins' | ||
| sourceid: jenkins2.319.x | ||
| kind: shell | ||
| spec: | ||
| command: bash ./updatecli/updatecli.d/update-plugins.sh | ||
| scmid: github | ||
| jenkins2.332.x: | ||
| name: 'Update 2.332.x plugins' | ||
| sourceid: jenkins2.332.x | ||
| kind: shell | ||
| spec: | ||
| command: bash ./updatecli/updatecli.d/update-plugins.sh | ||
| scmid: github | ||
| pullrequests: | ||
| default: | ||
| title: 'Bump pinned plugins' | ||
| kind: github | ||
| scmid: github | ||
| targets: | ||
| - jenkins2.289.x | ||
| - jenkins2.303.x | ||
| - jenkins2.319.x | ||
| - jenkins2.332.x | ||
|
Comment on lines
+135
to
+138
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean when a given plugin gets updates for multiple LTS lines? I think it is fine for those to be separate PRs, since this is not the normal case. A plugin will only be mentioned in a |
||
| spec: | ||
| labels: | ||
| - dependencies | ||
| automerge: true | ||
| mergemethod: squash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,4 @@ github: | |
| token: "UPDATECLI_GITHUB_TOKEN" | ||
| owner: "jenkinsci" | ||
| repository: "bom" | ||
| branch: "master" | ||
| branch: "master" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this file needs to be maintained when adding or removing lines. Would you mind adding a note to https://github.com/jenkinsci/bom/#lts-lines to this effect?