Documentation ¶
Index ¶
- type API
- type Artifact
- type Build
- type Hook
- type Job
- type JobAPI
- type JobUI
- type Tag
- type TagAPI
- type TagUI
- type UI
- func (h UI) Create(w http.ResponseWriter, r *http.Request)
- func (h UI) Destroy(w http.ResponseWriter, r *http.Request)
- func (h UI) Download(w http.ResponseWriter, r *http.Request)
- func (h UI) Index(w http.ResponseWriter, r *http.Request)
- func (h UI) Show(w http.ResponseWriter, r *http.Request)
- func (h UI) Store(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Build // Prefix is the part of the URL under which the API is being served, for // example "/api". Prefix string }
API is the handler for handling API requests made for build creation, submission, and retrieval.
func (API) Destroy ¶
func (h API) Destroy(w http.ResponseWriter, r *http.Request)
Destroy kills the build in the given request.
func (API) Index ¶
func (h API) Index(w http.ResponseWriter, r *http.Request)
Index serves the JSON encoded list of builds for the given request. If multiple pages of builds are returned then the database.Paginator is encoded in the Link response header.
type Artifact ¶
type Build ¶
Build is the base handler that provides shared logic for the UI and API handlers for build creation, submission, and retrieval.
func (Build) IndexWithRelations ¶
IndexWithRelations retreives a slice of *build.Build models for the user in the given request context. All of the relations for each build will be loaded into each model we have. If any of the builds have a bound namespace, then the namespace's user will be loaded too. A database.Paginator will also be returned if there are multiple pages of builds.
func (Build) ShowWithRelations ¶
ShowWithRelations retrieves the *build.Build model from the context of the given request. All of the relations for the build will be loaded into the model we have. If the build has a namespace bound to it, then the namespace's user will be loaded to the namespace.
func (Build) StoreModel ¶
StoreModel unmarshals the request's data into a build, validates it and stores it in the database. Upon success this will return the newly created build. This also returns the form for creating a build.
type Hook ¶
type Hook struct { Build // contains filtered or unexported fields }
Hook providers the handlers used for consuming webhooks from the various providers we integrate with.
func (Hook) GitHub ¶
func (h Hook) GitHub(w http.ResponseWriter, r *http.Request)
GitHub serves the response for webhooks received from GitHub. This will only process webhooks for "ping", "push", and "pull_request" events. The owner of each build submitted will be set to the owner of the GitHub access token. Each request sent from GitHub is verified using the HMAC signature sent with the request. This will respond with 204 No Content on a successful execution of a hook, otherwise it will respond with 500 Internal Server Error. If any invalid manifest is found during hook execution, then the response 202 Accepted is sent, with a message detailing what was wrong with any invalid manifest that was found. If an invalid namespace name is found in any of the manifests then 400 Bad Request is sent.
On a "push" event, the repository being pushed to will be scraped to have all manifests extraced from it. Each of these will be submitted as a new build. The most recent commit is used as the build not, and the commit author is used as the author of the build.
On a "pull_request" event, the repository from which the pull request was sent is scraped for all manifests to be extracted. Each of these will be submitted as a new build. The title and body of the pull request are used as the build note.
func (Hook) GitLab ¶
func (h Hook) GitLab(w http.ResponseWriter, r *http.Request)
GitLab serves the response for webhooks received from GitLab. This will only process webhooks for "Push Hook", and "Merge Request Hook", events. The owner of each build submitted will be set to the owner of the GitLab access token. Each request sent from GitLab is verified by checking the webhook token that was sent in the request. This will respond with 204 No Content on a successful execution of a hook, otherwise it will respond with 500 Internal Server Error. If any invalid manifest is found during hook execution, then the response 202 Accepted is sent, with a message detailing what was wrong with any invalid manifest that was found. If an invalid namespace name is found in any of the manifests then 400 Bad Request is sent.
On a "Push Hook" event, the repository being pushed to will be scraped to have all manifests extraced from it. Each of these will be submitted as a new build. The most recent commit is used as the build not, and the commit author is used as the author of the build.
On a "Merge Request Hook" event, the repository from which the pull request was sent is scraped for all manifests to be extracted. Each of these will be submitted as a new build. The title and body of the pull request are used as the build note.
type Job ¶
Job is the base handler that provides shared logic for the UI and API handlers for working with build jobs.
func (Job) IndexWithRelations ¶
IndexWithRelations returns all of the jobs with their relationships loaded into each return job.
type JobAPI ¶
type JobAPI struct { Job // Prefix is the part of the URL under which the API is being served, for // example "/api". Prefix string }
JobAPI is the handler for handling API requests made for working with the jobs within a build.
type JobUI ¶
type JobUI struct {
Job
}
JobUI is the handler for handling UI requests made for managing build jobs.
type Tag ¶
Tag is the base handler that provides shared logic for the UI and API handlers for working with build tags.
type TagAPI ¶
type TagAPI struct { Tag // Prefix is the part of the URL under which the API is being served, for // example "/api". Prefix string }
TagAPI is the handler for handling API requests made for working with build tags.
func (TagAPI) Destroy ¶
func (h TagAPI) Destroy(w http.ResponseWriter, r *http.Request)
Destroy removes the given tag from the build in the given request context. This serves no content as it's response.
func (TagAPI) Index ¶
func (h TagAPI) Index(w http.ResponseWriter, r *http.Request)
Index serves the JSON encoded list of build tags for the build in the given request context.
type TagUI ¶
type TagUI struct {
Tag
}
TagUI is the handler for handling UI requests made for managing build tags.
type UI ¶
type UI struct {
Build
}
UI is the handler for handling UI requests made for build creation, submission, and retrieval.
func (UI) Create ¶
func (h UI) Create(w http.ResponseWriter, r *http.Request)
Create serves the HTML response for submitting builds via the web frontend.
func (UI) Destroy ¶
func (h UI) Destroy(w http.ResponseWriter, r *http.Request)
Destroy kills the build. On success this will redirect back, on failure it will redirect back with an error message.
func (UI) Download ¶
func (h UI) Download(w http.ResponseWriter, r *http.Request)
Download will serve the contents of a build's artifact in the given request. Depending on the MIME type of the artifact will depend on whether the content is served in the browser directly, or downloaded.
func (UI) Index ¶
func (h UI) Index(w http.ResponseWriter, r *http.Request)
Index serves the HTML response detailing the list of builds.