Documentation ¶
Index ¶
- Variables
- func TriggerDockerhubJob(j Jenkins, data *DockerHubWebhookData) error
- func TriggerHgJob(j Jenkins, repoPath string, repoUrl string, head string, data *HgMessage) error
- type CallBackData
- type ChangegroupMessage
- type DockerHubWebhookData
- type DockerHubWebhookHandler
- type HgMessage
- type HgmoPulseHandler
- type Jenkins
- type JenkinsCrumbIssuer
- type JenkinsServer
- type PushJson
Constants ¶
This section is empty.
Variables ¶
var DockerhubRegistry = "https://registry.hub.docker.com"
Functions ¶
func TriggerDockerhubJob ¶ added in v0.2.0
func TriggerDockerhubJob(j Jenkins, data *DockerHubWebhookData) error
TriggerDockerhubJob triggers a jenkins job given DockerHubWebhookData
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 ChangegroupMessage ¶ added in v0.2.0
type ChangegroupMessage struct { RepoUrl string `json:"repo_url"` Heads []string `json:"heads"` PushlogPushes []struct { PushId int `json:"pushid"` User string `json:"user"` Time int `json:"time"` PushJsonUrl string `json:"push_json_url"` PushFullJsonUrl string `json:"push_full_json_url"` } `json:"pushlog_pushes"` Source string `json:"Source"` }
func (*ChangegroupMessage) VerifyMessage ¶ added in v0.2.0
func (msg *ChangegroupMessage) VerifyMessage(repoPath string) error
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 DisableDockerHubCallback bool }
func NewDockerHubWebhookHandler ¶
func NewDockerHubWebhookHandler(disableDockerHubCallback bool, jenkins Jenkins, nameSpaces ...string) *DockerHubWebhookHandler
func (*DockerHubWebhookHandler) ServeHTTP ¶
func (d *DockerHubWebhookHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type HgMessage ¶ added in v0.2.0
type HgMessage struct { Type string `json:"type"` Data interface{} `json:"data"` }
func (*HgMessage) UnmarshalJSON ¶ added in v0.2.0
type HgmoPulseHandler ¶ added in v0.2.0
type HgmoPulseHandler struct { Jenkins Jenkins Pulse *pulse.Connection QueueName string ValidHgRepos map[string]bool }
func NewHgmoPulseHandler ¶ added in v0.2.0
func NewHgmoPulseHandler(jenkins Jenkins, pulse *pulse.Connection, queueName string, hgRepos ...string) *HgmoPulseHandler
func (*HgmoPulseHandler) Consume ¶ added in v0.2.0
func (handler *HgmoPulseHandler) Consume() error
type Jenkins ¶
func NewJenkins ¶
NewJenkins returns a new Jenkins instance
type JenkinsCrumbIssuer ¶
type JenkinsServer ¶ added in v0.2.0
func (*JenkinsServer) NewRequest ¶ added in v0.2.0
NewRequest builds a authed jenkins request. path must be the absolute path starting with "/"
func (*JenkinsServer) PostForm ¶ added in v0.2.0
PostForm posts a authed request to jenkins BaseURL + path
func (*JenkinsServer) TriggerJob ¶ added in v0.2.0
func (j *JenkinsServer) 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/