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

[TEP-0100] Add functionality to be used in supporting minimal embedded status #4757

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

abayer
Copy link
Contributor

@abayer abayer commented Apr 13, 2022

Changes

This builds on #4694, #4734, and #4753. It will feed into a revamped #4739, all as part
of https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md
and #3140.

Specifically, this adds functionality to pkg/reconciler/pipelinerun/resources in
pipelinerunresolution.go and pipelinerunstate.go which will be needed for the
full implementation. These changes won't have any effects in the current situation,
because pr.Status.ChildReferences is never populated, so can be made independently
of the rest of the implementation, thus also shrinking the size of the rest of the
implementation PR(s) for easier review.

/kind tep
/kind feature

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in
    (if there are no user facing changes, use release note "NONE")

Release Notes

NONE

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. kind/tep Categorizes issue or PR as related to a TEP (or needs a TEP). kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 13, 2022
@abayer
Copy link
Contributor Author

abayer commented Apr 13, 2022

/assign @lbernick
/assign @vdemeester
/assign @jerop

@abayer
Copy link
Contributor Author

abayer commented Apr 13, 2022

/retest

var childRefs []v1beta1.ChildStatusReference

for _, rprt := range state {
if rprt.ResolvedConditionChecks == nil && ((rprt.CustomTask && rprt.Run == nil) || (!rprt.CustomTask && rprt.TaskRun == nil)) {
Copy link
Member

Choose a reason for hiding this comment

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

can this conditional logic be simplified? especially since isCustomTask just returns rprt.CustomTask.

One idea is to delete this block, and below have:

if rprt.CustomTask {
			if rprt.Run != nil {
				childAPIVersion = rprt.Run.APIVersion
			} else if rprt.ResolvedConditionChecks == nil {
				continue
                         } else {
				childAPIVersion = runVersion
			}
		} else {
			...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I think we still need/want that if chunk, but just for TaskRuns - ResolvedConditionChecks doesn't apply at all for Runs, so it's irrelevant there. Tweak incoming.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed!

t.Errorf("GetTaskRunName: %s", diff.PrintWantGot(d))
}
rnFromChildRefs := getRunName(nil, childRefs, tc.ptName, testPrName)
if d := cmp.Diff(tc.wantTrName, rnFromChildRefs); d != "" {
Copy link
Member

Choose a reason for hiding this comment

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

would it make sense to also check the output of getRunName(runsStatus, childRefs, tc.ptName, testPrName)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't hurt!

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 93.4% 92.3% -1.2
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.9% 96.9% -0.1

…d status

This builds on tektoncd#4694, tektoncd#4734, and tektoncd#4753. It will feed into a revamped tektoncd#4739, all as part
of https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md
and tektoncd#3140.

Specifically, this adds functionality to `pkg/reconciler/pipelinerun/resources` in
`pipelinerunresolution.go` and `pipelinerunstate.go` which will be needed for the
full implementation. These changes won't have any effects in the current situation,
because `pr.Status.ChildReferences` is never populated, so can be made independently
of the rest of the implementation, thus also shrinking the size of the rest of the
implementation PR(s) for easier review.

Signed-off-by: Andrew Bayer <[email protected]>
@abayer abayer force-pushed the embedded-status-support-work branch from 88421cc to 17af0fb Compare April 13, 2022 18:05
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 93.4% 92.3% -1.2
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 96.9% 97.2% 0.3

Copy link
Member

@lbernick lbernick left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 13, 2022
@lbernick
Copy link
Member

@tektoncd/core-maintainers please take a look at this if you have time; this PR will unblock Andrew's work implementing TEP-0100

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 14, 2022
@tekton-robot tekton-robot merged commit 8859310 into tektoncd:main Apr 14, 2022
abayer added a commit to abayer/tektoncd-pipeline that referenced this pull request Apr 14, 2022
And of course, this is part of https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md,
building on a pile of other PRs (tektoncd#4705, tektoncd#4734, tektoncd#4753, tektoncd#4757).

This adds a new function to `pkg/reconciler/pipelinerun/pipelinerun.go`,
specifically for updating `pr.Status.ChildReferences` during reconciliation. It's
analogous to the existing `updatePipelineRunStatusFromTaskRuns` and
`updatePipelineRunStatusFromRuns` functions. This PR doesn't actually call the
new function - behavior is exactly the same. But it adds the new function,
along with other functions it depends on. In the final step of the
implementation, these other functions will also be used in `...FromTaskRuns`
and/or `...FromRuns`.

I also reworked `pkg/reconciler/pipelinerun/pipelinerun_updatestatus_test.go`
to improve its test fixtures, so that they're easier to reuse and instantiated
via YAML parsing as much as possible.

Signed-off-by: Andrew Bayer <[email protected]>
abayer added a commit to abayer/tektoncd-pipeline that referenced this pull request Apr 14, 2022
And of course, this is part of https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md,
building on a pile of other PRs (tektoncd#4705, tektoncd#4734, tektoncd#4753, tektoncd#4757).

This adds a new function to `pkg/reconciler/pipelinerun/pipelinerun.go`,
specifically for updating `pr.Status.ChildReferences` during reconciliation. It's
analogous to the existing `updatePipelineRunStatusFromTaskRuns` and
`updatePipelineRunStatusFromRuns` functions. This PR doesn't actually call the
new function - behavior is exactly the same. But it adds the new function,
along with other functions it depends on. In the final step of the
implementation, these other functions will also be used in `...FromTaskRuns`
and/or `...FromRuns`.

I also reworked `pkg/reconciler/pipelinerun/pipelinerun_updatestatus_test.go`
to improve its test fixtures, so that they're easier to reuse and instantiated
via YAML parsing as much as possible.

Signed-off-by: Andrew Bayer <[email protected]>
tekton-robot pushed a commit that referenced this pull request Apr 14, 2022
And of course, this is part of https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md,
building on a pile of other PRs (#4705, #4734, #4753, #4757).

This adds a new function to `pkg/reconciler/pipelinerun/pipelinerun.go`,
specifically for updating `pr.Status.ChildReferences` during reconciliation. It's
analogous to the existing `updatePipelineRunStatusFromTaskRuns` and
`updatePipelineRunStatusFromRuns` functions. This PR doesn't actually call the
new function - behavior is exactly the same. But it adds the new function,
along with other functions it depends on. In the final step of the
implementation, these other functions will also be used in `...FromTaskRuns`
and/or `...FromRuns`.

I also reworked `pkg/reconciler/pipelinerun/pipelinerun_updatestatus_test.go`
to improve its test fixtures, so that they're easier to reuse and instantiated
via YAML parsing as much as possible.

Signed-off-by: Andrew Bayer <[email protected]>
abayer added a commit to abayer/tektoncd-pipeline that referenced this pull request Apr 14, 2022
…pelineRuns

See:
* https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md
* tektoncd#4705
* tektoncd#4734
* tektoncd#4753
* tektoncd#4757
* tektoncd#4760
* tektoncd#3140

This implements TEP-0100, allowing for choosing between the original full embedded `TaskRun` and
`Run` statuses in `PipelineRun` statuses, minimal child references to the underlying `TaskRun` and
`Run`s, or both, building on top of all the other PRs referenced above.

Signed-off-by: Andrew Bayer <[email protected]>
tekton-robot pushed a commit that referenced this pull request Apr 15, 2022
…pelineRuns

See:
* https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md
* #4705
* #4734
* #4753
* #4757
* #4760
* #3140

This implements TEP-0100, allowing for choosing between the original full embedded `TaskRun` and
`Run` statuses in `PipelineRun` statuses, minimal child references to the underlying `TaskRun` and
`Run`s, or both, building on top of all the other PRs referenced above.

Signed-off-by: Andrew Bayer <[email protected]>
chitrangpatel pushed a commit to chitrangpatel/pipeline that referenced this pull request May 3, 2022
And of course, this is part of https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md,
building on a pile of other PRs (tektoncd#4705, tektoncd#4734, tektoncd#4753, tektoncd#4757).

This adds a new function to `pkg/reconciler/pipelinerun/pipelinerun.go`,
specifically for updating `pr.Status.ChildReferences` during reconciliation. It's
analogous to the existing `updatePipelineRunStatusFromTaskRuns` and
`updatePipelineRunStatusFromRuns` functions. This PR doesn't actually call the
new function - behavior is exactly the same. But it adds the new function,
along with other functions it depends on. In the final step of the
implementation, these other functions will also be used in `...FromTaskRuns`
and/or `...FromRuns`.

I also reworked `pkg/reconciler/pipelinerun/pipelinerun_updatestatus_test.go`
to improve its test fixtures, so that they're easier to reuse and instantiated
via YAML parsing as much as possible.

Signed-off-by: Andrew Bayer <[email protected]>
chitrangpatel pushed a commit to chitrangpatel/pipeline that referenced this pull request May 3, 2022
…pelineRuns

See:
* https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md
* tektoncd#4705
* tektoncd#4734
* tektoncd#4753
* tektoncd#4757
* tektoncd#4760
* tektoncd#3140

This implements TEP-0100, allowing for choosing between the original full embedded `TaskRun` and
`Run` statuses in `PipelineRun` statuses, minimal child references to the underlying `TaskRun` and
`Run`s, or both, building on top of all the other PRs referenced above.

Signed-off-by: Andrew Bayer <[email protected]>
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. kind/feature Categorizes issue or PR as related to a new feature. kind/tep Categorizes issue or PR as related to a TEP (or needs a TEP). lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants