weldr: Add support for /blueprints/tag route
A POST to this route will tag the latest commit of a blueprint as a new revision. The revision numbers start at 1 and increment on each call. If the latest commit has already been tagged it ignores the request.
This commit is contained in:
parent
cc7bab14af
commit
eeef1e289c
1 changed files with 19 additions and 0 deletions
|
|
@ -84,6 +84,7 @@ func New(rpmmd rpmmd.RPMMD, arch string, distro distro.Distro, logger *log.Logge
|
|||
api.router.POST("/api/v:version/blueprints/new", api.blueprintsNewHandler)
|
||||
api.router.POST("/api/v:version/blueprints/workspace", api.blueprintsWorkspaceHandler)
|
||||
api.router.POST("/api/v:version/blueprints/undo/:blueprint/:commit", api.blueprintUndoHandler)
|
||||
api.router.POST("/api/v:version/blueprints/tag/:blueprint", api.blueprintsTagHandler)
|
||||
api.router.DELETE("/api/v:version/blueprints/delete/:blueprint", api.blueprintDeleteHandler)
|
||||
api.router.DELETE("/api/v:version/blueprints/workspace/:blueprint", api.blueprintDeleteWorkspaceHandler)
|
||||
|
||||
|
|
@ -1278,6 +1279,24 @@ func (api *API) blueprintDeleteWorkspaceHandler(writer http.ResponseWriter, requ
|
|||
statusResponseOK(writer)
|
||||
}
|
||||
|
||||
// blueprintsTagHandler tags the current blueprint commit as a new revision
|
||||
func (api *API) blueprintsTagHandler(writer http.ResponseWriter, request *http.Request, params httprouter.Params) {
|
||||
if !verifyRequestVersion(writer, params, 0) {
|
||||
return
|
||||
}
|
||||
|
||||
err := api.store.TagBlueprint(params.ByName("blueprint"))
|
||||
if err != nil {
|
||||
errors := responseError{
|
||||
ID: "BlueprintsError",
|
||||
Msg: err.Error(),
|
||||
}
|
||||
statusResponseError(writer, http.StatusBadRequest, errors)
|
||||
return
|
||||
}
|
||||
statusResponseOK(writer)
|
||||
}
|
||||
|
||||
// Schedule new compose by first translating the appropriate blueprint into a pipeline and then
|
||||
// pushing it into the channel for waiting builds.
|
||||
func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request, params httprouter.Params) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue