-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Currently, there are a problems with describing dependencies on plug-ins that need to be packaged in the plugins field of the formula file:
- After upgrading Jenkins version, all relevant plug-ins need to be re-confirmed one by one, otherwise the following errors will occur

Proposal
Write the information about the plug-in to be packaged in the pom.xml file and reference it in the formula.yaml file as follows:
# formula.yaml
bundle:
groupId: io.github.ks-jenkins
artifactId: ks-jenkins
description: Jenkins formula for Kubesphere
vendor: Kubesphere Community
buildSettings:
docker:
base: jenkins/jenkins:2.319.1
tag: {{.tag}}
output: {{.output}}
platform: {{.platform}}
buildx: true
build: true
pom: pom.xml
pomIgnoreRoot: true
pomIncludeWar: true
war:
groupId: org.jenkins-ci.main
artifactId: jenkins-war
source:
version: 2.319.1
systemProperties:
hudson.security.csrf.DefaultCrumbIssuer.EXCLUDE_SESSION_ID: "true"
jenkins.install.runSetupWizard: "false"
groovyHooks:
- type: "init"
id: "bundle-plugins"
source:
dir: remove-bundle-plugins.groovy
With the help of the plugin version relationships already sorted out by the community, only the bom needs to be updated when upgrading the Jenkins version
<!-- pom.xml -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.319.x</artifactId>
<version>1090.v0a_33df40457a_</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>Add plug-in dependencies like this
<dependencies>
<!-- jenkins plugins -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials-binding</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
</dependency>
<dependency>
<groupId>io.jenkins</groupId>
<artifactId>configuration-as-code</artifactId>
<version>1.55</version>
</dependency>
<dependency>
<groupId>io.jenkins.blueocean</groupId>
<artifactId>blueocean</artifactId>
<version>1.25.2</version>
</dependency>
</dependencies>This also has the benefit of upgrading some of the dependent libraries
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.11.4</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>symbol-annotation</artifactId>
<version>1.22</version>
</dependency>
</dependencies>
</dependencyManagement>Methods validation
After running the two packaged images, export plugins.txt and the comparison results are consistent
# method A
make build
docker run --rm -it -p 8080:8080 kubespheredev/ks-jenkins:test
curl -sSL "http://localhost:8080/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/' > plugins-a.txt
# method B
# export plugins-b.txt
# diff
vimdiff plugins-a.txt plugins-b.txtReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
