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

WIP Refactor ref resolution #4108

Closed
wants to merge 1 commit into from
Closed

WIP Refactor ref resolution #4108

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 20, 2021

Changes

Fixes #3305

This PR refactors the way task and pipelinerun resolution works. The intention with this PR is to be entirely backwards-compatible with the existing way resolution works. In other words, I'm not trying to introduce new behaviours with these commits, just set the stage for future possible improvements.

I'm pushing this up now to start getting feedback from interested parties. I've still got a ways to go in terms of getting new unit tests updated and introduced. I'm hopeful that integration tests shouldn't be too badly affected. 🤞

There are two commits as part of this PR to aid reviewers:

  1. Remove task and pipeline spec resolution from the existing reconcilers
  2. Move ref resolution to new reconcilers

I'll squash these once we're happy to move ahead.

Prior to this commit the taskrun and pipelinerun reconcilers were responsible for resolving specs from taskRef / taskSpec / pipelineRef / pipelineSpec / bundles.

The first commit in this PR updates the existing taskrun/pipelinerun reconcilers to ignore any taskrun or pipelinerun that doesn't have a spec cached in their status. This means all taskruns and pipelineruns are ignored - the logic for populating status from a spec has been removed entirely from the controller.

The second commit in this PR introduces 2 new controllers whose sole responsibility is to resolve specs from taskruns and pipelineruns. Resolved specs then get written to the status field of the runs and the "old" reconcilers are able to pick them up and begin actuating them as usual.

The new resolver reconcilers are also currently responsible for propagating labels and annotations from the task / pipeline to the taskrun / pipelinerun. This is because our existing taskrun/pipelinerun reconcilers expect only the spec to be embedded in their status fields, not the entire task/pipeline objects. The knock-on effect of this is that the metadata from the resolved task/pipeline is lost by the time the taskrun/pipelinerun reconciler receive them.

One final thing this commit introduces is a library, internal/resolution that may eventually be available for downstream projects to implement their own task and pipeline resolvers. At the moment all it does is expose the default resolution behaviour of Tekton Pipelines as a func + a couple of useful helper methods for propagating labels/annotations. This would allow someone implementing their own resolver reconciler to generally adhere to the Tekton Pipelines "resolution contract" with only 100 lines or so of Go. It's not yet intended for external consumption but I think it's an interesting direction we can take future work on tekton's built-in resolution code and provides a nice enough separation of concerns in our own codebase.

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 or deleted (only if no user facing changes)

Release Notes

Resolution of tasks and pipelines from taskruns and pipelineruns has been refactored into new reconcilers. There should be no visible behavioral differences to the way taskruns and pipelineruns are executed as a result of this change but we are laying the groundwork for future improvements and extensions.

@ghost ghost added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jul 20, 2021
@ghost ghost added this to the Pipelines v0.26 milestone Jul 20, 2021
@ghost ghost requested review from vdemeester and pierretasci July 20, 2021 16:25
@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 20, 2021
@tekton-robot tekton-robot requested a review from dlorenc July 20, 2021 16:25
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 20, 2021
@ghost ghost removed the request for review from dlorenc July 20, 2021 16:52
@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/controller.go 100.0% 93.5% -6.5
pkg/reconciler/pipelinerun/pipelinerun.go 83.1% 32.7% -50.4
pkg/reconciler/taskrun/controller.go 96.4% 90.0% -6.4
pkg/reconciler/taskrun/taskrun.go 76.9% 34.6% -42.3

@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/controller.go 100.0% 93.5% -6.5
pkg/reconciler/pipelinerun/pipelinerun.go 83.1% 32.7% -50.4
pkg/reconciler/taskrun/controller.go 96.4% 90.0% -6.4
pkg/reconciler/taskrun/taskrun.go 76.9% 34.6% -42.3

@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/controller.go 100.0% 93.5% -6.5
pkg/reconciler/pipelinerun/pipelinerun.go 83.1% 32.7% -50.4
pkg/reconciler/taskrun/controller.go 96.4% 90.0% -6.4
pkg/reconciler/taskrun/taskrun.go 76.9% 34.6% -42.3

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 22, 2021
@vdemeester
Copy link
Member

The first commit in this PR updates the existing taskrun/pipelinerun reconcilers to ignore any taskrun or pipelinerun that doesn't have a spec cached in their status. This means all taskruns and pipelineruns are ignored - the logic for populating status from a spec has been removed entirely from the controller.

The second commit in this PR introduces 2 new controllers whose sole responsibility is to resolve specs from taskruns and pipelineruns. Resolved specs then get written to the status field of the runs and the "old" reconcilers are able to pick them up and begin actuating them as usual.

This means that if I were to checkout the 1st commit, the controller wouldn't reconcile any new PipelineRun/TaskRun right ?

@vdemeester
Copy link
Member

One final thing this commit introduces is a library, pkg/resolution that can be used by downstream projects to implement their own task and pipeline resolvers. All it does is expose the default resolution behaviour of Tekton Pipelines as a func + a couple of useful helper methods for propagating labels/annotations. This would allow someone implementing their own resolver reconciler to generally adhere to the Tekton Pipelines "resolution contract" with only 100 lines or so of Go. It's not yet intended for external consumption but I think it's an interesting direction we can take future work on tekton's built-in resolution code and provides a nice enough separation of concerns in our own codebase.

👍🏼 on this. If we feel it's not ready for external consumption yet, we could always hide it behind the internal package (pkg/internal/resolution) 👼🏼

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.

One question, but I like that approach 🙃

Comment on lines 102 to 96
newPR, err := r.pipelineClientSet.TektonV1beta1().PipelineRuns(pr.Namespace).Update(ctx, pr, metav1.UpdateOptions{})
if err != nil {
err = fmt.Errorf("error committing updated pipeline spec to pipelinerun %s/%s: %w", namespace, name, err)
pr.Status.MarkFailed(resolution.ReasonPipelineRunResolutionFailed, err.Error())
logger.Error(err)
return fmt.Errorf("error updating pipelinerun spec: %w", err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to do an update instead of a patch ? I think it could this result in a weird race condition (if there is a mutating webhook doing something with PipelineRun in the meantime).

Copy link
Author

Choose a reason for hiding this comment

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

Very interesting! I hadn't thought about the mutating webhook case. I'll try this with a patch operation instead.

Copy link
Author

@ghost ghost Jul 27, 2021

Choose a reason for hiding this comment

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

As far as I can tell our test clients don't support Patch() operations on resources. I can update the resolver reconcilers to use Patch instead of Update but the unit tests will rely on a workaround that uses Update still. This means we're not exercising the exact same resolution behaviour between unit tests and release. I'm hopeful integration will work without any such workarounds though. @vdemeester are you ok with this tradeoff?

Copy link
Author

Choose a reason for hiding this comment

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

I've updated the pkg/reconciler/taskrun/taskrun_test.go file so that the tests pass. Changes aren't perfect yet (in particular - it looks like the number of events emitted has changed between main and my branch) but it shows how the resolver updates in unit tests use Update() while the resolver reconciler uses Patch()

@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 Jul 23, 2021
@ghost
Copy link
Author

ghost commented Jul 23, 2021

@vdemeester You're absolutely right - checking out the first commit results in no taskruns or pipelineruns being reconciled. They remain fixed in limbo.

I like your idea of keeping pkg/resolution under internal. That'll make intention much clearer!

@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2021
@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/controller.go 100.0% 93.3% -6.7
pkg/reconciler/pipelinerun/pipelinerun.go 83.4% 32.7% -50.7
pkg/reconciler/taskrun/controller.go 96.3% 89.7% -6.6
pkg/reconciler/taskrun/taskrun.go 77.3% 34.9% -42.4

@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 27, 2021
@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/controller.go 100.0% 93.3% -6.7
pkg/reconciler/pipelinerun/pipelinerun.go 83.4% 32.7% -50.7
pkg/reconciler/taskrun/controller.go 96.3% 89.7% -6.6
pkg/reconciler/taskrun/taskrun.go 77.3% 76.9% -0.4

@ghost
Copy link
Author

ghost commented Jul 27, 2021

Moved the library funcs under the internal directory at the root of the project.

@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/controller.go 100.0% 93.3% -6.7
pkg/reconciler/pipelinerun/pipelinerun.go 83.4% 32.7% -50.7
pkg/reconciler/taskrun/controller.go 96.3% 89.7% -6.6
pkg/reconciler/taskrun/taskrun.go 77.3% 76.9% -0.4

@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/controller.go 100.0% 93.3% -6.7
pkg/reconciler/pipelinerun/pipelinerun.go 83.4% 77.9% -5.5
pkg/reconciler/taskrun/controller.go 96.3% 89.7% -6.6
pkg/reconciler/taskrun/taskrun.go 77.3% 76.9% -0.4

@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/controller.go 100.0% 93.3% -6.7
pkg/reconciler/pipelinerun/pipelinerun.go 83.4% 77.9% -5.5
pkg/reconciler/taskrun/controller.go 96.3% 89.7% -6.6
pkg/reconciler/taskrun/taskrun.go 77.3% 76.9% -0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 0.0%
internal/resolution/taskrun.go Do not exist 0.0%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 57.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.5% 79.5% 2.0

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 0.0%
internal/resolution/taskrun.go Do not exist 0.0%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 57.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.5% 77.9% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 0.0%
internal/resolution/taskrun.go Do not exist 0.0%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 43.2%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 0.0%
internal/resolution/taskrun.go Do not exist 0.0%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 43.2%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@ghost
Copy link
Author

ghost commented Aug 11, 2021

/test tekton-pipeline-unit-tests

/test pull-tekton-pipeline-alpha-integration-tests

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 0.0%
internal/resolution/taskrun.go Do not exist 72.7%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 43.2%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 0.0%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 43.2%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 0.0%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 43.2%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 77.4% -5.7
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 43.2%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 77.4% -5.7
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 34.3%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 77.4% -5.7
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 37.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 37.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@ghost
Copy link
Author

ghost commented Aug 12, 2021

/test pull-tekton-pipeline-alpha-integration-tests

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 54.3%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@ghost
Copy link
Author

ghost commented Aug 12, 2021

/test pull-tekton-pipeline-alpha-integration-tests

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 54.3%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 34.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 94.3%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 42.3%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 97.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 42.9%
pkg/reconciler/resolver/patch.go Do not exist 84.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 0.0%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 0.0%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 97.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 78.6%
pkg/reconciler/resolver/patch.go Do not exist 84.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 16.3%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 97.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 78.6%
pkg/reconciler/resolver/patch.go Do not exist 84.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 18.6%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 97.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 85.7%
pkg/reconciler/resolver/patch.go Do not exist 84.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 32.6%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 97.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 85.7%
pkg/reconciler/resolver/patch.go Do not exist 84.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 46.5%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 97.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 78.5% -4.6
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 85.7%
pkg/reconciler/resolver/patch.go Do not exist 84.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 95.5%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 97.1%
pkg/reconciler/taskrun/controller.go 96.3% 96.6% 0.3
pkg/reconciler/taskrun/taskrun.go 77.6% 78.0% 0.4

This commit introduces two new experimental reconcilers to Pipelines' codebase.
These reconcilers perform "resolution" of taskRefs and pipelineRefs. When
they're enabled the taskrun and pipelinerun reconcilers no longer attempt to
resolve taskRefs/pipelineRefs themselves and instead they'll wait for the
`status.taskSpec` and `status.pipelineSpec` to be populated before they proceed
with actuating the TaskRun/PipelineRun.

There are two new flags introduced with this commit:

1. A behavioural feature flag (`experimental-disable-ref-resolution`) that
switches off the TaskRun and PipelineRun reconciler resolution processes. When
this flag is to "true" TaskRuns and PipelineRuns will be left in a transitional
state until their `status` is populated with a `taskSpec`/`pipelineSpec`. This
allows an external process (like the resolver reconcilers, or a third-party
controller) to perform this resolution work instead and update the resources
with the specs. When this flag is "false" (the default) then resolution happens
just as it always did in the TaskRun / PipelineRun reconcilers. In this way it's
totally backwards compatible.

2. A command line flag that must be passed to the controller binary via an arg
(`-experimental-enable-resolution-reconcilers`) which switches on the
experimental "resolution reconcilers". When this flag is passed the controller
will spin up two additional reconcilers when it boots up. This means a restart
of the controller is required when changing this flag.

Both of these modes are extremely experimental.
@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
internal/resolution/errors.go Do not exist 100.0%
internal/resolution/meta.go Do not exist 100.0%
internal/resolution/pipelinerun.go Do not exist 83.3%
internal/resolution/taskrun.go Do not exist 81.8%
pkg/apis/config/feature_flags.go 84.4% 83.0% -1.5
pkg/reconciler/pipelinerun/pipelinerun.go 83.2% 81.7% -1.5
pkg/reconciler/resolver/errors.go Do not exist 0.0%
pkg/reconciler/resolver/leader_aware.go Do not exist 85.7%
pkg/reconciler/resolver/patch.go Do not exist 84.6%
pkg/reconciler/resolver/pipelinerun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/pipelinerun_resolver_reconciler.go Do not exist 95.5%
pkg/reconciler/resolver/taskrun_resolver_controller.go Do not exist 89.5%
pkg/reconciler/resolver/taskrun_resolver_reconciler.go Do not exist 97.1%
pkg/reconciler/taskrun/taskrun.go 77.6% 75.7% -1.9

@ghost
Copy link
Author

ghost commented Aug 17, 2021

I've decided to start again with a completely different approach to this refactor and will open a new PR with a clean slate.

See #4168

This pull request was closed.
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor the way resources are injected into the reconcilers
2 participants