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 ability to send cloudevent during trigger processing #1259

Merged
merged 2 commits into from
Feb 23, 2022

Conversation

khrm
Copy link
Contributor

@khrm khrm commented Nov 8, 2021

Changes

Define targetURI field in EL spec to send cloud events during trigger processing. FeatureFlag should also be alpha.

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

Define `targetURI` field in EL spec to send cloud event during trigger processing. FeatureFlag in configmap should also be `alpha`.

@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 Nov 8, 2021
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 8, 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/sink/initialization.go 53.3% 50.0% -3.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/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 75.8% 21.4% -54.4

@khrm khrm changed the title WIP: Add ability to send cloudevent during trigger processing Add ability to send cloudevent during trigger processing Nov 16, 2021
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 16, 2021
@khrm khrm force-pushed the cloudEvent branch 10 times, most recently from bd194a4 to ccf01b1 Compare November 18, 2021 11:02
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 18, 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/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 75.8% 75.1% -0.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/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 75.8% 75.1% -0.6

@khrm
Copy link
Contributor Author

khrm commented Nov 18, 2021

/test pull-tekton-triggers-integration-tests

@savitaashture
Copy link
Contributor

savitaashture commented Nov 24, 2021

🎉 🎉

@khrm It would be great if you add doc on how to use cloudevents for EventListener

@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/v1beta1/event_listener_validation.go 97.9% 98.0% 0.1
pkg/sink/cloudevent/cloudevent.go Do not exist 73.3%
pkg/sink/cloudevent/cloudeventclient.go Do not exist 11.1%
pkg/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 74.6% 73.5% -1.1

@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/v1beta1/event_listener_validation.go 97.9% 98.0% 0.1
pkg/sink/cloudevent/cloudevent.go Do not exist 73.3%
pkg/sink/cloudevent/cloudeventclient.go Do not exist 11.1%
pkg/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 74.6% 73.5% -1.1

@dibyom
Copy link
Member

dibyom commented Feb 18, 2022

/approve

Some housekeeping things - Could you update the PR description + add a release note?

@tekton-robot tekton-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 18, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 21, 2022
@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/v1beta1/event_listener_validation.go 97.9% 98.0% 0.1
pkg/sink/cloudevent/cloudevent.go Do not exist 73.3%
pkg/sink/cloudevent/cloudeventclient.go Do not exist 11.1%
pkg/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 74.6% 73.5% -1.1

@@ -376,6 +400,8 @@ func (r Sink) processTrigger(t triggersv1.Trigger, request *http.Request, event
return
}
go r.recordResourceCreation(resources)
r.sendCloudEvents(request.Header, *el, eventID, events.TriggerProcessingSuccessfulV1)
Copy link
Contributor

@savitaashture savitaashture Feb 22, 2022

Choose a reason for hiding this comment

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

Are we planning to send events of processTrigger as well ?

/cc @dibyom

Asking this because with that line only success event will be sent do we plan to send failure events as well?
like

finalPayload, header, iresp, err := r.ExecuteTriggerInterceptors(t, request, event, log, eventID, extensions)
	if err != nil {
		log.Error(err)
		return
	}

so above when there is error we are not capturing event

Same applicable for K8s as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TriggerProcessing errors aren't error most of the time. It's because of filters, etc. So we are sending only Successful Event if a trigger succeed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah okok could you add this as well

r.emitEvents(r.EventRecorder, el, events.TriggerProcessingSuccessfulV1, nil)

which handles for K8s

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@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/v1beta1/event_listener_validation.go 97.9% 98.0% 0.1
pkg/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 74.6% 73.6% -1.0

Define `targetURI` field in EL spec to send cloud event during trigger
processing. FeatureFlag should also be `alpha`.
@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/v1beta1/event_listener_validation.go 97.9% 98.0% 0.1
pkg/sink/cloudevent/cloudevent.go Do not exist 73.3%
pkg/sink/cloudevent/cloudeventclient.go Do not exist 11.1%
pkg/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 74.6% 73.6% -1.0

@khrm
Copy link
Contributor Author

khrm commented Feb 23, 2022

/test pull-tekton-triggers-integration-tests

@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/v1beta1/event_listener_validation.go 97.9% 98.0% 0.1
pkg/sink/cloudevent/cloudevent.go Do not exist 73.3%
pkg/sink/cloudevent/cloudeventclient.go Do not exist 11.1%
pkg/sink/initialization.go 53.3% 50.0% -3.3
pkg/sink/sink.go 74.6% 73.8% -0.9

@khrm
Copy link
Contributor Author

khrm commented Feb 23, 2022

/test pull-tekton-triggers-integration-tests

Copy link
Contributor

@savitaashture savitaashture left a comment

Choose a reason for hiding this comment

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

/lgtm

Thank you 👍 🎉

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 23, 2022
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom, savitaashture

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:
  • OWNERS [dibyom,savitaashture]

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 merged commit 301135a into tektoncd:main Feb 23, 2022
@khrm khrm added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 24, 2022
@khrm khrm deleted the cloudEvent branch February 28, 2023 04:33
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. 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