Documentation
¶
Index ¶
- Variables
- type CallBackData
- type DockerHubWebhookData
- type DockerHubWebhookHandler
- type Jenkins
- func (j *Jenkins) NewRequest(method, path string, body io.Reader) (*http.Request, error)
- func (j *Jenkins) PostForm(path string, data url.Values) (*http.Response, error)
- func (j *Jenkins) TriggerDockerhubJob(data *DockerHubWebhookData) error
- func (j *Jenkins) TriggerJob(jobPath string, params url.Values) error
- type JenkinsCrumbIssuer
Constants ¶
This section is empty.
Variables ¶
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 ¶
func NewDockerHubWebhookHandler ¶
func NewDockerHubWebhookHandler(jenkins *Jenkins, nameSpaces ...string) *DockerHubWebhookHandler
func (*DockerHubWebhookHandler) ServeHTTP ¶
func (d *DockerHubWebhookHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type Jenkins ¶
func NewJenkins ¶
NewJenkins returns a new Jenkins instance
func (*Jenkins) NewRequest ¶
NewRequest builds a authed jenkins request. path must be the absolute path starting with "/"
func (*Jenkins) TriggerDockerhubJob ¶
func (j *Jenkins) TriggerDockerhubJob(data *DockerHubWebhookData) error
TriggerDockerhubJob triggers a jenkins job given DockerHubWebhookData