pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

[TEP-0137] Restructure customrun event controller

Open afrittoli opened this issue 1 year ago • 26 comments

Dependencies:

  • [x] #6883
  • [x] #6884

Once dependencies are merged, the PR will contain 1 commit only

Changes

[TEP-0137] Restructure customrun event controller

The events controllers for different resources (CustomRun, TaskRun and PipelineRun) will be almost identical, with only the resource type being different.

This commit refactors the CustomRun events controller to factor up as much as possible of the reconciler, controller and test logic so that we can reuse it in the upcoming commits for the other resources.

I've done a slight change of strategy in the unit test structure compared to what we do for the core controller tests. A set of tests verifies as much as possible of the shared functions, by mocking the event functionality away. These tests are independent of the specific target format of the events.

Most of the functionality of the ReconcileKind functions is handled in reconciler tests, which do not need a controller object or a config map watcher to run, which reduces the complexity of these tests without sacrifying coverage.

Finally, a smaller set of tests covers the controller -> reconciler logic, so verify that our controller works well when invoking the ReconcileKind indirectly through the generated package.

Signed-off-by: Andrea Frittoli [email protected]

Submitter Checklist

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

  • [x] Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • [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). See some examples of good release notes.
  • [x] Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

/kind misc

afrittoli avatar Jun 29 '23 16:06 afrittoli

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please ask for approval from afrittoli 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 Jun 29 '23 16:06 tekton-robot

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/apis/config/events.go Do not exist 98.1%
pkg/apis/config/store.go 91.7% 92.6% 0.9
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/events/cloudevent/cloud_event_controller.go 84.9% 84.6% -0.3
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%
pkg/reconciler/notifications/testing.go Do not exist 92.3%
test/controller.go 29.4% 30.1% 0.7

tekton-robot avatar Jun 29 '23 16:06 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/config/events.go Do not exist 98.1%
pkg/apis/config/store.go 91.7% 92.6% 0.9
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/events/cloudevent/cloud_event_controller.go 84.9% 84.6% -0.3
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%
pkg/reconciler/notifications/testing.go Do not exist 92.3%
test/controller.go 29.4% 30.1% 0.7

tekton-robot avatar Jun 29 '23 17:06 tekton-robot

/retest

afrittoli avatar Jun 30 '23 09:06 afrittoli

/test check-pr-has-kind-label

afrittoli avatar Jun 30 '23 09:06 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-beta-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 Jun 30 '23 09:06 tekton-robot

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/apis/config/events.go Do not exist 98.1%
pkg/apis/config/store.go 91.7% 92.6% 0.9
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/events/cloudevent/cloud_event_controller.go 84.9% 84.6% -0.3
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
test/controller.go 29.4% 30.1% 0.7

tekton-robot avatar Jun 30 '23 10:06 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/config/events.go Do not exist 98.1%
pkg/apis/config/store.go 91.7% 92.6% 0.9
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/events/cloudevent/cloud_event_controller.go 84.9% 84.6% -0.3
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
test/controller.go 29.4% 30.1% 0.7

tekton-robot avatar Jun 30 '23 10:06 tekton-robot

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/apis/config/events.go Do not exist 98.1%
pkg/apis/config/store.go 91.7% 92.6% 0.9
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/events/cloudevent/cloud_event_controller.go 84.9% 84.6% -0.3
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%
pkg/reconciler/notifications/testing.go Do not exist 96.2%
test/controller.go 29.4% 30.1% 0.7

tekton-robot avatar Jun 30 '23 10:06 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/config/events.go Do not exist 98.1%
pkg/apis/config/store.go 91.7% 92.6% 0.9
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/events/cloudevent/cloud_event_controller.go 84.9% 84.6% -0.3
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%
pkg/reconciler/notifications/testing.go Do not exist 96.2%
test/controller.go 29.4% 30.1% 0.7

tekton-robot avatar Jun 30 '23 10:06 tekton-robot

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/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 12:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 12:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 13:07 tekton-robot

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/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 13:07 tekton-robot

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/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 13:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 13:07 tekton-robot

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/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 14:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 14:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/controller.go Do not exist 100.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 03 '23 14:07 tekton-robot

/restest

afrittoli avatar Jul 03 '23 21:07 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/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 10 '23 12:07 tekton-robot

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/pipelinerun_types.go 89.5% 88.7% -0.8
pkg/apis/pipeline/v1beta1/pipelinerun_types.go 89.7% 88.9% -0.8
pkg/reconciler/notifications/controller.go Do not exist 25.0%
pkg/reconciler/notifications/customrun/reconciler.go Do not exist 87.5%
pkg/reconciler/notifications/runtimeobject.go Do not exist 100.0%

tekton-robot avatar Jul 10 '23 12:07 tekton-robot

@afrittoli: 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 08 '23 20:08 tekton-robot

@afrittoli do you think we can get this in for this milestone? Or should I move it over to 0.57?

chitrangpatel avatar Jan 10 '24 15:01 chitrangpatel

@afrittoli needs a rebase 🙏🏼

vdemeester avatar Jan 24 '24 12:01 vdemeester

This PR has not made any progress since Pipelines v0.51 when it was initiated introduced. Clearing it from the milestone. Please add back as appropriate. Thanks!

pritidesai avatar Mar 20 '24 16:03 pritidesai