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

Workflow step for Gradle invocation

    XMLWordPrintable

Details

    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 ]

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

            tracking this RFE.

            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
            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?

            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?

            +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

            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

            jfbibeau: 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'

            orrc Christopher Orr added a comment - jfbibeau : 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'
            admizh Alex Yu added a comment -

            it planed to implement?

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

            orrc 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.

            ssieber Sam Sieber added a comment - orrc 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 ]
            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

            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 ]
            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
            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
            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.

            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 .
            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.

            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 .
            lorantonodi Lorant Onodi added a comment -

            I have to agree with douglaswpaul, 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?

            lorantonodi Lorant Onodi added a comment - I have to agree with douglaswpaul , 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?
            wolfs Stefan Wolf added a comment -

            lorantonodi: 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.

            wolfs Stefan Wolf added a comment - lorantonodi : 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 ]
            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
            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
            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 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

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

              Dates

                Created:
                Updated: