Skip to content
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

simplify updatecli pinned and add 2.346.x however pinned to .1 #1279

Merged
merged 8 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/action-updatecli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
# Run once a day
- cron: '0 0 * * *'

env:
PLUGIN_MANAGER_VERSION: '2.12.8'

jobs:
updatecli:
runs-on: ubuntu-latest
Expand All @@ -18,15 +21,17 @@ jobs:

- name: Install updatecli # Until https://github.com/updatecli/updatecli/pull/336
run: |
curl -sSL https://github.com/updatecli/updatecli/releases/download/v0.23.2/updatecli_Linux_x86_64.tar.gz -o updatecli.tgz
curl -sSL https://github.com/updatecli/updatecli/releases/download/v0.27.0/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
url="https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/$PLUGIN_MANAGER_VERSION/jenkins-plugin-manager-$PLUGIN_MANAGER_VERSION.jar"
path="${GITHUB_WORKSPACE:-.}/plugin-manager.jar"
curl -sSL "$url" -o "$path"
echo "PLUGIN_MANAGER_JAR_PATH=$path" >> $GITHUB_ENV

- name: Diff
continue-on-error: true
Expand Down
14 changes: 11 additions & 3 deletions updatecli/updatecli.d/update-plugins.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
param(
[string] $JenkinsVersion,
[string] $PluginManagerJar = './plugin-manager.jar'
[Parameter(Position=0)]
[string] $JenkinsVersion
)

$JenkinsVersionX = $JenkinsVersion -replace '\d+$', 'x'

$pluginManagerJar = $ENV:PLUGIN_MANAGER_JAR_PATH ?? "./plugin-manager.jar"
$pluginManagerVersion = $ENV:PLUGIN_MANAGER_VERSION ?? "2.12.8"
jetersen marked this conversation as resolved.
Show resolved Hide resolved

# check if jar does not exist, download it - useful for testing
if ([System.IO.File]::Exists($pluginManagerJar) -eq $false) {
curl -sSL "https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/$pluginManagerVersion/jenkins-plugin-manager-$pluginManagerVersion.jar" -o "$pluginManagerJar"
}

if (Get-Command 'java' -ErrorAction SilentlyContinue) {
$java = 'java'
} elseif ($IsLinux) {
Expand All @@ -25,7 +33,7 @@ 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
[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:
Expand Down
13 changes: 0 additions & 13 deletions updatecli/updatecli.d/update-plugins.sh

This file was deleted.

45 changes: 37 additions & 8 deletions updatecli/updatecli.d/update-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sources:
kind: regex
pattern: 'jenkins-2.289.\d+$'
transformers:
- trimPrefix: "jenkins-"
- trimprefix: "jenkins-"
jenkins2.303.x:
name: Get Last Jenkins Stable Version
kind: githubrelease
Expand All @@ -35,7 +35,7 @@ sources:
kind: regex
pattern: 'jenkins-2.303.\d+$'
transformers:
- trimPrefix: "jenkins-"
- trimprefix: "jenkins-"
jenkins2.319.x:
name: Get Last Jenkins Stable Version
kind: githubrelease
Expand All @@ -47,7 +47,7 @@ sources:
kind: regex
pattern: 'jenkins-2.319.\d+$'
transformers:
- trimPrefix: "jenkins-"
- trimprefix: "jenkins-"
jenkins2.332.x:
name: Get Last Jenkins Stable Version
kind: githubrelease
Expand All @@ -59,7 +59,19 @@ sources:
kind: regex
pattern: 'jenkins-2.332.\d+$'
transformers:
- trimPrefix: "jenkins-"
- trimprefix: "jenkins-"
jenkins2.346.x:
name: Get Last Jenkins Stable Version
kind: githubrelease
spec:
owner: "jenkinsci"
repository: "jenkins"
token: "{{ requiredEnv .github.token }}"
versionfilter:
kind: regex
pattern: 'jenkins-2.346.1$' # fix to x.x.1 until the next stable minor release
Copy link
Member Author

Choose a reason for hiding this comment

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

relatively easy to bump the version pattern to .\d+$ and add the next stable minor release and add the new stable release pinned to .1$

transformers:
- trimprefix: "jenkins-"
conditions:
jenkins2.289.x:
name: Test if Jenkins stable published
Expand Down Expand Up @@ -97,34 +109,50 @@ conditions:
repository: "releases"
groupid: "org.jenkins-ci.main"
artifactid: "jenkins-war"
jenkins2.346.x:
name: Test if Jenkins stable published
kind: maven
sourceid: jenkins2.346.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
command: pwsh -NoProfile -File ./updatecli/updatecli.d/update-plugins.ps1
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
command: pwsh -NoProfile -File ./updatecli/updatecli.d/update-plugins.ps1
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
command: pwsh -NoProfile -File ./updatecli/updatecli.d/update-plugins.ps1
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
command: pwsh -NoProfile -File ./updatecli/updatecli.d/update-plugins.ps1
scmid: github
jenkins2.346.x:
name: 'Update 2.346.x plugins'
sourceid: jenkins2.346.x
kind: shell
spec:
command: pwsh -NoProfile -File ./updatecli/updatecli.d/update-plugins.ps1
scmid: github
pullrequests:
default:
Expand All @@ -136,6 +164,7 @@ pullrequests:
- jenkins2.303.x
- jenkins2.319.x
- jenkins2.332.x
- jenkins2.346.x
spec:
labels:
- dependencies
Expand Down