GRADLE_USER_HOME='/opt/bitnami/.gradle'

We just installed the Bitnami Jenkins image in our Google Cloud account. I’m very pleased with how easy it was to dive right in. But it appears there might be a misconfiguration right out of the box.

Trying to run a simple gradle build configured to use the gradle wrapper, there was a file permissions problem, namely that the tomcat user (i.e., jenkins) tried to create “/opt/bitnami/.gradle/” and stuff under it (which it doesn’t have permission to, of course). As a workaround, I ssh’d in and manually created that directory, and made it world-writable- then jenkins/gradle was able to download and unpack the wrapper-specified gradle version into it. (Another workaround might be to globally override GRADLE_OPTS as in http://jlorenzen.blogspot.com/2013/06/setting-gradle-home-directory-and-proxy.html )

Also, I don’t really want to point GRADLE_USER_HOME to the workspace directory, since then each project would have to re-download gradle into its workspace.

It seems like perhaps this workaround shouldn’t be necessary? Any insights would be appreciated!

Hi @adommasch,

Thanks for reporting the issue. We will work on fixing it and post here once we release a new version solving this.

Tomas

I had this problem with Jenkins 2.9 from VM Depot.

Thanks for the workaround.

Hello,

Newer releases of our Bitnami Jenkins stack should have fixed the issue. If the issue still persists, please let us know.

Best regards,

Javier

I deployed a new Bitnami Jenkins instance on GCE via Cloud Launcher on 12/8 and I’m seeing this issue as well. I’m trying to build using the Gradle wrapper in the git-based project I’m using. It tries to download and unpack version 3.2.1 into /opt/bitnami/.gradle. That directory exists, but it owned by root and isn’t writeable.

Log for the build failure: (private GitHub project replaced with Foo/Bar for privacy)

Started by GitHub push by AlanKrueger
Building in workspace /opt/bitnami/apps/jenkins/jenkins_home/workspace/Bar
 > /opt/bitnami/git/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > /opt/bitnami/git/bin/git config remote.origin.url https://github.com/Foo/Bar.git # timeout=10
Fetching upstream changes from https://github.com/Foo/Bar.git
 > /opt/bitnami/git/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > /opt/bitnami/git/bin/git fetch --tags --progress https://github.com/Foo/Bar.git +refs/heads/*:refs/remotes/origin/*
 > /opt/bitnami/git/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > /opt/bitnami/git/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 7ac484d63800fb16eb2b9bdd5c36b4515a6a2081 (refs/remotes/origin/master)
 > /opt/bitnami/git/bin/git config core.sparsecheckout # timeout=10
 > /opt/bitnami/git/bin/git checkout -f 7ac484d63800fb16eb2b9bdd5c36b4515a6a2081
 > /opt/bitnami/git/bin/git rev-list 9460ee22e1738698f7f2979734c9f29203f15b14 # timeout=10
[Gradle] - Launching build.
[Bar] $ /opt/bitnami/apps/jenkins/jenkins_home/workspace/Bar/gradlew check
Exception in thread "main" java.lang.RuntimeException: Could not create parent directory for lock file /opt/bitnami/.gradle/wrapper/dists/gradle-3.2.1-bin/erlz51pt56t1o6vc7t39cikug/gradle-3.2.1-bin.zip.lck
	at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:43)
	at org.gradle.wrapper.Install.createDist(Install.java:48)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE

Hi,

Our stack have already integrated Gradle 3.2.1 and Gradle plugin 1.25, so you don’t need to download and install nothing in order to star to work. You can find our gradle installation in /opt/bitnami/gradle.

I hope this helps. If you have any other question and you think we can help, please don’t hesitate to ask.

Best regards,
Silvio Fernández

Hello,

Faced with similar issue – have ‘Permission denied’ message when Jenkins invokes gradlew for my project (out of the box run). Shall we have it fixed or security bar is on the top by design?

Hello @Gelassen

What version of the Jenkins Stack are you using?

Best Regards,

Juan Ariza

Hello @jariza,

I am using the latest one - 2.32.1

Kind regards,
Dmitry

Hello @Gelassen,

We were able to reproduce the issue and we’re working to solve it for future releases. It’s a regression from previous versions: the /opt/bitnami/.gradle directory exists but its owner it’s root. It should be tomcat instead. In the meantime, you may change the owner of this directory manually. To do it, connect to your instance via SSH and run the following command:

sudo chwon tomcat:tomcat /opt/bitnami/.gradle

Hope it helps.

Best regards,
Alvaro Recio

Gradle version is different between the users which is have issue with http request for maven repo

Hi @shivakmr184,

I’m afraid I do not fully understand what is your question. Could you please give us more information about your issue? Which stack or image are you using? What versions are you referring to?

Regards,
Gonzalo