gradle-plugin icon indicating copy to clipboard operation
gradle-plugin copied to clipboard

Implemented gradle pipeline step

Open soenkekueper opened this issue 6 years ago • 4 comments

Hey, i've now put some more work on a real gradle pipeline step. This makes it much easier and comfortable running a gradle build in an jenkins pieline.

You are now able to run a gradle build using a predefined gradle with just this little pipeline node{ gradle gradleName: 'gradle-4.10.2', tasks: 'clean build' }

I've implemented this in our test environment and saved a lot of code in our pipeline script for handling environment variables like PATH and JAVA_HOME catching stderr of gradle logs and so on.

It would be great to get this in so we could use this in our productive environment.

Basically i've moved the main logic of executing gradle into GradleExecution.java so it can now be used by pipeline and freestyle builds as well.

soenkekueper avatar Nov 29 '18 20:11 soenkekueper

I've installed this in our test environment and it is running very well and has a lot of advantages instead of running a gradle by executing a shell or bat file. It makes it more comfortable, easier and safer to run a gradle build, because you don't have to set any environment variables in dependency to the node you are currently running on.

As i was looking for a solution to our problems i found the ticket JENKINS-44834 and existing pull request. So i first decided to finish the work started there leading to #60. Due the changes made there were prerequisite to implement a real step i've continued the work to implement this step. So in conclusion with this PR the PR #60 is obsolete.

soenkekueper avatar Dec 04 '18 18:12 soenkekueper

Hey @wolfs , how about this PR, do you have any further questions?

I would really like to see this merged, because it would simplify our jenkins pipeline builds.

If you have any questions please contact me!

soenkekueper avatar Dec 15 '18 14:12 soenkekueper

Maybe an approach as shown here would be better: https://jenkins.io/blog/2016/04/21/dsl-plugins/

wolfs avatar Dec 16 '18 21:12 wolfs

There is also https://github.com/jenkinsci/pipeline-maven-plugin, which seems to use the Step API.

wolfs avatar Dec 16 '18 22:12 wolfs

I'll be closing the PR, given that there hasn't been any recent activity. Is the PR still interesting? If yes, please open a new one based on current main. Thank you!

wolfs avatar Oct 18 '22 09:10 wolfs