Gradle action can't run: permissions


#1

I’m trying to create my first pipeline, but appear to be failing at the first step. I’ve got a gradle 5.x project, and I’m trying to use the offical Gradle image from docker (library/gradle).

However, when I try to run the command gradle build gradle crashes, with lack of permissions to create the .gradle directory:

Caused by: org.gradle.api.UncheckedIOException: Failed to create parent directory ‘/home/gradle/buddy/myapp/.gradle/5.1.1’ when creating directory ‘/home/gradle/buddy/myapp/.gradle/5.1.1/fileHashes’`

I believe this is because the image user is gradle and this doesn’t have permission to create the directory. However, within Buddy I’m at a complete loss to remedy this. I can’t su or sudo, Buddy only allows me to add RUN commands on the docker env, not USER commands, so I can’t change the user.

Help! I can’t believe I’m the only one faced this.


#2

So I’ve abandoned the Gradle action, and resorted to the Custom action and just using the gradle wrapper instead. Shame, I’d still like to know if there is a better way to user the Gradle action, but I suppose it doesn’t make much difference.