-
Notifications
You must be signed in to change notification settings - Fork 616
docker-container: write github actions payload to container for provenance #3453
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
Conversation
73ed9c5 to
02d8edf
Compare
driver/docker-container/factory.go
Outdated
| return nil, errors.Errorf("invalid env option %q, expecting env.FOO=bar", k) | ||
| } | ||
| d.env = append(d.env, fmt.Sprintf("%s=%s", envName, v)) | ||
| case k == "no-gha-event": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something more descriptive like "provenance-add-github-event" (provenance-add-github-actions-context)
driver/docker-container/driver.go
Outdated
|
|
||
| func githubActionsEvent() ([]byte, error) { | ||
| m := make(map[string]any) | ||
| if v := os.Getenv("GITHUB_EVENT_NAME"); v != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only add the event scope if all the envs we expect to be present are actually present.
driver/docker-container/driver.go
Outdated
| if d.Files == nil { | ||
| d.Files = make(map[string][]byte) | ||
| } | ||
| d.Files["provenance.d/github_event.json"] = ghaedt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github_actions_context.json
02d8edf to
f092192
Compare
d982514 to
02d4768
Compare
aca6cd9 to
073002a
Compare
tonistiigi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion to move code, otherwise ok
driver/docker-container/driver.go
Outdated
| } | ||
| } | ||
|
|
||
| func githubActionsContext() ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though this is only used by container driver atm. I think it is better placed in generic pkg as not really driver specific in any way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to util/ghutil and added some tests.
…nance Signed-off-by: CrazyMax <[email protected]>
073002a to
7652057
Compare
alternative to and closes #3452
follow-up moby/buildkit#6210
needs docs follow-up at https://docs.docker.com/build/builders/drivers/docker-container/#synopsis
example: https://oci.dag.dev/?blob=public.ecr.aws/q3b5f1u4/test-docker-action@sha256:176f66ab52141487a3e5b06058f391d3e44c1f86511ec54a692eccd10989853d&mt=application%2Fvnd.in-toto%2Bjson&size=17247