ghale / gradle-jenkins-plugin

Gradle plugin to programmatically configure Jenkins jobs.
123 stars 42 forks source link

getJenkinsVersion() always returns null #57

Open ywelsch opened 9 years ago

ywelsch commented 9 years ago

see MapJobManagement.

The job-dsl-plugin seems to require a properly set jenkins version in newer versions of the plugin. For example, the archiveArtifacts block requires this to evaluate properly (see https://github.com/jenkinsci/job-dsl-plugin/blob/ac9244d256ed7b856fb3b044ceab169b32662f85/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/publisher/PublisherContext.groovy )

It would be nice to make the Jenkins version number configurable on the Gradle Jenkins Plugin. A new task to check if configured an actual versions match could also be helpful.

For now, I hacked around the issue with...

jobManagement.metaClass.getJenkinsVersion = { new hudson.util.VersionNumber('1.592') }
bikusta commented 9 years ago

Hi @ywelsch,

I'm running into the same issue with the archiveArtifacts block and the missing version number. Where exactly did you put your workaround? Into the build script? At which position?

Thanks!

PS: I'm new to the Gradle and Groovy world.

ywelsch commented 9 years ago

@bikusta you can put that directly before the archiveArtifacts block.

jobManagement.metaClass.getJenkinsVersion = { new hudson.util.VersionNumber('1.592') }
archiveArtifacts {
    pattern 'some/file'
}