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

Add support for custom object to triggers eventlistener #958

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

savitaashture
Copy link
Contributor

@savitaashture savitaashture commented Feb 17, 2021

Changes

Pending:

  • Secure connection for Custom Resource
  • Code Refactoring so that common things can be re used

Will work on subsequent PR for pending things

/cc @dibyom

Submitter Checklist

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

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

Introduced new field customResource to support Knative Service for EventListener

apiVersion: triggers.tekton.dev/v1alpha1
kind: EventListener
metadata:
  name: github-listener-interceptor-customresource
spec:
  ...
  resources:
    customResource:
      apiVersion: serving.knative.dev/v1
      kind: Service
      metadata:
      spec:
        template:
          spec:
            serviceAccountName: tekton-triggers-example-sa
            containers:
            - resources:
                requests:
                  memory: "64Mi"
                  cpu: "250m"
                limits:
                  memory: "128Mi"
                  cpu: "500m"

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Feb 17, 2021
@tekton-robot tekton-robot requested a review from dlorenc February 17, 2021 09:17
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 17, 2021
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 68.0% -5.9
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 95.4% -2.0
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 39.4% -40.9

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 39.4% -40.9

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 39.6% -40.7

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 39.6% -40.7

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 39.8% -40.6

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 50.3% -30.0
test/controller.go 73.1% 65.8% -7.3

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 50.3% -30.0
test/controller.go 73.1% 72.7% -0.5

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 74.7% -5.7
test/controller.go 73.1% 72.5% -0.7

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 56.3% -24.0
test/controller.go 73.1% 72.5% -0.7

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 56.4% -23.9
test/controller.go 73.1% 72.5% -0.7

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 74.6% -5.7
test/controller.go 73.1% 72.5% -0.7

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 74.6% -5.7
test/controller.go 73.1% 72.5% -0.7

@tektoncd tektoncd deleted a comment from tekton-robot Feb 25, 2021
@tektoncd tektoncd deleted a comment from tekton-robot Feb 25, 2021
@tektoncd tektoncd deleted a comment from tekton-robot Feb 25, 2021
@tektoncd tektoncd deleted a comment from tekton-robot Feb 25, 2021
@tektoncd tektoncd deleted a comment from tekton-robot Feb 25, 2021
@tektoncd tektoncd deleted a comment from tekton-robot Feb 25, 2021
@dibyom
Copy link
Member

dibyom commented Feb 25, 2021

Still 2% reduced as there are some scenario which is difficult to cover like unmarshal and status related code(Because WithPod don't have status)

Thanks I think that's ok for now.

Copy link
Member

@dibyom dibyom left a comment

Choose a reason for hiding this comment

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

Thanks! almost there. Couple of minor comments.
Also: @sergetron do you want to review the docs for this PR?

pkg/dynamic/helpers.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/dynamic/custom_reconcile.go Do not exist 76.6%
pkg/dynamic/dynamic.go Do not exist 0.0%
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 78.0% -2.4
test/controller.go 73.1% 72.5% -0.7

In [`HMAC`](https://www.freeformatter.com/hmac-generator.html) `string` is the *body payload ex:* `{"action": "opened", "pull_request":{"head":{"sha": "28911bbb5a3e2ea034daf1f6be0a822d50e31e73"}},"repository":{"clone_url": "https://github.com/tektoncd/triggers.git"}}`
and `secretKey` is the *given secretToken ex:* `1234567`.

1. You should see a new TaskRun that got created:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above about "should".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As TriggerTemplate of EL explicitly creates TaskRun so i believe "should" suites here

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, "You will see the newly created TaskRun" is more appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

modified
Thank you 👍

docs/eventlisteners.md Outdated Show resolved Hide resolved
docs/eventlisteners.md Outdated Show resolved Hide resolved
docs/eventlisteners.md Outdated Show resolved Hide resolved
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/dynamic/custom_reconcile.go Do not exist 76.6%
pkg/dynamic/dynamic.go Do not exist 0.0%
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 78.0% -2.4
test/controller.go 73.1% 72.5% -0.7

@tektoncd tektoncd deleted a comment from tekton-robot Feb 27, 2021
@savitaashture
Copy link
Contributor Author

@dibyom @sergetron addressed all the review comments

Thank you 🙏

@dibyom
Copy link
Member

dibyom commented Mar 1, 2021

Thanks, could you squash up the commits?

@savitaashture savitaashture force-pushed the customeObjectSupport branch from 8549250 to 39fb9d7 Compare March 2, 2021 03:28
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_types.go 73.9% 76.0% 2.1
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.4% 97.7% 0.3
pkg/dynamic/custom_reconcile.go Do not exist 76.6%
pkg/dynamic/dynamic.go Do not exist 0.0%
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 80.3% 78.0% -2.4
test/controller.go 73.1% 72.5% -0.7

@savitaashture
Copy link
Contributor Author

Thanks, could you squash up the commits?

Done 👍

Copy link
Member

@dibyom dibyom 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 Mar 2, 2021
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

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 Mar 2, 2021
@tekton-robot tekton-robot merged commit f84479a into tektoncd:master Mar 3, 2021
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. lgtm Indicates that a PR is ready to be merged. 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.

4 participants