Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
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
Expand Up @@ -18,11 +18,16 @@ jobs:

- name: Install updatecli # Until https://github.com/updatecli/updatecli/pull/336
run: |
curl -sSL https://github.com/updatecli/updatecli/releases/download/v0.16.1/updatecli_Linux_x86_64.tar.gz -o updatecli.tgz
curl -sSL https://github.com/updatecli/updatecli/releases/download/v0.23.2/updatecli_Linux_x86_64.tar.gz -o updatecli.tgz
tar xzf updatecli.tgz -C /usr/local/bin
updatecli version
rm -f updatecli.tgz

- name: Install Jenkins Plugin Installation Manager Tool
run: |
curl -sSL https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/2.12.3/jenkins-plugin-manager-2.12.3.jar -o "${GITHUB_WORKSPACE:-.}/plugin-manager.jar"
echo "PLUGIN_MANAGER_JAR_PATH=$GITHUB_WORKSPACE/plugin-manager.jar" >> $GITHUB_ENV

- name: Diff
continue-on-error: true
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pct-report.*
logs/
megawar.war
pct.jar

plugin-manager.jar
41 changes: 41 additions & 0 deletions updatecli/updatecli.d/update-plugins.ps1
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)
13 changes: 13 additions & 0 deletions updatecli/updatecli.d/update-plugins.sh
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}"
143 changes: 143 additions & 0 deletions updatecli/updatecli.d/update-plugins.yaml
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:
Copy link
Member

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?

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
Copy link
Member Author

@jetersen jetersen Apr 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can do one big PR for all boms or multiple PRs for each bom.

Does it matter @timja @basil @jglick ?

Copy link
Member

Choose a reason for hiding this comment

The 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 bom-2.*.x/pom.xml when it is overridden there relative to the newer lines, so when Jenkins baselines are updated across more than one LTS bump in a given plugin release, we would only be adding one such entry.

spec:
labels:
- dependencies
automerge: true
mergemethod: squash
32 changes: 16 additions & 16 deletions updatecli/updatecli.d/weekly.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
---
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:
jenkinsWeekly:
name: Get Last Jenkins Weekly Version
Expand All @@ -13,27 +25,15 @@ conditions:
name: Test if Jenkins weekly published
kind: maven
spec:
owner: "maven"
url: "repo.jenkins-ci.org"
repository: "releases"
groupID: "org.jenkins-ci.main"
artifactID: "jenkins-war"
groupid: "org.jenkins-ci.main"
artifactid: "jenkins-war"
targets:
default:
name: 'Update weekly version'
sourceID: jenkinsWeekly
sourceid: jenkinsWeekly
kind: shell
spec:
command: bash ./updatecli/updatecli.d/weekly-apply.sh
scm:
github:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"
pullRequest:
labels:
- dependencies
scmid: github
2 changes: 1 addition & 1 deletion updatecli/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ github:
token: "UPDATECLI_GITHUB_TOKEN"
owner: "jenkinsci"
repository: "bom"
branch: "master"
branch: "master"