github

package
v0.0.0-...-d5b48cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Knative GitHub Source

This source will enable receiving of GitHub events from within Knative Eventing.

Events

  • dev.knative.github.pullrequest

Images

Uses two images, the feedlet and the receive adapter.

Feedlet

A Feedlet is a container to create or destroy event source bindings.

The Feedlet is run as a Job by the Feed controller.

This Feedlet will create the Receive Adapter and register a webhook in GitHub for the account provided.

Receive Adapter

The Receive Adapter is a Service.serving.knative.dev resource that is registered to receive GitHub webhook requests. The source will wrap this request in a CloudEvent and send it to the action provided.

Usage

The GitHub Source expects there to be a secret in the following form:

apiVersion: v1
kind: Secret
metadata:
  name: githubsecret
type: Opaque
stringData:
  githubCredentials: >
    {
      "accessToken": "<YOUR PERSONAL TOKEN FROM GITHUB>",
      "secretToken": "<YOUR RANDOM STRING>"
    }

The Feedlet requires a ServiceAccount to run as a cluster admin for the targeted namespace:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: feed-sa
  namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: feed-admin
subjects:
  - kind: ServiceAccount
    name: feed-sa
    namespace: default
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io

To create a Receive Adapter (via the Feedlet), a Flow needs to exist:

apiVersion: flows.knative.dev/v1alpha1
kind: Flow
metadata:
  name: my-github-flow
  namespace: default
spec:
  serviceAccountName: feed-sa
  trigger:
    eventType: pullrequest
    resource: <org>/<repo> # TODO: Fill this out
    service: github
    parameters:
      secretName: githubsecret
      secretKey: githubCredentials
    parametersFrom:
      - secretKeyRef:
          name: githubsecret
          key: githubCredentials
  action:
    target:
      kind: Service
      apiVersion: serving.knative.dev/v1alpha1
      name: my-service

Documentation

Index

Constants

View Source
const (
	// Event Names
	PullrequestEvent = "dev.knative.github.pullrequest"
	UnsupportedEvent = "dev.knative.github.unsupported"
)

Variables

View Source
var CloudEventType = map[string]string{
	"pull_request": PullrequestEvent,
	"":             UnsupportedEvent,
}
View Source
var GithubEventType = map[string]string{
	PullrequestEvent: "pull_request",
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL