Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-27393

Workflow step for Gradle invocation

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      gradle(...) step for workflow is desirable, so that its output gets annotated to show the list of tasks that have been executed.

        Attachments

          Issue Links

            Activity

            kohsuke Kohsuke Kawaguchi created issue -
            kohsuke Kohsuke Kawaguchi made changes -
            Field Original Value New Value
            Link This issue depends on JENKINS-26055 [ JENKINS-26055 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            COMPATIBILITY.md
            http://jenkins-ci.org/commit/workflow-plugin/092fc19df79c2ea40b6c00b791d5eea6628ea575
            Log:
            JENKINS-27393

            tracking this RFE.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: COMPATIBILITY.md http://jenkins-ci.org/commit/workflow-plugin/092fc19df79c2ea40b6c00b791d5eea6628ea575 Log: JENKINS-27393 tracking this RFE.
            jglick Jesse Glick made changes -
            Component/s gradle-plugin [ 15547 ]
            Component/s workflow-plugin [ 18820 ]
            Assignee Jesse Glick [ jglick ] Gregory Boissinot [ gbois ]
            Labels workflow
            Hide
            rtyler R. Tyler Croy added a comment -

            This has been sitting around for a while and I really really would love to see it done, who can I bribe?

            Show
            rtyler R. Tyler Croy added a comment - This has been sitting around for a while and I really really would love to see it done, who can I bribe?
            Hide
            jfbibeau Jean-Francois Bibeau added a comment -

            +1, I'll chip in for the bribe! We've been wanting to experiment with the Workflow plugin in Jenkins but lack of gradle support is kind of a killer

            Show
            jfbibeau Jean-Francois Bibeau added a comment - +1, I'll chip in for the bribe! We've been wanting to experiment with the Workflow plugin in Jenkins but lack of gradle support is kind of a killer
            Hide
            orrc Christopher Orr added a comment -

            Jean-Francois Bibeau: I agree this would be nice to have.

            But just in case you didn't see already, arbitrary shell script stuff is supported, e.g. sh './gradlew assemble'

            Show
            orrc Christopher Orr added a comment - Jean-Francois Bibeau : I agree this would be nice to have. But just in case you didn't see already, arbitrary shell script stuff is supported, e.g. sh './gradlew assemble'
            Hide
            admizh Alex Yu added a comment -

            it planed to implement?

            Show
            admizh Alex Yu added a comment - it planed to implement?
            hrmpw Patrick Wolf made changes -
            Epic Link JENKINS-34657 [ 170293 ]
            Hide
            ssieber Sam Sieber added a comment -

            Christopher Orr Arbitrary shell script stuff is supported but unfortunately not very good for gradle - when using gradlew from the shell it grabs the systems java, not what's configured in Jenkins, and I've run into an error where it can't find the correct gradle from /var/empty/.gradle, a mysterious error.

            So, I guess what I'm saying is that actual integration would still be very nice and a step up.

            Show
            ssieber Sam Sieber added a comment - Christopher Orr Arbitrary shell script stuff is supported but unfortunately not very good for gradle - when using gradlew from the shell it grabs the systems java, not what's configured in Jenkins, and I've run into an error where it can't find the correct gradle from /var/empty/.gradle, a mysterious error. So, I guess what I'm saying is that actual integration would still be very nice and a step up.
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 161598 ] JNJira + In-Review [ 180757 ]
            Hide
            rgacki Robert Gacki added a comment -

            Following snippet works for us:

            def javaEnv() {
              def javaHome = tool 'Java 8'
              ["PATH=${env.PATH}:${javaHome}/bin", "JAVA_HOME=${javaHome}"]
            }
            
            node {
              withEnv(javaEnv()) {
                sh './gradlew clean assemble -x test'
              }
            }
            

            +1 For native plugin support

            Show
            rgacki Robert Gacki added a comment - Following snippet works for us: def javaEnv() { def javaHome = tool 'Java 8' [ "PATH=${env.PATH}:${javaHome}/bin" , "JAVA_HOME=${javaHome}" ] } node { withEnv(javaEnv()) { sh './gradlew clean assemble -x test' } } +1 For native plugin support
            abayer Andrew Bayer made changes -
            Labels workflow pipeline workflow
            abayer Andrew Bayer made changes -
            Labels pipeline workflow pipeline
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-37394 [ JENKINS-37394 ]
            Hide
            jglick Jesse Glick added a comment -

            There is not currently an API that would allow the Gradle builder to be trivially operated in a Pipeline build, since code using Proc cannot survive Jenkins restarts or even agent disconnections. JENKINS-26055 proposes a supported API allowing a new Step to be defined that runs some Gradle executable as a durable task, while maintaining feature parity with the traditional builder:

            • creating a customized command line
            • predefining environment variables like JAVA_HOME based on tool selections
            • applying GradleConsoleAnnotator
            Show
            jglick Jesse Glick added a comment - There is not currently an API that would allow the Gradle builder to be trivially operated in a Pipeline build, since code using Proc cannot survive Jenkins restarts or even agent disconnections. JENKINS-26055 proposes a supported API allowing a new Step to be defined that runs some Gradle executable as a durable task, while maintaining feature parity with the traditional builder: creating a customized command line predefining environment variables like JAVA_HOME based on tool selections applying GradleConsoleAnnotator
            Hide
            jglick Jesse Glick added a comment -

            And yes the first two requirements can be met with a library function that takes various parameters similar to the Gradle build step but ultimately runs withEnv and sh and tool.

            Show
            jglick Jesse Glick added a comment - And yes the first two requirements can be met with a library function that takes various parameters similar to the Gradle build step but ultimately runs withEnv and sh and tool .
            Hide
            douglaswpaul Douglas Paul added a comment -

            Having a gradle step that survives restarts/disconnections would be great eventually, but does that really need to hold up Gradle becoming a first-class build step? The manual tool/withEnv/sh approach is clunky, and I'm really missing the GradleConsoleAnnotator.

            Show
            douglaswpaul Douglas Paul added a comment - Having a gradle step that survives restarts/disconnections would be great eventually, but does that really need to hold up Gradle becoming a first-class build step? The manual tool / withEnv / sh approach is clunky, and I'm really missing the GradleConsoleAnnotator .
            Hide
            lorantonodi Lorant Onodi added a comment -

            I have to agree with Douglas Paul, I would really like to use gradle plugin in the my pipeline scripts instead of the sh approach. Also, as far as I am aware, the JENKINS-26055 is a "Won't Do". So what's up now?

            Show
            lorantonodi Lorant Onodi added a comment - I have to agree with Douglas Paul , I would really like to use gradle plugin in the my pipeline scripts instead of the sh approach. Also, as far as I am aware, the JENKINS-26055  is a "Won't Do". So what's up now?
            Hide
            wolfs Stefan Wolf added a comment -

            Lorant Onodi: What would you expect to be supported as part of the pipeline DSL? What are your use cases?

            I would look into implementing better support for pipeline but first I would like to know what should be supported and what the DSL would look like.

            Show
            wolfs Stefan Wolf added a comment - Lorant Onodi : What would you expect to be supported as part of the pipeline DSL? What are your use cases? I would look into implementing better support for pipeline but first I would like to know what should be supported and what the DSL would look like.
            alexbrjo Alex Johnson made changes -
            Epic Link JENKINS-34657 [ 170293 ] JENKINS-44690 [ 182554 ]
            Hide
            alexbrjo Alex Johnson added a comment - - edited

            This is being considered as part of the Important Pipeline Compatibility Epic. Here are the tasks to get this plugin to a basic level (not a durable task) of pipeline compatibility:

            • Refactor to use Pipeline compatible APIs
            • Add withGradle() builder step as an improved workaround for a bash shell step
              • Would provide GradleConsoleAnnotator and would use environment vars
            • Test that pipeline can run and Gradle console output can be annotated
            • Manual test to confirm step runs in pipeline with console annotator
            Show
            alexbrjo Alex Johnson added a comment - - edited This is being considered as part of the  Important Pipeline Compatibility Epic . Here are the tasks to get this plugin to a basic level (not a durable task) of pipeline compatibility: Refactor to use Pipeline compatible APIs Add withGradle() builder step as an improved workaround for a bash shell step Would provide GradleConsoleAnnotator and would use environment vars Test that pipeline can run and Gradle console output can be annotated Manual test to confirm step runs in pipeline with console annotator
            Hide
            recampbell Ryan Campbell added a comment -

            We are splitting the withGradle and ConsoleAnnotator into JENKINS-44834 and leaving this issue targetted at the original request for a gradle step. We believe that JENKINS-44834 will address the core use-cases which gradle users expect from gradle integration with pipeline.

            Show
            recampbell Ryan Campbell added a comment - We are splitting the withGradle and ConsoleAnnotator into  JENKINS-44834 and leaving this issue targetted at the original request for a gradle step. We believe that  JENKINS-44834 will address the core use-cases which gradle users expect from gradle integration with pipeline.
            recampbell Ryan Campbell made changes -
            Link This issue is related to JENKINS-44834 [ JENKINS-44834 ]
            recampbell Ryan Campbell made changes -
            Epic Link JENKINS-44690 [ 182554 ]
            jamesdumay James Dumay made changes -
            Remote Link This issue links to "CloudBees Internal OSS-2131 (Web Link)" [ 18408 ]
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal OSS-182 (Web Link)" [ 19293 ]

              People

              Assignee:
              gbois Gregory Boissinot
              Reporter:
              kohsuke Kohsuke Kawaguchi
              Votes:
              45 Vote for this issue
              Watchers:
              54 Start watching this issue

                Dates

                Created:
                Updated: