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 a cloud event helper #1090

Merged
merged 1 commit into from
Jul 23, 2019
Merged

Conversation

afrittoli
Copy link
Member

Changes

Add a cloud event helper that is going to be used by the
CloudEventPipelineResource to send cloud events.
This includes an initial list of the type of events that can be
generated by Tekton.

Submitter Checklist

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

See the contribution guide for more details.

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

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Jul 16, 2019
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 16, 2019
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.

Couple of minor nits but otherwise looks good to me!
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2019
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Jul 16, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from three pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
@afrittoli afrittoli mentioned this pull request Jul 16, 2019
3 tasks
@afrittoli afrittoli force-pushed the cloud_event_client branch from 3f5e879 to b5d8cc0 Compare July 16, 2019 18:39
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2019
Add a cloud event helper that is going to be used by the
CloudEventPipelineResource to send cloud events.
This includes an initial list of the type of events that can be
generated by Tekton.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
@afrittoli afrittoli force-pushed the cloud_event_client branch from b5d8cc0 to 50b709f Compare July 16, 2019 19:07
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/taskrun/resources/cloudevent/cloudevent.go Do not exist 88.6%
pkg/reconciler/v1alpha1/taskrun/resources/cloudevent/cloudeventclient.go Do not exist 11.1%
pkg/reconciler/v1alpha1/taskrun/resources/cloudevent/cloudeventsfakeclient.go Do not exist 75.0%

@afrittoli
Copy link
Member Author

/test pull-tekton-pipeline-build-tests

@dlorenc
Copy link
Contributor

dlorenc commented Jul 22, 2019

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2019
@dlorenc
Copy link
Contributor

dlorenc commented Jul 22, 2019

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli, dibyom, dlorenc

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 Jul 22, 2019
@afrittoli
Copy link
Member Author

@akihikokuroda I want to address your comments on #837, but I didn't get a chance yet since I was traveling.
The changes to be made are:

  • move TaskRun from the root of the event body to a TaskRun field, so that it's easier to add data in future if needed
  • add versioning to the cloudevent headers

Since this one has already been reviewed, I could address your comments on a PR on top. Until #837 merges the resource won't be actually usable.
@dlorenc thoughs?

@afrittoli
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests

@bobcatfish
Copy link
Collaborator

Weeeird seems like a pretty similar error both times:

I0723 03:06:20.887] --- FAIL: TestTaskRunPipelineRunCancel (2.12s)
I0723 03:06:20.888]     --- FAIL: TestTaskRunPipelineRunCancel/With_retries (3.82s)
I0723 03:06:20.888]         init_test.go:111: Create namespace arendelle-5kh2p to deploy to
I0723 03:06:20.888]         init_test.go:123: Verify SA "default" is created in namespace "arendelle-5kh2p"
I0723 03:06:20.889]         cancel_test.go:66: Creating Task in namespace arendelle-5kh2p
I0723 03:06:20.889]         cancel_test.go:74: Creating Pipeline in namespace arendelle-5kh2p
I0723 03:06:20.889]         cancel_test.go:84: Creating PipelineRun in namespace arendelle-5kh2p
I0723 03:06:20.889]         cancel_test.go:89: Waiting for Pipelinerun pear in namespace arendelle-5kh2p to be started
I0723 03:06:20.889]         cancel_test.go:110: Waiting for TaskRuns from PipelineRun pear in namespace arendelle-5kh2p to be running
I0723 03:06:20.890]         cancel_test.go:139: Failed to cancel PipelineRun `pear`: Operation cannot be fulfilled on pipelineruns.tekton.dev "pear": the object has been modified; please apply your changes to the latest version and try again

But the logic this PR is adding isn't being invoked yet so it seems pretty unlikely these changes are the cause! 🤔

@bobcatfish
Copy link
Collaborator

/test pull-tekton-pipeline-integration-tests

@tekton-robot tekton-robot merged commit 5be3663 into tektoncd:master Jul 23, 2019
@afrittoli
Copy link
Member Author

Weeeird seems like a pretty similar error both times:

I0723 03:06:20.887] --- FAIL: TestTaskRunPipelineRunCancel (2.12s)
I0723 03:06:20.888]     --- FAIL: TestTaskRunPipelineRunCancel/With_retries (3.82s)
I0723 03:06:20.888]         init_test.go:111: Create namespace arendelle-5kh2p to deploy to
I0723 03:06:20.888]         init_test.go:123: Verify SA "default" is created in namespace "arendelle-5kh2p"
I0723 03:06:20.889]         cancel_test.go:66: Creating Task in namespace arendelle-5kh2p
I0723 03:06:20.889]         cancel_test.go:74: Creating Pipeline in namespace arendelle-5kh2p
I0723 03:06:20.889]         cancel_test.go:84: Creating PipelineRun in namespace arendelle-5kh2p
I0723 03:06:20.889]         cancel_test.go:89: Waiting for Pipelinerun pear in namespace arendelle-5kh2p to be started
I0723 03:06:20.889]         cancel_test.go:110: Waiting for TaskRuns from PipelineRun pear in namespace arendelle-5kh2p to be running
I0723 03:06:20.890]         cancel_test.go:139: Failed to cancel PipelineRun `pear`: Operation cannot be fulfilled on pipelineruns.tekton.dev "pear": the object has been modified; please apply your changes to the latest version and try again

But the logic this PR is adding isn't being invoked yet so it seems pretty unlikely these changes are the cause! 🤔

That was my though exactly. There seems to be some kind of race condition happening. Having test results data with test granularity (I think we only do it on test job granularity today) might be helpful to troubleshoot this; I look into it.

afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 8, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092
- TBD

TBD: address review comments
TBD: test for interaction with the image digest export

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 8, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

TBD: Test for interaction with the image digest export

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 8, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

TBD: Test for interaction with the image digest export

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 8, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

TBD: Test for interaction with the image digest export

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 14, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 14, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 14, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 15, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
afrittoli added a commit to afrittoli/pipeline that referenced this pull request Aug 15, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- tektoncd#1090
- tektoncd#1091
- tektoncd#1092

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
tekton-robot pushed a commit that referenced this pull request Aug 15, 2019
Implements in the TaskRun controller the logic to provide
the cloud event pipeline resource.

This commits puts together the API, cloud event helper and
resource definition from four pull requests:
- #1090
- #1091
- #1092

It adds unit tests for the new code and one E2E YAML test.
The YAML test runs a simple http server that can receive the
cloudevent for test purposes.

The list of cloud events to be sent is added to the TaskRun
status and processed by the TaskRun controller once the pod
associated to the TaskRun completes its execution.
The `isDone` definition of the TaskRun is not altered, the
reconciler checks for events to be sent once the
TaskRun.isDone is true.

Retries are not implemented yet in the sense that every
scheduled event will be attempted exactly once, but it may
be that those attempts happen across different invocations
of Reconcile.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
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. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. 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.

6 participants