Skip to content

Commit

Permalink
Remove CloudEvent Resources
Browse files Browse the repository at this point in the history
This commit removes the CloudEvent Resources support.
This PR removes ,
its respective example test, relevant functions in cloud_event_controller and docs
for cloud-event resources.

Removal of , as in #5967 has been broken up into removal of each
resources packages for the  code standard.
  • Loading branch information
JeromeJu committed Jan 18, 2023
1 parent 12457e2 commit 71e9742
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 1,445 deletions.
65 changes: 0 additions & 65 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ For example:
- [Cluster Resource](#cluster-resource)
- [Storage Resource](#storage-resource)
- [GCS Storage Resource](#gcs-storage-resource)
- [Cloud Event Resource](#cloud-event-resource)
- [Why Aren't PipelineResources in Beta?](#why-aren-t-pipelineresources-in-beta)

## Syntax
Expand Down Expand Up @@ -925,70 +924,6 @@ service account.

--------------------------------------------------------------------------------

### Cloud Event Resource

The `cloudevent` resource represents a
[cloud event](https://github.com/cloudevents/spec) that is sent to a target
`URI` upon completion of a `TaskRun`. The `cloudevent` resource sends Tekton
specific events; the body of the event includes the entire `TaskRun` spec plus
status; the types of events defined for now are:

- dev.tekton.event.task.unknown
- dev.tekton.event.task.successful
- dev.tekton.event.task.failed

`cloudevent` resources are useful to notify a third party upon the completion
and status of a `TaskRun`. In combinations with the
[Tekton triggers](https://github.com/tektoncd/triggers) project they can be used
to link `Task/PipelineRuns` asynchronously.

To create a CloudEvent resource using the `PipelineResource` CRD:

```yaml
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: event-to-sink
spec:
type: cloudEvent
params:
- name: targetURI
value: http://sink:8080
```

The content of an event is for example:

```yaml
Context Attributes,
SpecVersion: 0.2
Type: dev.tekton.event.task.successful
Source: /apis/tekton.dev/v1beta1/namespaces/default/taskruns/pipeline-run-api-16aa55-source-to-image-task-rpndl
ID: pipeline-run-api-16aa55-source-to-image-task-rpndl
Time: 2019-07-04T11:03:53.058694712Z
ContentType: application/json
Transport Context,
URI: /
Host: my-sink.default.my-cluster.containers.appdomain.cloud
Method: POST
Data,
{
"taskRun": {
"metadata": {...}
"spec": {
"inputs": {...}
"outputs": {...}
"serviceAccount": "default",
"taskRef": {
"name": "source-to-image",
"kind": "Task"
},
"timeout": "1h0m0s"
},
"status": {...}
}
}
```

## Why Aren't PipelineResources in Beta?

The short answer is that they're not ready to be given a Beta level of support by Tekton's developers. The long answer is, well, longer:
Expand Down
184 changes: 0 additions & 184 deletions examples/v1beta1/taskruns/cloud-event.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions pkg/apis/pipeline/v1beta1/resource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ const (

// PipelineResourceTypePullRequest indicates that this source is a SCM Pull Request.
PipelineResourceTypePullRequest PipelineResourceType = resource.PipelineResourceTypePullRequest

// PipelineResourceTypeCloudEvent indicates that this source is a cloud event URI
PipelineResourceTypeCloudEvent PipelineResourceType = resource.PipelineResourceTypeCloudEvent
)

// AllResourceTypes can be used for validation to check if a provided Resource type is one of the known types.
Expand Down
3 changes: 0 additions & 3 deletions pkg/apis/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/tektoncd/pipeline/pkg/apis/pipeline"
pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
resourcev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1"
"github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1/cloudevent"
"github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1/cluster"
"github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1/git"
"github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1/image"
Expand All @@ -45,8 +44,6 @@ func FromType(name string, r *resourcev1alpha1.PipelineResource, images pipeline
return storage.NewResource(name, images, r)
case resourcev1alpha1.PipelineResourceTypePullRequest:
return pullrequest.NewResource(name, images.PRImage, r)
case resourcev1alpha1.PipelineResourceTypeCloudEvent:
return cloudevent.NewResource(name, r)
}
return nil, fmt.Errorf("%s is an invalid or unimplemented PipelineResource", r.Spec.Type)
}
91 changes: 0 additions & 91 deletions pkg/apis/resource/v1alpha1/cloudevent/cloud_event_resource.go

This file was deleted.

Loading

0 comments on commit 71e9742

Please sign in to comment.