Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Gradle builder not working (with or without wrapper) #2727

Closed
bbossola opened this issue Sep 19, 2023 · 10 comments
Closed

Gradle builder not working (with or without wrapper) #2727

bbossola opened this issue Sep 19, 2023 · 10 comments
Assignees
Milestone

Comments

@bbossola
Copy link

I attempted to run the Gradle builder as a Github Action on a sample project following the instructions, but it does not work.

I attempted using a standard wrapper:
https://github.com/bbossola/gradle-sample-project/actions/runs/6240805328/job/16941718533

And without:
https://github.com/bbossola/gradle-sample-project/actions/runs/6240908435/job/16942059861

In both situation, the project is not built and the action fails. I followed the instructions provided. Please advice.

@laurentsimon
Copy link
Collaborator

@AdamKorcz Can you take a look?
/cc @loosebazooka

@AdamKorcz AdamKorcz self-assigned this Sep 23, 2023
@loosebazooka
Copy link
Contributor

okay, sorry I finally got a chance to look at this.

In each case:

(1) you need to also check in the gradle-wrapper.jar into your repo (see: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:adding_wrapper)

(2) this action depends on the existence of the gradle wrapper, the runtime container does not contain gradle, so it can't run anything

@laurentsimon
Copy link
Collaborator

laurentsimon commented Oct 16, 2023

Do we need to update the documentation?

@loosebazooka
Copy link
Contributor

I think (1) is a mistake by the user, I think (2) is maybe a problem with documentation. Ensure that we explicitly require gradle wrapper.

@laurentsimon
Copy link
Collaborator

Thanks @loosebazooka feel free to send a PR to improve documentation and tag me on it

@loosebazooka
Copy link
Contributor

#2866

@laurentsimon laurentsimon added this to the Next release milestone Jan 16, 2024
@laurentsimon
Copy link
Collaborator

Also merged #3083 and created #3086 to add e2e2 tests

@ramonpetgrave64

@ramonpetgrave64
Copy link
Collaborator

Fix pending in #3250, but we should find a way to test the new behavior, where the project directory is the same as the repository root.

@laurentsimon
Copy link
Collaborator

Can you try calling your fork from your own project? I think you'll need to update this line in your fork https://github.com/slsa-framework/slsa-github-generator/blob/main/.github/workflows/builder_maven_slsa3.yml#L84, to ensure it calls your fork instead of this repo. Let me know if this works or not.

laurentsimon pushed a commit that referenced this issue Feb 16, 2024
Fixes the Gradle builds
#2727

I think the first attempt to fix (now reverted) was mostly correct, but
in this PR I correct the directory comparison conditional.

- #3083
- #3089

Also adds some documentation for handling multi-project builds, which
seem to now be the default when initializing a new Gradle app.
-
https://docs.gradle.org/current/samples/sample_building_java_applications.html#review_the_project_files

## Testing

Tested against my own sample project
*
https://github.com/ramonpetgrave64/my-example-gradle-project/pull/1/files/af3b52a88d6bf053d04f3456a8bb78f6d32c4061
*
https://github.com/ramonpetgrave64/my-example-gradle-project/actions/runs/7850051301

Modified the `slsa-framwork/example-package` e2e tests against my own
fork. The actual builds and provenance generation succeed, except for
the verify stage, which should fail because my fork
`https://github.com/ramonpetgrave64/slsa-github-generator/.github/workflows/builder_gradle_slsa3.yml@refs/heads/main`
is not a "trusted builder".

*
ebffcc9
*
main...ramonpetgrave64:slsa-github-generator:67a2f7b7efb421e55c3a787161d5968681f3db15
*
https://github.com/ramonpetgrave64/example-package/actions/runs/7850413736/job/21425770965

---------

Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
@ianlewis
Copy link
Member

Fixed by #3250
e2e test added here: slsa-framework/example-package#323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants