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

feat: Runfile and java artifact support for Bazel Builder #2362

Merged
merged 121 commits into from
Jul 13, 2023

Conversation

enteraga6
Copy link
Collaborator

@enteraga6 enteraga6 commented Jul 7, 2023

cc: @mihaimaruseac

This will provide support for artifacts that also need runfiles. Users can use a flag, needs-runfiles, to also package the artifact alongside the runfiles Bazel generates if the user deems it as necessary.

Also, support for Java artifacts is made available by packaging the JARs to be standalone through a format in Bazel called _deploy.jar. Alongside the _deploy.jar, there will be a modified run-script that allows the users that download the artifact to run the run-script by using a flag called local_javabin, where they put the path to their own java bin such that it is utilized by the run-script. This run-script is generated by Bazel from a template and later modified in the build.sh in the internal part of the builder to add this flag for the users. More information is available on the readme.

Java targets will automatically be converted to their _deploy.jar with this. Three flags are used for users that have java targets:

includes-java: if true then adds an additional flag to build command as well as rule for local java repo in WORKSPACE in order to utilize the --singlejar capability of run-script for _deploy.jar such that the remote jdk does not need to be included in runfiles. Doing it like this prevents massive bloat when attesting.

user-java-distribution and user-java-version: let the user specify the exact java they want to use to build

When users run the run-script they will include an additional flag local_javabin which they will set to their local javabin that the run-script will utilize to run the _deploy.jar

A combination of bazel query and bazel cquery were used to resolved edge cases with the implementation.

enteraga6 and others added 26 commits July 7, 2023 21:35
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Fixes getting the filename from the result of `npm pack --json`. Some
older versions return the incorrect file name.

This change falls back and attempts to determine the filename if the
file is not initially found.

Fixes slsa-framework#2290  slsa-framework#2294 slsa-framework#2295 slsa-framework#2296 slsa-framework#2297 slsa-framework#2298 slsa-framework#2299

Signed-off-by: Ian Lewis <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
This installs the instance of npm used for publish in a temporary
directory rather than polluting the user job global npm modules.

---------

Signed-off-by: Ian Lewis <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Fixes slsa-framework#2311

Add a `secure-package-download` action so that users can more easily
download a tgz artifact built by the Node.js builder.

Signed-off-by: Ian Lewis <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/coreos/go-oidc/v3](https://togithub.com/coreos/go-oidc) |
require | minor | `v3.5.0` -> `v3.6.0` |
| [github.com/go-openapi/swag](https://togithub.com/go-openapi/swag) |
require | patch | `v0.22.3` -> `v0.22.4` |
| [github.com/sigstore/rekor](https://togithub.com/sigstore/rekor) |
require | patch | `v1.2.0` -> `v1.2.1` |
| golang.org/x/oauth2 | require | minor | `v0.8.0` -> `v0.9.0` |

---------

Signed-off-by: Ian Lewis <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: laurentsimon <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
enteraga6 and others added 14 commits July 7, 2023 21:35
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Copy link
Collaborator

@laurentsimon laurentsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be changes to files that are out of scope of the PR. Is it a git / merge problem?

@enteraga6
Copy link
Collaborator Author

Yes, everything is synced up with the main branch now after resolving the conflicts. Sorry about that.

@enteraga6 enteraga6 changed the title Runfile and Java Artifact Support Feat: Runfile and java artifact support for Bazel Builder Jul 8, 2023
@enteraga6 enteraga6 changed the title Feat: Runfile and java artifact support for Bazel Builder feat: Runfile and java artifact support for Bazel Builder Jul 8, 2023
@enteraga6
Copy link
Collaborator Author

closes #2332

internal/builders/bazel/action.yml Outdated Show resolved Hide resolved
@laurentsimon laurentsimon merged commit ba8a119 into slsa-framework:main Jul 13, 2023
74 checks passed
enteraga6 added a commit to enteraga6/slsa-github-generator that referenced this pull request Jul 18, 2023
…work#2362)

cc: @mihaimaruseac

This will provide support for artifacts that also need runfiles. Users
can use a flag, `needs-runfiles`, to also package the artifact alongside
the runfiles Bazel generates if the user deems it as necessary.

Also, support for Java artifacts is made available by packaging the JARs
to be standalone through a format in Bazel called `_deploy.jar`.
Alongside the `_deploy.jar`, there will be a modified `run-script` that
allows the users that download the artifact to run the run-script by
using a flag called `local_javabin`, where they put the path to their
own java bin such that it is utilized by the run-script. This run-script
is generated by Bazel from a template and later modified in the
`build.sh` in the internal part of the builder to add this flag for the
users. More information is available on the readme.

Java targets will automatically be converted to their `_deploy.jar` with
this. Three flags are used for users that have java targets:

`includes-java`: if true then adds an additional flag to build command
as well as rule for local java repo in WORKSPACE in order to utilize the
`--singlejar` capability of run-script for `_deploy.jar` such that the
remote jdk does not need to be included in runfiles. Doing it like this
prevents massive bloat when attesting.

`user-java-distribution` and `user-java-version`: let the user specify
the exact java they want to use to build

When users run the run-script they will include an additional flag
`local_javabin` which they will set to their local javabin that the
run-script will utilize to run the `_deploy.jar`

A combination of `bazel query` and `bazel cquery` were used to resolved
edge cases with the implementation.

---------

Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Ian Lewis <[email protected]>
Signed-off-by: laurentsimon <[email protected]>
Signed-off-by: laurentsimon <[email protected]>
Co-authored-by: Ian Lewis <[email protected]>
Co-authored-by: laurentsimon <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
enteraga6 added a commit to enteraga6/slsa-github-generator that referenced this pull request Aug 8, 2023
…work#2362)

cc: @mihaimaruseac

This will provide support for artifacts that also need runfiles. Users
can use a flag, `needs-runfiles`, to also package the artifact alongside
the runfiles Bazel generates if the user deems it as necessary.

Also, support for Java artifacts is made available by packaging the JARs
to be standalone through a format in Bazel called `_deploy.jar`.
Alongside the `_deploy.jar`, there will be a modified `run-script` that
allows the users that download the artifact to run the run-script by
using a flag called `local_javabin`, where they put the path to their
own java bin such that it is utilized by the run-script. This run-script
is generated by Bazel from a template and later modified in the
`build.sh` in the internal part of the builder to add this flag for the
users. More information is available on the readme.

Java targets will automatically be converted to their `_deploy.jar` with
this. Three flags are used for users that have java targets:

`includes-java`: if true then adds an additional flag to build command
as well as rule for local java repo in WORKSPACE in order to utilize the
`--singlejar` capability of run-script for `_deploy.jar` such that the
remote jdk does not need to be included in runfiles. Doing it like this
prevents massive bloat when attesting.

`user-java-distribution` and `user-java-version`: let the user specify
the exact java they want to use to build

When users run the run-script they will include an additional flag
`local_javabin` which they will set to their local javabin that the
run-script will utilize to run the `_deploy.jar`

A combination of `bazel query` and `bazel cquery` were used to resolved
edge cases with the implementation.

---------

Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
Signed-off-by: Ian Lewis <[email protected]>
Signed-off-by: laurentsimon <[email protected]>
Signed-off-by: laurentsimon <[email protected]>
Co-authored-by: Ian Lewis <[email protected]>
Co-authored-by: laurentsimon <[email protected]>
Signed-off-by: Noah Elzner <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants