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

Changes to add results to a task #1888

Merged
merged 1 commit into from
Jan 22, 2020
Merged

Conversation

othomann
Copy link
Contributor

@othomann othomann commented Jan 16, 2020

Changes

This is the first set of changes that modifies the task spec to add results. It also modifies the entrypoint to feed the termination log with the expected results.
It also adds a new cli argument to the entrypoint cmd (-results).

Part of #1273

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

Add results to the task spec and handle all changes in the entrypoint code.

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Jan 16, 2020
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 16, 2020
@othomann othomann requested a review from a user January 16, 2020 21:26
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 62.5% -32.5

pkg/apis/pipeline/v1alpha1/resource_types.go Outdated Show resolved Hide resolved
pkg/entrypoint/entrypointer.go Outdated Show resolved Hide resolved
pkg/pod/entrypoint.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 62.5% -32.5

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 62.5% -32.5

pkg/apis/pipeline/v1alpha1/resource_types.go Outdated Show resolved Hide resolved
pkg/entrypoint/entrypointer.go Outdated Show resolved Hide resolved
pkg/entrypoint/entrypointer.go Outdated Show resolved Hide resolved
pkg/entrypoint/entrypointer.go Show resolved Hide resolved
pkg/pod/entrypoint.go Outdated Show resolved Hide resolved
pkg/entrypoint/entrypointer.go Outdated Show resolved Hide resolved
pkg/apis/pipeline/v1alpha1/task_types.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 64.5% -30.5

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

output = append(output, v1alpha1.PipelineResourceResult{
Key: resultFile,
Value: string(fileContents),
ResultType: "result",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use the new ResultType here instead of hard coding this string?

@@ -185,7 +185,7 @@ There are known issues with the existing implementation of sidecars:

- When the `nop` image does provide the sidecar's command, the sidecar will continue to
run even after `nop` has been swapped into the sidecar container's image
field. See https://github.com/tektoncd/pipeline/issues/1347 for the issue
field. See <https://github.com/tektoncd/pipeline/issues/1347> for the issue
Copy link

Choose a reason for hiding this comment

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

Minor nit: since we're changing this file, I suggest updating it to See [the issue tracking this bug](https://github.com/tektoncd/pipeline/issues/1347).

// Name the given name
Name string `json:"name"`

// Description the given description
Copy link

Choose a reason for hiding this comment

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

Suggest tweaking the wording and adding an +optional tag so it becomes:

// Description is a human-readable description of the result
// +optional

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

@othomann othomann force-pushed the task_results branch 2 times, most recently from 8b35cdf to fe71c51 Compare January 17, 2020 21:03
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 57.1% -37.9

@othomann
Copy link
Contributor Author

/test pull-tekton-pipeline-integration-tests

@bobcatfish
Copy link
Collaborator

I0117 21:16:30.477] 2020/01/17 21:16:30 main.go:734: provider gke, will acquire project type gke-project from boskos
I0117 21:21:30.475] 2020/01/17 21:21:30 main.go:316: Something went wrong: failed to prepare test environment: --provider=gke boskos failed to acquire project: resources not found

yikes! twice in a row 🤔

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 54.1% -40.9

@othomann
Copy link
Contributor Author

@vdemeester What kind of doc update do you want?

@@ -51,6 +52,12 @@ func main() {
Waiter: &realWaiter{},
Runner: &realRunner{},
PostWriter: &realPostWriter{},
Results: strings.Split(*results, ","),
}
if len(e.Results) >= 1 && e.Results[0] != "" {
Copy link

Choose a reason for hiding this comment

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

I am curious - what is the purpose of the e.Results[0] != "" check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because strings.Split("", ",") returns an array with an empty string in it. So an empty string means we try to read the folder as a file and it fails.

@ghost
Copy link

ghost commented Jan 21, 2020

Since this change is mostly internal to Tekton (for now... it will be exposed to users in an upcoming PR based on this work) I think the best place for documentation would be in docs/developers/README.md. We could add a section called "How task results are defined and outputted by a task" or something like that. This could then explain the -results flag for the entrypoint, the directory that is created for results, the files that are written for each result, and finally the way this data is formatted in the termination log of each step.

Does that make sense?

@othomann
Copy link
Contributor Author

@sbwsg should the doc update be part of this PR?

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 54.1% -40.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 54.1% -40.9

@ghost
Copy link

ghost commented Jan 21, 2020

@othomann yeah I think so.

@ghost
Copy link

ghost commented Jan 21, 2020

/approve

@othomann
Copy link
Contributor Author

@sbwsg ok done. Commits squashed and tests are running again. Let me know if there is anything else that is needed to get this approved.

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 21, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 54.1% -40.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/entrypoint/entrypointer.go 95.0% 54.1% -40.9

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/lgtm
/meow

I'll update v1alpha2 struct accordingly 👼

docs/developers/README.md Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

@vdemeester: cat image

In response to this:

/lgtm
/meow

I'll update v1alpha2 struct accordingly 👼

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.

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 22, 2020
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbwsg, vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vdemeester
Copy link
Member

I0122 10:31:14.503] pkg/pod/status.go:259:13: unslice: could simplify podInstance.Status.ContainerStatuses[:] to podInstance.Status.ContainerStatuses (gocritic)
I0122 10:31:14.503] 	sort.Slice(podInstance.Status.ContainerStatuses[:], func(i, j int) bool {
I0122 10:31:14.503] 	           ^
I0122 10:31:14.503] cmd/pullrequest-init/main.go:21: File is not `goimports`-ed (goimports)
I0122 10:31:14.504] 	"fmt"

Interesting, the rebase made the lint fail 😅

@vdemeester
Copy link
Member

/test pull-tekton-pipeline-build-tests

@othomann
Copy link
Contributor Author

@vdemeester I haven't changed the files pkg/pod/status.go or cmd/pullrequest-init/main.go so I don't see why this is reported against this PR.
Once this is merged, I'll work with Eduardo to get the next PR for updating the task run status.

@tekton-robot tekton-robot merged commit 07c6201 into tektoncd:master Jan 22, 2020
@vdemeester
Copy link
Member

@othomann it was some previous PR merged that did that, it got fixed 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/api Indicates an issue or PR that deals with the API. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants