Hello all! I’m trying to execute a shell script from a Gradle task, here’s all that I have for that:
tasks.register<Exec>("startDocker") {
commandLine("./start-docker.sh")
.workingDir("docker")
}
On running that task, I run into the following error:
Caused by: java.io.IOException: error=13, Permission denied
My thinking is that I have to use chmod +x to give executable permissions to that start-docker.sh file, but am struggling to determine how to do that. I’ve taken a shot with the following task:
tasks.register<Exec>("giveExecutablePermissionsForDockerScript") {
commandLine("chmod", "+x", "start-docker.sh")
.workingDir("docker")
}
Which I then make the startDocker one depend on in a larger task:
tasks.register<Test>("dockerTest") {
dependsOn("giveExecutablePermissionsForDockerScript")
dependsOn("startDocker").mustRunAfter("giveExecutablePermissionsForDockerScript")
// ...
}
But to no avail! Any thoughts on how I could accomplish this? The greater context is that I’d like to use shell scripts to prepare a Docker environment that some tests rely on.