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

Only send cloud events when condition changes #3353

Merged
merged 1 commit into from
Oct 7, 2020

Conversation

afrittoli
Copy link
Member

Changes

Change the logic for cloud events to be sent only if a change is
detected in the condition, specifically in state, message or reason.

Fixes #3336

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

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.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

Fixes issue with duplicate cloud events. Cloud events are now sent only if a change in condition happened.

/kind bug

Change the logic for cloud events to be sent only if a change is
detected in the condition, specifically in state, message or reason.

Fixes tektoncd#3336

Signed-off-by: Andrea Frittoli <[email protected]>
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Oct 7, 2020
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 7, 2020
@afrittoli afrittoli added the needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch label Oct 7, 2020
@afrittoli afrittoli added this to the Pipelines v0.17 milestone Oct 7, 2020
@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/events/event.go 86.4% 87.0% 0.6

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbwsg

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 Oct 7, 2020
@pritidesai
Copy link
Member

have seen these kind of intermittent failures lately, was hoping these changes would fix them:

Expected 2 number of successful events from pipelinerun and taskrun but got 3; list of received events : "&v1.Event{TypeMeta:v1.TypeMeta{Kind:\"\", APIVersion:\"\"}, ObjectMeta:v1.ObjectMeta{Name:\"cancel-me.163bc3dce7b122ac\", GenerateName:\"\", Namespace:\"arendelle-9z6lj\", SelfLink:\"/api/v1/namespaces/arendelle-9z6lj/events/cancel-me.163bc3dce7b122ac\", UID:\"2d90f279-6b10-472d-bf49-37c40140b343\", ResourceVersion:\"458\", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686246, loc:(*time.Location)(0x3dbbda0)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:\"\", ManagedFields:[]v1.ManagedFieldsEntry(nil)}, InvolvedObject:v1.ObjectReference{Kind:\"PipelineRun\", Namespace:\"arendelle-9z6lj\", Name:\"cancel-me\", UID:\"662d5f70-052f-4854-b53a-bd384296413c\", APIVersion:\"tekton.dev/v1beta1\", ResourceVersion:\"7030\", FieldPath:\"\"}, Reason:\"Failed\", Message:\"PipelineRun \\\"cancel-me\\\" was cancelled\", Source:v1.EventSource{Component:\"PipelineRun\", Host:\"\"}, FirstTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686246, loc:(*time.Location)(0x3dbbda0)}}, LastTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686246, loc:(*time.Location)(0x3dbbda0)}}, Count:1, Type:\"Warning\", EventTime:v1.MicroTime{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, Series:(*v1.EventSeries)(nil), Action:\"\", Related:(*v1.ObjectReference)(nil), ReportingController:\"\", ReportingInstance:\"\"}, &v1.Event{TypeMeta:v1.TypeMeta{Kind:\"\", APIVersion:\"\"}, ObjectMeta:v1.ObjectMeta{Name:\"cancel-me-task-fflxh.163bc3dd1168f77c\", GenerateName:\"\", Namespace:\"arendelle-9z6lj\", SelfLink:\"/api/v1/namespaces/arendelle-9z6lj/events/cancel-me-task-fflxh.163bc3dd1168f77c\", UID:\"01dc493c-d0fe-4651-94b6-f4313ef00207\", ResourceVersion:\"459\", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686246, loc:(*time.Location)(0x3dbbda0)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:\"\", ManagedFields:[]v1.ManagedFieldsEntry(nil)}, InvolvedObject:v1.ObjectReference{Kind:\"TaskRun\", Namespace:\"arendelle-9z6lj\", Name:\"cancel-me-task-fflxh\", UID:\"e80c6569-88bf-47f9-9754-767524d7790a\", APIVersion:\"tekton.dev/v1beta1\", ResourceVersion:\"7033\", FieldPath:\"\"}, Reason:\"Failed\", Message:\"TaskRun \\\"cancel-me-task-fflxh\\\" was cancelled\", Source:v1.EventSource{Component:\"TaskRun\", Host:\"\"}, FirstTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686246, loc:(*time.Location)(0x3dbbda0)}}, LastTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686246, loc:(*time.Location)(0x3dbbda0)}}, Count:1, Type:\"Warning\", EventTime:v1.MicroTime{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, Series:(*v1.EventSeries)(nil), Action:\"\", Related:(*v1.ObjectReference)(nil), ReportingController:\"\", ReportingInstance:\"\"}, &v1.Event{TypeMeta:v1.TypeMeta{Kind:\"\", APIVersion:\"\"}, ObjectMeta:v1.ObjectMeta{Name:\"cancel-me-task-fflxh.163bc3dd1168f77c\", GenerateName:\"\", Namespace:\"arendelle-9z6lj\", SelfLink:\"/api/v1/namespaces/arendelle-9z6lj/events/cancel-me-task-fflxh.163bc3dd1168f77c\", UID:\"01dc493c-d0fe-4651-94b6-f4313ef00207\", ResourceVersion:\"460\", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686246, loc:(*time.Location)(0x3dbbda0)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:\"\", ManagedFields:[]v1.ManagedFieldsEntry(nil)}, InvolvedObject:v1.ObjectReference{Kind:\"TaskRun\", Namespace:\"arendelle-9z6lj\", Name:\"cancel-me-task-fflxh\", UID:\"e80c6569-88bf-47f9-9754-767524d7790a\", APIVersion:\"tekton.dev/v1beta1\", ResourceVersion:\"7033\", FieldPath:\"\"}, Reason:\"Failed\", Message:\"TaskRun \\\"cancel-me-task-fflxh\\\" was cancelled\", Source:v1.EventSource{Component:\"TaskRun\", Host:\"\"}, FirstTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686246, loc:(*time.Location)(0x3dbbda0)}}, LastTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63737686247, loc:(*time.Location)(0x3dbbda0)}}, Count:2, Type:\"Warning\", EventTime:v1.MicroTime{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, Series:(*v1.EventSeries)(nil), Action:\"\", Related:(*v1.ObjectReference)

/test pull-tekton-pipeline-integration-tests

@pritidesai
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 7, 2020
@tekton-robot tekton-robot merged commit 3d35b87 into tektoncd:master Oct 7, 2020
@vdemeester vdemeester removed the needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch label Oct 21, 2020
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/bug Categorizes issue or PR as related to a bug. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate 'pipelinerun.successful' cloudevent
4 participants