-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
kind/feat: Surface artifacts through termination message #7714
kind/feat: Surface artifacts through termination message #7714
Conversation
Skipping CI for Draft Pull Request. |
/kind feat |
@ericzzzzzzz: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/kind feature |
The following is the coverage report on the affected files.
|
16ed163
to
7443e91
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
Some questions about the pr:
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
b8abe73
to
1ea4d6e
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
1ea4d6e
to
285f5e6
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
285f5e6
to
de45f72
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
hi @afrittoli I updated the pr according your suggestions! Please take another look, thank you for the review ! |
7b0282b
to
7e2768c
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
- name: artifacts-consumer-python | ||
image: python:latest | ||
script: | | ||
#!/usr/bin/env python3 | ||
import json | ||
data = json.loads('$(steps.artifacts-producer.outputs)') | ||
print(data[0]['uri']) |
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.
+1
dataBytes, err := os.ReadFile(e.Command[0]) | ||
if err != nil { | ||
return err | ||
} | ||
fileContent := string(dataBytes) | ||
v, err := replaceValue(artifactref.StepArtifactRegex, fileContent, stepDir, getArtifactValues) | ||
if err != nil { | ||
return err | ||
} | ||
if v != fileContent { | ||
temp, err := writeToTempFile(v) | ||
if err != nil { | ||
return err | ||
} | ||
e.Command = []string{temp.Name()} | ||
} |
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.
According to the coverage report, this section is not well covered by unit tests, but we have E2E coverage for this, so it should be fine.
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.
Thanks for all the updates, it looks good to me.
I only have one comment, about one logging line, nothing worth blocking this PR one.
Would you mind addressing that in a follow-up PR?
/lgtm
@@ -281,6 +282,15 @@ func setTaskRunStatusBasedOnStepStatus(ctx context.Context, logger *zap.SugaredL | |||
logger.Errorf("termination message could not be parsed as JSON: %v", err) | |||
merr = multierror.Append(merr, err) | |||
} else { | |||
for _, r := range results { | |||
if r.ResultType == result.ArtifactsResultType { | |||
if err := json.Unmarshal([]byte(r.Value), &as); err != nil { |
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.
NIT: in all other error cases, we have a logger.Errorf
message, should we have one here too?
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.
sure I'll do it !
Fixes: #7717
TaskRun
status stepState.Changes
$(step.artifacts.path)
to/tekton/steps/<container-name>/artifacts/provenance.json
in the Step container at runtime, and users can write artifacts provenance data to the path. Details about the data structure https://github.com/tektoncd/community/blob/main/teps/0147-tekton-artifacts-phase1.md#artifact-provenance-datatermination message
, provenance data is written to termination message and populates tostepState
.$(steps.<the-name-of-step>.outputs)
--> outputs are artifact values from the first artifact$(steps.<the-name-of-step>.outputs.<artifact-name>)
--> outputs for a specific artifact$(steps.<the-name-of-step>.inputs)
--> inputs are artifact values from the first artifact$(steps.<the-name-of-step>.inputs.<artifact-name>)
--> inputs for a specific artifact$(step.artifacts.path)
and$(steps.<step-name>.outputs/inputs.<artifact-category-name>)
can only be used in step.Script, step.Env, step.Args, steps.Common with enable-artifacts feature is set totrue
$(steps.<step-name>.outputs/inputs.<artifact-category-name>)
is used, we will read the script file and re-write container command with script.Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes
/kind feat