Jenkins does not recognise gradle build step created by Job Dsl

343 views
Skip to first unread message

Christian Bremer

unread,
Dec 30, 2014, 6:29:12 AM12/30/14
to job-dsl...@googlegroups.com
Hi,

When adding a gradle build step when using Job Dsl it ends up in my Jenkins config.xml but Jenkins does not recognize it when using configure on the job and would not execute the step when building the job.

This is how I add my gradle build step:

job.with {
           steps
{
                gradle
() {
                    tasks
(commands)
                    switches
('--info --no-daemon --stacktrace')
                    useWrapper
()
                    rootBuildScriptDir
(gradleDir)
                    makeExecutable
()
                    fromRootBuildScriptDir
()
                    configure
{ node -> // I tried first without the configure block but added the configure block to remove any differences in the xml representation.
                        node
/ useWorkspaceAsHome(false)
                        node
.@plugin = 'gra...@1.24'
                   
}
               
}
           
}
       
}


XML representation for the gradle build step when generating it using JobDsl(NOT-WORKING)

    <builders>
        <hudson.plugins.gradle.Gradle plugin="gra...@1.24">
            <description/>
            <switches>--info --no-daemon --stacktrace</switches>
            <tasks>build</tasks>
            <rootBuildScriptDir>${workspace}/JobDsl</rootBuildScriptDir>
            <buildFile/>
            <gradleName>(Default)</gradleName>
            <useWrapper>true</useWrapper>
            <makeExecutable>true</makeExecutable>
            <fromRootBuildScriptDir>true</fromRootBuildScriptDir>
            <useWorkspaceAsHome>false</useWorkspaceAsHome>
        </hudson.plugins.gradle.Gradle>
    </builders>


XML representation for the gradle build step when manually adding it through JenkinsUI - WORKING

  <builders>
    <hudson.plugins.gradle.Gradle plugin="gra...@1.24">
      <description></description>
      <switches>--info --no-daemon --stacktrace</switches>
      <tasks>build</tasks>
      <rootBuildScriptDir>${workspace}/JobDsl</rootBuildScriptDir>
      <buildFile></buildFile>
      <gradleName>(Default)</gradleName>
      <useWrapper>true</useWrapper>
      <makeExecutable>true</makeExecutable>
      <fromRootBuildScriptDir>true</fromRootBuildScriptDir>
      <useWorkspaceAsHome>false</useWorkspaceAsHome>
    </hudson.plugins.gradle.Gradle>
  </builders>


The XML representations is almost identical, the only thing I see is that JobDsl handles empty nodes differently.

Attaching full config.xml files when generating the job through JobDsl and when manually adding the gradle build step through the UI.
I am using JobDsl plugin 1.27 and Jenkins 1.580.1.

BuildAutomation_JobDsl_GeneratedByJobDSL-NOT-WORKING.xml
BuildAutomation_JobDsl_ManuallyAddedGradleBuildStepThroughUI-WORKING.xml

Daniel Spilker

unread,
Dec 30, 2014, 4:34:13 PM12/30/14
to job-dsl...@googlegroups.com
Hi,

sorry, but I can not reproduce the problem. I used the following script on Jenkins 1.580.1 with Job DSL Plugin 1.27 and Gradle Plugin 1.24.

job {
    name('foo')
    steps {
        gradle {
            tasks('build')

            switches('--info --no-daemon --stacktrace')
            useWrapper()
            rootBuildScriptDir('/tmp/test')
            makeExecutable()
            fromRootBuildScriptDir()
        }
    }
}

Daniel

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/ee4f89a9-d0bd-40ff-8550-3aab7b6fbad7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christian

unread,
Jan 2, 2015, 3:35:39 AM1/2/15
to job-dsl...@googlegroups.com
Thanks Daniel for looking at it,

I think the issue was that the gradle plugin was not fully installed on Jenkins.
I had installed the gradle plugin without restarting the Jenkins service, when the service was restarted it started to work again without any changes in our JobDsl configuration.

Is this a known issue that can occur when plugins are installed without restarting Jenkins?

/Christian

--
You received this message because you are subscribed to a topic in the Google Groups "job-dsl-plugin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/job-dsl-plugin/kxIhU6I3SA4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to job-dsl-plugi...@googlegroups.com.

To post to this group, send email to job-dsl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages