Coder Social home page Coder Social logo

eventing-dockerhub's Introduction

Knative Eventing DockerHub Source

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.

Before you begin

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

Installation

Install DockerHubSource from the source:

ko apply -f config

DockerHubSource usage example

Applying example(autoCallback enabled)

kubectl apply -f ./example/normal-display.yaml
kubectl apply -f ./example/source.yaml

The 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.

API Reference

v1alpha1

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
disableAutoCallback
bool
(Optional)
DisableAutoCallback configures whether the adapter works with automatic callback feature.
Docker Hub webhook needs validation callback to continually receive its chain. If the field is false, the adapter automatically sends a corresponding callback. Whichever the event gets delivered successfully or not, callback status is always success.
If unspecified, this will default to false.
SourceSpec
SourceSpec
(Members of SourceSpec are embedded into this type.)
Status
DockerHubSourceStatus
SourceStatus
SourceStatus
(Members of SourceStatus are embedded into this type.)
AutoCallbackDisabled
bool
AutoCallbackDisabled is the status whether automatic callback is disabled.
URL
knative.dev/pkg/apis.URL
(Optional)
URL is the current active allocated URL that has been configured for the Source endpoint.
ReceiveAdapterServiceName
string
(Optional)
ReceiveAdapterServiceName holds knative service name to allocate same URL as before when accidentally deleted.
Further context is in #37.

Example CloudEvent payload

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"
    }
  }

eventing-dockerhub's People

Contributors

tom24d avatar dependabot[bot] avatar dependabot-preview[bot] avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.