Knative Eventing DockerHubSource defines an event source that transforms webhook events
from hub.docker.com into CloudEvents and deliver to the specified sink in the configuration yaml.
To learn more about Knative, please visit Knative docs repository.
If you are interested in contributing, see CONTRIBUTING.md and DEVELOPMENT.md.
The initial idea comes from JBoss community.
This is a part of Google Summer of Code 2020 project.
The demonstration video is here.
DockerHubSource installation requires two knative component on your kubernetes cluster.
Plus, you need a build tool ko.
- Knative Serving core v0.16+
- Knative Eventing core v0.16+
- ko
Install DockerHubSource from the source:
ko apply -f configApplying example(autoCallback enabled)
kubectl apply -f ./example/normal-display.yaml
kubectl apply -f ./example/source.yamlThe examples also have callback-display.yaml to try disableAutoCallback=true mode.
Under the circumstance that the appropriate sink is in the source.yaml, callback-display.yaml needs ko in order to apply.
You can see the resource is created via: kubectl get dockerhubsource.
% kubectl get dockerhubsources.sources.knative.dev
NAME READY REASON URL AGE
dockerhub-source True http://<your-endpoint-for-DockerHubSource> 17s
Copy http://<your-endpoint-for-DockerHubSource> to configure dockerhub webhook. See DockerHub Reference.
| Field | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
apiVersion string |
sources.knative.dev/v1alpha1 |
||||||||
kind string |
DockerHubSource |
||||||||
metadata Kubernetes meta/v1.metadata |
Refer to the Kubernetes API documentation for the fields of the metadata field. |
||||||||
Spec DockerHubSourceSpec |
|
||||||||
Status DockerHubSourceStatus |
|
Validation: valid
Context Attributes,
specversion: 1.0
type: tom24d.source.dockerhub.push
source: https://hub.docker.com/r/tom24d/postwebhook
subject: tom24d
id: fd4c1670-b126-4289-b025-61579ceeee3d
time: 2020-06-19T05:32:48Z
datacontenttype: application/json
Extensions,
tag: latest
Data,
{
"callback_url": "https://registry.hub.docker.com/u/tom24d/postwebhook/hook/2g51gffa2h1b4eh3ed355je0bc4g0e2h/",
"push_data": {
"images": [],
"pushed_at": 1592544800,
"pusher": "tom24d",
"tag": "latest"
},
"repository": {
"comment_count": 0,
"date_created": 1591154200,
"description": "[test] dockerhub website description.",
"dockerfile": "",
"full_description": "",
"is_official": false,
"is_private": false,
"is_trusted": false,
"name": "postwebhook",
"namespace": "tom24d",
"owner": "tom24d",
"repo_name": "tom24d/postwebhook",
"repo_url": "https://hub.docker.com/r/tom24d/postwebhook",
"star_count": 0,
"status": "Active"
}
}