project.sync to synchronize a source directory structure with a target directory structure. This is on a Linux machine. The user I’m executing as has user ownership of the source files, and group ownership of the target files. From a permission perspective, this should work. The problem is… it doesn’t.
Gradle wants to
chmod 775 the target directory structure, which group ownership doesn’t support. As a matter of fact, on Linux… the only way (that I know of) to issue a
chmod is to actually own the files. So by extension… Gradle has to own the target directory structure.
In theory… this seems like not that big of a deal. However, in this environment, the Jenkins user checks out the files, and the Gradle builds are done as a different user, because the builds are interacting with a running application, and Jenkins doesn’t have permission to interact with the application, so we use
sudo for those bits.
I’ve tried using
fileMode but that has no effect. As a matter of fact… no matter what I set for those values,
project.sync still does a
chmod 775 as the first step.
I won’t give the entire stack trace… just the important bits:
Caused by: org.gradle.api.GradleException: Could not copy file Caused by: org.gradle.internal.nativeintegration.filesystem.FileException: Could not set file mode 775 Caused by: net.rubygrapefruit.platform.NativeException: Could not set UNIX mode