Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-14912

Gradle plugin - Permission denied when running gradlew

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • gradle-plugin
    • None
    • Ubuntu Precise. Jenkins run with it's own user (not as root).

      Immediately after upgrading to Gradle plugin version 1.18, I received the following error in the build console when running any Gradle build with the Gradle wrapper:

      [workspace] $ /var/lib/jenkins/jobs/gradle-cobertura-plugin/workspace/gradlew clean check
      /bin/bash: /var/lib/jenkins/jobs/gradle-cobertura-plugin/workspace/gradlew: Permission denied
      Build step 'Invoke Gradle script' changed build result to FAILURE

      The file permissions on the "gradlew" in the workspace now prevent the jenkins user from executing gradlew, likely due to this commit: https://github.com/jenkinsci/gradle-plugin/commit/a3dc7bcfa1a1e61e90d98c85c9aa0e9b09b5dce2

      Downgrading to 1.17 fixed the issue.

          [JENKINS-14912] Gradle plugin - Permission denied when running gradlew

          Justin Ryan added a comment -

          I'm seeing the make executable functionality turned on by default, which then changes the permissions to something like this on Amazon Linux AMI 2011.09:

          --wxr-x--T 1 builds nac  5064 Sep  5 16:28 gradlew
          

          Then I get a permission denied error. I think the what chmod is being run is wrong. The first fix is to stop setting executable by default.

          Justin Ryan added a comment - I'm seeing the make executable functionality turned on by default, which then changes the permissions to something like this on Amazon Linux AMI 2011.09: --wxr-x--T 1 builds nac 5064 Sep 5 16:28 gradlew Then I get a permission denied error. I think the what chmod is being run is wrong. The first fix is to stop setting executable by default.

          Stefan Wolf added a comment -

          I am pretty sure this has been fixed some time ago, the current line sets 0755 as permission: https://github.com/wolfs/gradle-plugin/blob/7a69bb626ac3d742e0844172cc55086fb3b5bf87/src/main/java/hudson/plugins/gradle/Gradle.java#L255.

          This commit should have fixed the problem: https://github.com/wolfs/gradle-plugin/commit/1b1f1c1eb175e008bb87b609e6232cd51ffd07d7

           

          I will close this issue now, please reopen if the error persists.

          Stefan Wolf added a comment - I am pretty sure this has been fixed some time ago, the current line sets  0755  as permission:  https://github.com/wolfs/gradle-plugin/blob/7a69bb626ac3d742e0844172cc55086fb3b5bf87/src/main/java/hudson/plugins/gradle/Gradle.java#L255 . This commit should have fixed the problem:  https://github.com/wolfs/gradle-plugin/commit/1b1f1c1eb175e008bb87b609e6232cd51ffd07d7   I will close this issue now, please reopen if the error persists.

            gbois Gregory Boissinot
            eriwen Eric Wendelin
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: