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

Cloud Event pipeline resource #1091

Merged
merged 1 commit into from
Aug 7, 2019

Conversation

afrittoli
Copy link
Member

Changes

Define a new type of PipelineResource for cloud events.
This resource can be used as an output only. The resource is only
defined here, it's not functional yet.

Submitter Checklist

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

There's not much to be unit tested in this PR. This is tested by a PR on top that actually implements the logic behind the cloud event pipeline resource.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. 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_resource branch 2 times, most recently from 32af6d1 to 45329e0 Compare July 16, 2019 18:52
@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 0.0%

@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 0.0%

@afrittoli afrittoli force-pushed the cloud_event_resource branch from 45329e0 to f92f210 Compare July 16, 2019 21:49
@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 0.0%

Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

Thanks for breaking this up, it is much easier to review! (Apologies for the parts where the context is missing and so I'm asking about it - however I think being able to understand it in the context of just this code via comments will be useful anyway!) ❤️

pkg/apis/pipeline/v1alpha1/cloud_event_resource.go Outdated Show resolved Hide resolved
pkg/apis/pipeline/v1alpha1/cloud_event_resource.go Outdated Show resolved Hide resolved
@afrittoli afrittoli force-pushed the cloud_event_resource branch from f92f210 to 43648e4 Compare July 17, 2019 23:00
@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 88.2%

Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

Left a couple thoughts but generally I think it's looking good! A couple typos maybe to fix but otherwise I would /lgtm!

Will approve anyway:
/approve

pkg/apis/pipeline/v1alpha1/cloud_event_resource_test.go Outdated Show resolved Hide resolved
// GetUploadContainerSpec returns nothing as the cloud event is sent by the controller once the POD execution is completed
func (s *CloudEventResource) GetUploadContainerSpec() ([]corev1.Container, error) {
return nil, nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The fact that we have no upload or download container spec here I think is interesting and I think hints that maybe a PipelineResource isn't the way we want to go with this in the long run - but I think this is fine for now!

Maybe in the future we can either:

  • Make it so that emitting events during / before / after Pipeline execution is something the controller always does when provided with a sink
  • Make it so we have a "finally" clause that allows a PipelineResource like this to be invoked and actually have the context of whether the PipelineRun succeeded or not

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I wanted to do this using a container scheduled to be executed as the last one in the Pod, but it didn't work out, so we might switch this in future to be something like you proposed.

I like both the ideas you proposed, I think what I need to do is to put together a design for a more general concept of notifications

One thing that I wanted to highlight is that the way this will be used in #837 is for TaskRun notifications, as opposed to PipelineRun.
Both TaskRun and PipelineRun end notifications can be useful, but I focused on TaskRun first because it fits well with the use cases I included in the design.

In the demo that I presented at the OSS I have a pipeline that builds a docker image, runs unit testing and runs a code lint, the three in parallel. All three tasks send a notifications once they're done, and the notification triggers different TaskRuns depending on the source (identified via a label on the TaskRun). This makes it possible to publish test results on GitHub using the PullRequestPipelineResource as soon as the corresponding task is complete, with no need to wait for the other Tasks - i.e. I don't necessarily want to wait for the image build to be complete before I can see the unit test results.

@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 afrittoli force-pushed the cloud_event_resource branch from 43648e4 to bb020ac Compare July 23, 2019 23:21
@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 88.2%

@ghost
Copy link

ghost commented Aug 6, 2019

One minor comment otherwise looks good to me

@ghost
Copy link

ghost commented Aug 6, 2019

We can fix that comment after merge.

/lgtm

@tekton-robot tekton-robot assigned ghost Aug 6, 2019
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2019
@ghost
Copy link

ghost commented Aug 6, 2019

/retest

2 similar comments
@afrittoli
Copy link
Member Author

/retest

@ghost
Copy link

ghost commented Aug 7, 2019

/retest

@afrittoli
Copy link
Member Author

Oh, the resource interface changed, I need to update this :P

@afrittoli afrittoli force-pushed the cloud_event_resource branch from bb020ac to de64a44 Compare August 7, 2019 13:48
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 7, 2019
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli, bobcatfish

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 [afrittoli,bobcatfish]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 78.9%

@ghost
Copy link

ghost commented Aug 7, 2019

Looks like just the generated code changed, is that right @afrittoli ?

@afrittoli afrittoli force-pushed the cloud_event_resource branch from de64a44 to 403fbc8 Compare August 7, 2019 14:34
@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 78.9%

@afrittoli afrittoli force-pushed the cloud_event_resource branch from 403fbc8 to f4d8028 Compare August 7, 2019 14:42
@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 78.9%

@afrittoli
Copy link
Member Author

/test pull-tekton-pipeline-build-tests

Define a new type of PipelineResource for cloud events.
This resource can be used as an output only. The resource is only
defined here, it's not functional yet.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
@afrittoli afrittoli force-pushed the cloud_event_resource branch from f4d8028 to 281b799 Compare August 7, 2019 15:08
@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/apis/pipeline/v1alpha1/cloud_event_resource.go Do not exist 78.9%

@ghost
Copy link

ghost commented Aug 7, 2019

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 7, 2019
@tekton-robot tekton-robot merged commit 8272358 into tektoncd:master Aug 7, 2019
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants