proxyservice

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2016 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DockerhubRegistry = "https://registry.hub.docker.com"

Functions

This section is empty.

Types

type CallBackData

type CallBackData struct {
	State       string `json:"state,omitempty"`
	Description string `json:"description,omitempty"`
	Context     string `json:"context,omitempty"`
	TargetURL   string `json:"target_url,omitempty"`
}

CallBackData is the data format described at https://docs.docker.com/docker-hub/webhooks/#callback-json-data

func NewSuccessCallbackData

func NewSuccessCallbackData() *CallBackData

Returns a success callback with state: success

type DockerHubWebhookData

type DockerHubWebhookData struct {
	PushData struct {
		PushedAt int      `json:"pushed_at"`
		Images   []string `json:"images"`
		Tag      string   `json:"tag"`
		Pusher   string   `json:"pusher"`
	} `json:"push_data"`
	CallbackURL string `json:"callback_url"`
	Repository  struct {
		Status          string `json:"status"`
		Description     string `json:"description"`
		IsTrusted       bool   `json:"is_trusted"`
		FullDescription string `json:"full_description"`
		RepoURL         string `json:"repo_url"`
		Owner           string `json:"owner"`
		IsOfficial      bool   `json:"is_official"`
		IsPrivate       bool   `json:"is_private"`
		Name            string `json:"name"`
		Namespace       string `json:"namespace"`
		StarCount       int    `json:"star_count"`
		CommentCount    int    `json:"comment_count"`
		DateCreated     int    `json:"date_created"`
		RepoName        string `json:"repo_name"`
	} `json:"repository"`
}

DockerHubWebhookData represents the dockerhub webhook format

func NewDockerHubWebhookData

func NewDockerHubWebhookData(b []byte) (*DockerHubWebhookData, error)

NewDockerHubWebhookData returns *DockerHubWebhookData from json bytes

func NewDockerHubWebhookDataFromRequest

func NewDockerHubWebhookDataFromRequest(req *http.Request) (*DockerHubWebhookData, error)

NewDockerHubWebhookDataFromRequest returns *DockerHubWebhookData from http.Request Body is returned intact unless error != nil

func (*DockerHubWebhookData) Callback

func (d *DockerHubWebhookData) Callback(cb *CallBackData) error

Callback calls data's callback_url

type DockerHubWebhookHandler

type DockerHubWebhookHandler struct {
	Jenkins         *Jenkins
	ValidNameSpaces map[string]bool
}

func NewDockerHubWebhookHandler

func NewDockerHubWebhookHandler(jenkins *Jenkins, nameSpaces ...string) *DockerHubWebhookHandler

func (*DockerHubWebhookHandler) ServeHTTP

func (d *DockerHubWebhookHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Jenkins

type Jenkins struct {
	BaseURL string

	User     string
	Password string
}

func NewJenkins

func NewJenkins(baseURL, user, password string) *Jenkins

NewJenkins returns a new Jenkins instance

func (*Jenkins) NewRequest

func (j *Jenkins) NewRequest(method, path string, body io.Reader) (*http.Request, error)

NewRequest builds a authed jenkins request. path must be the absolute path starting with "/"

func (*Jenkins) PostForm

func (j *Jenkins) PostForm(path string, data url.Values) (*http.Response, error)

PostForm posts a authed request to jenkins BaseURL + path

func (*Jenkins) TriggerDockerhubJob

func (j *Jenkins) TriggerDockerhubJob(data *DockerHubWebhookData) error

TriggerDockerhubJob triggers a jenkins job given DockerHubWebhookData

func (*Jenkins) TriggerJob

func (j *Jenkins) TriggerJob(jobPath string, params url.Values) error

TriggerJob triggers a jenkins job jobPath should be the full path to the job e.g., /job/pipelines/job/myjob/

type JenkinsCrumbIssuer

type JenkinsCrumbIssuer struct {
	Crumb             string `json:"crumb"`
	CrumbRequestField string `json:"crumbRequestField"`
}

Jump to

Keyboard shortcuts

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