Skip to content

Commit

Permalink
Upgrade to latest JPI + Gradle versions
Browse files Browse the repository at this point in the history
Releases were broken with the previous version of the JPI plugin [0],
therefore we needed to try upgrading to the latest version.

As the latest version requires Gradle 6, we have a few changes to make:

- `jenkinsVersion` needs to be referenced through `project.properties`
- the `war` plugin needs to be explicitly added
- the CSS/JS plugins we're using are not yet released[1][2], so we can
  follow the tricks in Spotless[3] to use the version from the (pinned)
  latest commit on GitHub

Next, as we're upgrading the JPI plugin, we need to:

- migrate to using `implementation` / `testImplementation`
- add Feature Variants for each of the `optionalJenkinsPlugins` -
  although I'm not sure if they're needed right now, we'll produce them
  for now and review later

See also https://groups.google.com/g/jenkinsci-dev/c/CDVvgj9dDMs

[0]: jenkinsci/gradle-jpi-plugin#192
[1]: eriwen/gradle-css-plugin#58
[2]: eriwen/gradle-js-plugin#177
[3]: https://github.com/diffplug/spotless/blob/a7f25eb51c6d4006591ea911157e62d0213e320b/CONTRIBUTING.md
  • Loading branch information
jamietanna committed Oct 27, 2021
1 parent 119f93e commit 6b7a8d8
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=abc10bcedb58806e8654210f96031db541bcd2d6fc3161e81cb0572d6a15e821
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions job-dsl-api-viewer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ buildscript {
}

plugins {
id 'com.eriwen.gradle.css' version '2.14.0'
id 'com.eriwen.gradle.js' version '2.14.1'
id 'com.eriwen.gradle.css'
id 'com.eriwen.gradle.js'
}

apply plugin: 'org.ajoberstar.git-publish'
Expand Down
44 changes: 30 additions & 14 deletions job-dsl-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,23 @@ buildscript {
}

plugins {
id 'org.jenkins-ci.jpi' version '0.38.0'
id 'org.jenkins-ci.jpi' version '0.43.0'
id 'war'
}

java {
registerFeature('vsphereCloud') {
usingSourceSet(sourceSets.main)
}
registerFeature('configFileProvider') {
usingSourceSet(sourceSets.main)
}
registerFeature('managedScripts') {
usingSourceSet(sourceSets.main)
}
registerFeature('configurationAsCode') {
usingSourceSet(sourceSets.main)
}
}

description = 'Jenkins plugin to leverage job-dsl-core to programmatic create jobs from inside Jenkins.'
Expand All @@ -20,7 +36,7 @@ description = 'Jenkins plugin to leverage job-dsl-core to programmatic create jo
def generatedSourcesDir = 'generated'

jenkinsPlugin {
coreVersion = jenkinsVersion
coreVersion = project.properties['jenkinsVersion']
displayName = 'Job DSL'
url = 'https://github.com/jenkinsci/job-dsl-plugin'
gitHubUrl = 'https://github.com/jenkinsci/job-dsl-plugin'
Expand Down Expand Up @@ -94,18 +110,18 @@ dependencies {
compile(project(':job-dsl-core')) {
exclude group: 'org.jvnet.hudson', module:'xstream'
}
jenkinsPlugins 'org.jenkins-ci.plugins:cloudbees-folder:5.14'
jenkinsPlugins 'org.jenkins-ci.plugins:structs:1.19'
jenkinsPlugins 'org.jenkins-ci.plugins:script-security:1.54'
optionalJenkinsPlugins('org.jenkins-ci.plugins:vsphere-cloud:1.1.11') {
implementation 'org.jenkins-ci.plugins:cloudbees-folder:5.14'
implementation 'org.jenkins-ci.plugins:structs:1.19'
implementation 'org.jenkins-ci.plugins:script-security:1.54'
vsphereCloudImplementation('org.jenkins-ci.plugins:vsphere-cloud:1.1.11') {
exclude group: 'dom4j'
}
optionalJenkinsPlugins 'org.jenkins-ci.plugins:config-file-provider:2.15.4'
optionalJenkinsPlugins 'org.jenkinsci.plugins:managed-scripts:1.3'
optionalJenkinsPlugins 'io.jenkins:configuration-as-code:1.15'
jenkinsTest 'io.jenkins:configuration-as-code:1.15'
jenkinsTest 'io.jenkins:configuration-as-code:1.15:tests'
jenkinsTest 'org.jenkins-ci.plugins:matrix-auth:1.3'
jenkinsTest 'org.jenkins-ci.plugins:nested-view:1.14'
jenkinsTest 'org.jenkins-ci.plugins:credentials:2.1.10'
configFileProviderImplementation 'org.jenkins-ci.plugins:config-file-provider:2.15.4'
managedScriptsImplementation 'org.jenkinsci.plugins:managed-scripts:1.3'
configurationAsCodeImplementation 'io.jenkins:configuration-as-code:1.15'
testImplementation 'io.jenkins:configuration-as-code:1.15'
testImplementation 'io.jenkins:configuration-as-code:1.15:tests'
testImplementation 'org.jenkins-ci.plugins:matrix-auth:1.3'
testImplementation 'org.jenkins-ci.plugins:nested-view:1.14'
testImplementation 'org.jenkins-ci.plugins:credentials:2.1.10'
}
18 changes: 18 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
url 'https://jitpack.io'
}
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == 'com.eriwen.gradle.css') {
useModule('com.github.eriwen:gradle-css-plugin:9fe88d7')
} else if (requested.id.id == 'com.eriwen.gradle.js') {
useModule('com.github.eriwen:gradle-js-plugin:d15f4ae')
}
}
}
}

rootProject.name = 'job-dsl-plugin-root'
include 'job-dsl-core', 'job-dsl-plugin', 'job-dsl-api-viewer'

0 comments on commit 6b7a8d8

Please sign in to comment.