tcgithubevents

package
v0.0.0-...-a5b7ecb Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

The github service publishes a pulse message for supported github events, translating Github webhook events into pulse messages.

This document describes the exchange offered by the taskcluster github service

See:

How to use this package

This package is designed to sit on top of http://godoc.org/github.com/taskcluster/pulse-go/pulse. Please read the pulse package overview to get an understanding of how the pulse client is implemented in go.

This package provides two things in addition to the basic pulse package: structured types for unmarshaling pulse message bodies into, and custom Binding interfaces, for defining the fixed strings for task cluster exchange names, and routing keys as structured types.

For example, when specifying a binding, rather than using:

pulse.Bind(
	"*.*.*.*.*.*.gaia.#",
	"exchange/taskcluster-queue/v1/task-defined",
)

You can rather use:

queueevents.TaskDefined{WorkerType: "gaia"}

In addition, this means that you will also get objects in your callback method like *queueevents.TaskDefinedMessage rather than just interface{}.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubPullRequestMessage

type GitHubPullRequestMessage struct {

	// The GitHub `action` which triggered an event.
	//
	// Possible values:
	//   * "assigned"
	//   * "unassigned"
	//   * "labeled"
	//   * "unlabeled"
	//   * "opened"
	//   * "edited"
	//   * "closed"
	//   * "reopened"
	//   * "synchronize"
	//   * "review_requested"
	//   * "review_request_removed"
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/action
	Action string `json:"action"`

	// The raw body of github event (for version 1)
	//
	// Additional properties allowed
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/body
	Body json.RawMessage `json:"body"`

	// The head ref of the event (for version 1)
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/branch
	Branch string `json:"branch"`

	// Metadata describing the pull request (for version 0)
	//
	// Additional properties allowed
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/details
	Details json.RawMessage `json:"details,omitempty"`

	// The GitHub webhook deliveryId. Extracted from the header 'X-GitHub-Delivery'
	//
	// Syntax:     ^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/eventId
	EventID string `json:"eventId"`

	// The installation which had an event.
	//
	// Mininum:    0
	// Maximum:    10000000000
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/installationId
	InstallationID int64 `json:"installationId"`

	// The GitHub `organization` which had an event.
	//
	// Syntax:     ^([a-zA-Z0-9-_%]*)$
	// Min length: 1
	// Max length: 100
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/organization
	Organization string `json:"organization"`

	// The GitHub `repository` which had an event.
	//
	// Syntax:     ^([a-zA-Z0-9-_%]*)$
	// Min length: 1
	// Max length: 100
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/repository
	Repository string `json:"repository"`

	// The type of the event (for version 1)
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/tasks_for
	Tasks_For string `json:"tasks_for"`

	// Message version
	//
	// Possible values:
	//   * 1
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#/properties/version
	Version float64 `json:"version"`
}

Message reporting that a GitHub pull request has occurred

See https://taskcluster-staging.net/schemas/github/v1/github-pull-request-message.json#

type GitHubPushMessage

type GitHubPushMessage struct {

	// The raw body of github event (for version 1)
	//
	// Additional properties allowed
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/body
	Body json.RawMessage `json:"body"`

	// The head ref of the event (for version 1)
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/branch
	Branch string `json:"branch"`

	// Metadata describing the push (for version 0)
	//
	// Additional properties allowed
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/details
	Details json.RawMessage `json:"details,omitempty"`

	// The GitHub webhook deliveryId. Extracted from the header 'X-GitHub-Delivery'
	//
	// Syntax:     ^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/eventId
	EventID string `json:"eventId"`

	// The installation which had an event.
	//
	// Min length: 0
	// Max length: 10000000000
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/installationId
	InstallationID int64 `json:"installationId"`

	// The GitHub `organization` which had an event.
	//
	// Syntax:     ^([a-zA-Z0-9-_%]*)$
	// Min length: 1
	// Max length: 100
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/organization
	Organization string `json:"organization"`

	// The GitHub `repository` which had an event.
	//
	// Syntax:     ^([a-zA-Z0-9-_%]*)$
	// Min length: 1
	// Max length: 100
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/repository
	Repository string `json:"repository"`

	// The type of the event (for version 1)
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/tasks_for
	Tasks_For string `json:"tasks_for"`

	// Message version
	//
	// Possible values:
	//   * 1
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#/properties/version
	Version float64 `json:"version"`
}

Message reporting that a GitHub push has occurred

See https://taskcluster-staging.net/schemas/github/v1/github-push-message.json#

type GitHubReleaseMessage

type GitHubReleaseMessage struct {

	// The raw body of github event (for version 1)
	//
	// Additional properties allowed
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/body
	Body json.RawMessage `json:"body"`

	// The head ref of the event (for version 1)
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/branch
	Branch string `json:"branch"`

	// Metadata describing the release (for version 0)
	//
	// Additional properties allowed
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/details
	Details json.RawMessage `json:"details,omitempty"`

	// The GitHub webhook deliveryId. Extracted from the header 'X-GitHub-Delivery'
	//
	// Syntax:     ^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/eventId
	EventID string `json:"eventId"`

	// The installation which had an event.
	//
	// Mininum:    0
	// Maximum:    10000000000
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/installationId
	InstallationID int64 `json:"installationId"`

	// The GitHub `organization` which had an event.
	//
	// Syntax:     ^([a-zA-Z0-9-_%]*)$
	// Min length: 1
	// Max length: 100
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/organization
	Organization string `json:"organization"`

	// The GitHub `repository` which had an event.
	//
	// Syntax:     ^([a-zA-Z0-9-_%]*)$
	// Min length: 1
	// Max length: 100
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/repository
	Repository string `json:"repository"`

	// The type of the event (for version 1)
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/tasks_for
	Tasks_For string `json:"tasks_for"`

	// Message version
	//
	// Possible values:
	//   * 1
	//
	// See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#/properties/version
	Version float64 `json:"version"`
}

Message reporting that a GitHub release has occurred

See https://taskcluster-staging.net/schemas/github/v1/github-release-message.json#

type PullRequest

type PullRequest struct {
	RoutingKeyKind string `mwords:"*"`
	Organization   string `mwords:"*"`
	Repository     string `mwords:"*"`
	Action         string `mwords:"*"`
}

When a GitHub pull request event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload.

See #pullRequest

func (PullRequest) ExchangeName

func (binding PullRequest) ExchangeName() string

func (PullRequest) NewPayloadObject

func (binding PullRequest) NewPayloadObject() interface{}

func (PullRequest) RoutingKey

func (binding PullRequest) RoutingKey() string

type Push

type Push struct {
	RoutingKeyKind string `mwords:"*"`
	Organization   string `mwords:"*"`
	Repository     string `mwords:"*"`
}

When a GitHub push event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload.

See #push

func (Push) ExchangeName

func (binding Push) ExchangeName() string

func (Push) NewPayloadObject

func (binding Push) NewPayloadObject() interface{}

func (Push) RoutingKey

func (binding Push) RoutingKey() string

type Release

type Release struct {
	RoutingKeyKind string `mwords:"*"`
	Organization   string `mwords:"*"`
	Repository     string `mwords:"*"`
}

When a GitHub release event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload.

See #release

func (Release) ExchangeName

func (binding Release) ExchangeName() string

func (Release) NewPayloadObject

func (binding Release) NewPayloadObject() interface{}

func (Release) RoutingKey

func (binding Release) RoutingKey() string

type TaskGroupCreationRequested

type TaskGroupCreationRequested struct {
	RoutingKeyKind string `mwords:"*"`
	Organization   string `mwords:"*"`
	Repository     string `mwords:"*"`
}

supposed to signal that taskCreate API has been called for every task in the task group for this particular repo and this particular organization currently used for creating initial status indicators in GitHub UI using Statuses API. This particular exchange can also be bound to RabbitMQ queues by custom routes - for that, Pass in the array of routes as a second argument to the publish method. Currently, we do use the statuses routes to bind the handler that creates the initial status.

See #taskGroupCreationRequested

func (TaskGroupCreationRequested) ExchangeName

func (binding TaskGroupCreationRequested) ExchangeName() string

func (TaskGroupCreationRequested) NewPayloadObject

func (binding TaskGroupCreationRequested) NewPayloadObject() interface{}

func (TaskGroupCreationRequested) RoutingKey

func (binding TaskGroupCreationRequested) RoutingKey() string

type TaskGroupDefinedCreateStatus

type TaskGroupDefinedCreateStatus struct {

	// The GitHub `organization` which had an event.
	//
	// Syntax:     ^([a-zA-Z0-9-_%]*)$
	// Min length: 1
	// Max length: 100
	//
	// See https://taskcluster-staging.net/schemas/github/v1/task-group-creation-requested.json#/properties/organization
	Organization string `json:"organization"`

	// The GitHub `repository` which had an event.
	//
	// Syntax:     ^([a-zA-Z0-9-_%]*)$
	// Min length: 1
	// Max length: 100
	//
	// See https://taskcluster-staging.net/schemas/github/v1/task-group-creation-requested.json#/properties/repository
	Repository string `json:"repository"`

	// The id of the taskGroup that had been created.
	//
	// See https://taskcluster-staging.net/schemas/github/v1/task-group-creation-requested.json#/properties/taskGroupId
	TaskGroupID string `json:"taskGroupId"`

	// Message version
	//
	// Possible values:
	//   * 1
	//
	// See https://taskcluster-staging.net/schemas/github/v1/task-group-creation-requested.json#/properties/version
	Version float64 `json:"version"`
}

Indicates that this service has created a new task group in response to a GitHub event. This message is for internal use only and should not be relied on for other purposes. Full specification on [GitHub docs](https://developer.github.com/v3/repos/statuses/#create-a-status)

See https://taskcluster-staging.net/schemas/github/v1/task-group-creation-requested.json#

Jump to

Keyboard shortcuts

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