Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dependency submission action should handle non-executable gradlew script #17

Closed
yamin8000 opened this issue Feb 8, 2024 · 4 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@yamin8000
Copy link

yamin8000 commented Feb 8, 2024

Gradle 8.6
JDK 17

I'm using the dependency-submission action and just used the simplest example.

name: Dependency Submission

on: [ push ]

permissions:
  contents: write

jobs:
  dependency-submission:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
      uses: actions/checkout@v4
    - name: Generate and submit dependency graph
      uses: gradle/actions/dependency-submission@v3

However, its action is failing and can't execute gradlew which I never changed and IDE generated on project initialization. Here I'm providing links to the full raw pipeline error and my gradlew file.

2024-02-08T09:24:03.7482952Z ##[error]Error: Gradle script '/home/runner/work/freeDictionaryApp/freeDictionaryApp/gradlew' is not executable.
2024-02-08T09:24:03.7536635Z Error: Gradle script '/home/runner/work/freeDictionaryApp/freeDictionaryApp/gradlew' is not executable.
2024-02-08T09:24:03.7538765Z     at verifyIsExecutableScript (/home/runner/work/_actions/gradle/actions/v3.0.0/dist/setup-gradle/main/index.js:140758:15)
2024-02-08T09:24:03.7541933Z     at validateGradleWrapper (/home/runner/work/_actions/gradle/actions/v3.0.0/dist/setup-gradle/main/index.js:140744:5)
2024-02-08T09:24:03.7546118Z     at Object.gradleWrapperScript (/home/runner/work/_actions/gradle/actions/v3.0.0/dist/setup-gradle/main/index.js:140737:5)
2024-02-08T09:24:03.7548440Z     at Object.<anonymous> (/home/runner/work/_actions/gradle/actions/v3.0.0/dist/setup-gradle/main/index.js:140677:95)
2024-02-08T09:24:03.7549679Z     at Generator.next (<anonymous>)
2024-02-08T09:24:03.7551015Z     at /home/runner/work/_actions/gradle/actions/v3.0.0/dist/setup-gradle/main/index.js:140667:71
2024-02-08T09:24:03.7552046Z     at new Promise (<anonymous>)
2024-02-08T09:24:03.7553530Z     at __webpack_modules__.23584.__awaiter (/home/runner/work/_actions/gradle/actions/v3.0.0/dist/setup-gradle/main/index.js:140663:12)
2024-02-08T09:24:03.7555832Z     at Object.executeGradleBuild (/home/runner/work/_actions/gradle/actions/v3.0.0/dist/setup-gradle/main/index.js:140676:12)
2024-02-08T09:24:03.7556935Z     at /home/runner/work/_actions/gradle/actions/v3.0.0/dist/setup-gradle/main/index.js:141589:33
@bigdaz
Copy link
Member

bigdaz commented Feb 9, 2024

When I clone your repository, the gradlew script isn't executable, as mentioned in the error. This means that either:

  • The IDE you used to generate the project didn't make this file executable, OR
  • The executable bit wasn't retained when you committed the project to GitHub

I think the error message is pretty clear, but the I think the action could be improved to handle a non-executable gradlew script, even if it makes no sense to have a project like that.

@bigdaz bigdaz changed the title Gradle script '/home/runner/work/.../gradlew' is not executable. Dependency submission actions should handle non-executable gradlew script Feb 9, 2024
@bigdaz bigdaz changed the title Dependency submission actions should handle non-executable gradlew script Dependency submission action should handle non-executable gradlew script Feb 9, 2024
@bigdaz bigdaz added the enhancement New feature or request label Feb 9, 2024
bigdaz added a commit that referenced this issue Feb 9, 2024
Instead of failing the build, detect a non-executable wrapper file
and set the executable bit.

Fixes #17
bigdaz added a commit that referenced this issue Feb 9, 2024
Instead of failing the build, detect a non-executable wrapper file
and set the executable bit.

Fixes #17
@bigdaz bigdaz closed this as completed in 2f23d64 Feb 9, 2024
@yamin8000
Copy link
Author

When I clone your repository, the gradlew script isn't executable, as mentioned in the error. This means that either:

* The IDE you used to generate the project didn't make this file executable, OR

* The executable bit wasn't retained when you committed the project to GitHub

I think the error message is pretty clear, but the I think the action could be improved to handle a non-executable gradlew script, even if it makes no sense to have a project like that.

Thanks.

@yamin8000
Copy link
Author

When I clone your repository, the gradlew script isn't executable, as mentioned in the error. This means that either:

* The IDE you used to generate the project didn't make this file executable, OR

* The executable bit wasn't retained when you committed the project to GitHub

I think the error message is pretty clear, but the I think the action could be improved to handle a non-executable gradlew script, even if it makes no sense to have a project like that.

I don't know about that, however, somehow changing my workflow file to this fixed the problem. Modern Android apps need JDK 17 but I don't know why we need to grant permission for the gradlew file explicitly.

name: Dependency Submission

on: [ push ]

permissions:
  contents: write

jobs:
  dependency-submission:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v4
      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          java-version: '17'
          distribution: 'temurin'
          cache: gradle
      - name: Grant execute permission for gradlew
        run: chmod +x gradlew
      - name: Generate and submit dependency graph
        uses: gradle/actions/dependency-submission@v3

@bigdaz
Copy link
Member

bigdaz commented Feb 9, 2024

If you build from the command-line, you will execute ./gradlew build. This requires the executable bit to be set on the script.

If you are only building from the IDE, then you may never notice this being broken.

I've pushed a fix for this issue, so with the next release you'll just see a warning in your workflow run, not an error.

@bigdaz bigdaz added this to the v3.1 milestone Feb 11, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants