AOEpeople / gradle-jenkins-job-dsl-plugin

Plugin for easy management of Jenkins Job DSL scripts with Gradle
MIT License
25 stars 12 forks source link

version X.YY or later of plugin '______' needs to be installed #16

Open pedrohdz opened 4 years ago

pedrohdz commented 4 years ago

Just upgrading org.jenkins-ci.plugins:cloudbees-folder from 6.1.2 to 6.11.1 is giving the error: version 5.14 or later of plugin 'cloudbees-folder' needs to be installed

This also happening with org.jenkins-ci.plugins.workflow:workflow-multibranch:2.21

Happens when running ./gradlew clean jobDslTest

./build.gradle:

plugins {
  id 'com.aoe.jenkins-job-dsl' version '2.8.0'
}

repositories {
  mavenLocal()
}

dependencies {
  //jenkinsPlugin 'org.jenkins-ci.plugins:cloudbees-folder:6.1.2'  // This works
  jenkinsPlugin 'org.jenkins-ci.plugins:cloudbees-folder:6.11.1'  // This fails
}

jobDsl {
  sourceDir 'src/jobs'
}

./src/jobs/dsl.groovy:

folder("hamsdi")
listView("hamsdi/bamsdi") {
  jobs {
    regex(".*tests.*")
  }
  columns {
    status()
  }
}

Error from build/reports/tests/jobDslTest/classes/com.aoe.gradle.jenkinsjobdsl.JobScriptsSpec.html:

Expected no exception to be thrown, but got 'javaposse.jobdsl.dsl.DslScriptException'
    at spock.lang.Specification.noExceptionThrown(Specification.java:119)
    at com.aoe.gradle.jenkinsjobdsl.JobScriptsSpec.test DSL script #file.name(JobScriptsSpec.groovy:60)
Caused by: javaposse.jobdsl.dsl.DslScriptException: (script, line 1) version 5.14 or later of plugin 'cloudbees-folder' needs to be installed
    at javaposse.jobdsl.plugin.JenkinsJobManagement.failOrMarkBuildAsUnstable(JenkinsJobManagement.java:418)
    at javaposse.jobdsl.plugin.JenkinsJobManagement.requireMinimumPluginVersion(JenkinsJobManagement.java:321)
    at script.run(script:1)
    at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScript(AbstractDslScriptLoader.groovy:138)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScriptEngine(AbstractDslScriptLoader.groovy:108)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScripts_closure1(AbstractDslScriptLoader.groovy:61)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at groovy.lang.Closure.call(Closure.java:414)
    at groovy.lang.Closure.call(Closure.java:430)
    at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScripts(AbstractDslScriptLoader.groovy:46)
    at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScript(AbstractDslScriptLoader.groovy:87)
    at com.aoe.gradle.jenkinsjobdsl.JobScriptsSpec.test DSL script #file.name(JobScriptsSpec.groovy:56)
./gradlew --version

------------------------------------------------------------
Gradle 6.0.1
------------------------------------------------------------

Build time:   2019-11-18 20:25:01 UTC
Revision:     fad121066a68c4701acd362daf4287a7c309a0f5

Kotlin:       1.3.50
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.5 (AdoptOpenJDK 11.0.5+10)
OS:           Mac OS X 10.14.6 x86_64

Let me know if any other information is required.

Any assistance would be appreciated.

Thanks!

Geethree commented 4 years ago

Just hit this myself.. any updates on your end @pedrohdz

Geethree commented 4 years ago

Sooo I poked around, using different versions for the cloudbees-folder plugin. Then at 6.7 I saw the following error..

 0.976 [id=61]    SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading plugin Folders Plugin v6.7 (cloudbees-folder)
    java.io.IOException: Folders Plugin v6.7 failed to load.
     - You must update Jenkins from v2.121 to v2.130 or later to run this plugin.

I then checked my jenkin server's version and it was 2.190.2, so substituting these version with gradle dependencySubstitution

It worked!

TL;DR - Workaround

Bump the jenkins-war version to a appropriate version. via dependency substitution.

build.gradle

configurations.all {
  resolutionStrategy.dependencySubstitution {
    substitute module("org.jenkins-ci.main:jenkins-war:2.121") because "Version we use" with module("org.jenkins-ci.main:jenkins-war:2.190.2")
    substitute module("org.jenkins-ci.main:jenkins-war:2.190.2")
  }
}

All version of the jenkins-war can be found

reinholdfuereder commented 11 months ago

Maybe Cyprien's comment helps you as well: https://issues.jenkins.io/browse/JENKINS-68216?focusedId=427167&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-427167