Why gradle doesn't start from jenkins job

I am trying to configure the build on our Jenkins server to run the fork of the sleeping kernel project.

I managed to get Jenkins to make a git clone to get the local repository from my github fork, but when Jenkins tries to run the "gradlew" command, it fails.

When you run this script directly from the drop-down folder, the build is as expected, but when you run the script through Jenkins, it fails.

The task is configured as a Freestyle configuration with the build step set as the “execute shell” step.

At the build stage, the following command is executed.

./gradlew clean test install buildReleaseBundles uploadArchives --debug --stacktrace

The gradlew script seems to be running, but something is going wrong in the gradle Download class.

My build script outputs the following:

 Building on master Checkout:workspace / /data/hudson/jobs/hibernate-envers-stevemac/workspace - hudson.remoting.LocalChannel@63e4f703 Using strategy: Default Last Built Revision: Revision 7cdb4c829f28c5b029a3d43f50a54d4c89fc9665 (origin/Branch_4.0.0.Final) Checkout:workspace / /data/hudson/jobs/hibernate-envers-stevemac/workspace - hudson.remoting.LocalChannel@63e4f703 Fetching changes from 1 remote Git repository Fetching upstream changes from https:// stevemac007@github.com /stevemac007/hibernate-core.git Commencing build of Revision 7cdb4c829f28c5b029a3d43f50a54d4c89fc9665 (origin/Branch_4.0.0.Final) Checking out Revision 7cdb4c829f28c5b029a3d43f50a54d4c89fc9665 (origin/Branch_4.0.0.Final) [workspace] $ /bin/sh -xe /tmp/tomcat6-tmp/hudson9191971611159378903.sh + ./gradlew clean test install buildReleaseBundles uploadArchives --debug --stacktrace Downloading http://repo.gradle.org/gradle/distributions/gradle-1.0-milestone-3-bin.zip Exception in thread "main" java.io.FileNotFoundException: /usr/share/tomcat6/.gradle/wrapper/dists/gradle-1.0-milestone-3-bin.zip.part (No such file or directory) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(FileOutputStream.java:194) at java.io.FileOutputStream.<init>(FileOutputStream.java:145) at org.gradle.wrapper.Download.downloadInternal(Download.java:46) at org.gradle.wrapper.Download.download(Download.java:37) at org.gradle.wrapper.Install.createDist(Install.java:54) at org.gradle.wrapper.Wrapper.execute(Wrapper.java:80) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:37) Build step 'Execute shell' marked build as failure Finished: FAILURE 
+6
source share
2 answers

As usual, with such a question, the actual query about it made me read the message correctly and look for the result.

And in this case, all the information I needed was there.

FileNotFoundException: /usr/share/tomcat6/.gradle/wrapper/dists/gradle-1.0-milestone-3-bin.zip.part (No such file or directory)

The problem is that the user performing the Jenkins task was not the same user on which the task was running on the server, and the task did not have write access to the / usr / share / tomcat 6 / folder.

Granting write access to user tomcat6 in / usr / share / tomcat 6 allowed this task to run.

+3
source

You might want to check out the Gradle plugin for Jenkins. It works like a charm. For more information, go to https://wiki.jenkins-ci.org/display/JENKINS/Gradle+Plugin .

0
source

Source: https://habr.com/ru/post/905025/


All Articles