pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

Rely on knative/pkg to update TaskRuns

Open imjasonh opened this issue 3 years ago • 12 comments

This changes the TaskRun reconciler to never call Update itself; instead, Knative controller infrastructure will be responsible for Updating TaskRuns if it has determined they've changed.

This also changes changeset detection to happen once at init-time, since it doesn't change for the lifetime of the controller.

finishReconcileUpdateEmitEvents is now only responsible for emitting events. This could be simplified even further in a later change.

Proof of concept for https://github.com/tektoncd/pipeline/issues/5146

/kind cleanup

Submitter Checklist

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

  • [x] Has Docs included if any changes are user facing
  • [x] Has Tests included if any functionality added or changed
  • [x] Follows the commit message standard
  • [x] Meets the Tekton contributor standards (including functionality, content, code)
  • [x] Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • [x] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • [x] Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

PR friction log:

  • the kind label wasn't set when I created the PR with /kind cleanup, causing CI ❌
  • manually adding the label didn't cause the label check to run, so still ❌

imjasonh avatar Jul 18 '22 15:07 imjasonh

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

tekton-robot avatar Jul 18 '22 15:07 tekton-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please ask for approval from imjasonh after the PR has been reviewed.

The full list of commands accepted by this bot can be found 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 avatar Jul 18 '22 15:07 tekton-robot

/test all (Just realized it was skipping CI.. 🙃 )

vdemeester avatar Jul 21 '22 09:07 vdemeester

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/taskrun/taskrun.go 80.3% 80.0% -0.3

tekton-robot avatar Jul 21 '22 09:07 tekton-robot

/test all (Just realized it was skipping CI.. 🙃 )

Yeah, it's got some work to do to pass even the unit tests. I might try this as a smaller change, rather than also refactoring Cloud Events emitting as part of this change.

Stay tuned!

imjasonh avatar Jul 21 '22 10:07 imjasonh

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/taskrun/taskrun.go 80.3% 80.7% 0.3

tekton-robot avatar Jul 21 '22 19:07 tekton-robot

It seems something somewhere was depending on this to persist the task labels or something; this fails on the only test that checks that the task label is persisted on the taskrun.

    taskrun_test.go:1983: Labels were not added to task run
    taskrun_test.go:1986: Did not get expected label (-want, +got):   string(
        -       "test-task",
        +       "",
          )

Anyway, I'll keep plugging away later.

imjasonh avatar Jul 21 '22 20:07 imjasonh

/test check-pr-has-kind-label

afrittoli avatar Aug 08 '22 10:08 afrittoli

@afrittoli: The specified target(s) for /test were not found. The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-alpha-integration-tests
  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-integration-tests
  • /test tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test check-pr-has-kind-label

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 avatar Aug 08 '22 10:08 tekton-robot

PR friction log:

  • the kind label wasn't set when I created the PR with /kind cleanup, causing CI ❌
  • manually adding the label didn't cause the label check to run, so still ❌

Thank you for tracking these. They should be fixed now.

afrittoli avatar Aug 08 '22 10:08 afrittoli

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/taskrun/taskrun.go 80.6% 80.3% -0.3

tekton-robot avatar Aug 09 '22 02:08 tekton-robot

/retest

abayer avatar Aug 15 '22 16:08 abayer

@imjasonh what's the status ? 🙃 (it's red right now because of the rebase required I guess ?)

vdemeester avatar Aug 18 '22 14:08 vdemeester

Aside from needing to rebase, I need to figure out why label propagation is broken by this.

I think we're relying on there being two updates of the object in etcd during the initial reconcile, so that cloudevent receivers can see the TaskRun has started, then also see it become Pending (I think). The model knative/pkg expects is that each time through ReconcileKind is zero-or-one etcd update, which conflicts with our usage. I think their model is simpler to understand than ours, and I'd like to get to it, without breaking cloudevents consumers.

...Then I got distracted with other stuff and haven't made it back to work on this. I'll rebase at least so it's not so red, but any help untangling this or better understanding of how this works would be helpful.

imjasonh avatar Aug 18 '22 14:08 imjasonh

Aside from needing to rebase, I need to figure out why label propagation is broken by this.

I think we're relying on there being two updates of the object in etcd during the initial reconcile, so that cloudevent receivers can see the TaskRun has started, then also see it become Pending (I think). The model knative/pkg expects is that each time through ReconcileKind is zero-or-one etcd update, which conflicts with our usage. I think their model is simpler to understand than ours, and I'd like to get to it, without breaking cloudevents consumers.

The started event and running events are sent during the same reconcile cycle, because I didn't want to rely on two reconcile cycles for that. Not sure why labels would not work... I wonder if it's something about how tests are designed?

afrittoli avatar Aug 18 '22 14:08 afrittoli

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/taskrun/taskrun.go 80.4% 79.8% -0.6

tekton-robot avatar Aug 18 '22 14:08 tekton-robot

@imjasonh: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-tekton-pipeline-unit-tests 3d79456d95c823f0d6d4250c3674a4dddda6bc51 link true /test tekton-pipeline-unit-tests
pull-tekton-pipeline-integration-tests 3d79456d95c823f0d6d4250c3674a4dddda6bc51 link true /test pull-tekton-pipeline-integration-tests
pull-tekton-pipeline-alpha-integration-tests 3d79456d95c823f0d6d4250c3674a4dddda6bc51 link true /test pull-tekton-pipeline-alpha-integration-tests

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

tekton-robot avatar Aug 18 '22 15:08 tekton-robot

@imjasonh: PR needs rebase.

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 avatar Aug 25 '22 21:08 tekton-robot

Let me try to tackle this for TaskRun and PipelineRun 🤔

vdemeester avatar Oct 03 '22 13:10 vdemeester