Merge pull request #2163 from josmo/set-build-counter

allow in a patch update to change the build number if the user is an …
This commit is contained in:
Brad Rydzewski 2017-08-12 22:03:33 -05:00 committed by GitHub
commit d6e18e6dba
2 changed files with 14 additions and 10 deletions

View file

@ -66,4 +66,5 @@ type RepoPatch struct {
AllowPush *bool `json:"allow_push,omitempty"`
AllowDeploy *bool `json:"allow_deploy,omitempty"`
AllowTag *bool `json:"allow_tag,omitempty"`
BuildCounter *int `json:"build_counter,omitempty"`
}

View file

@ -95,7 +95,7 @@ func PatchRepo(c *gin.Context) {
return
}
if (in.IsTrusted != nil || in.Timeout != nil) && !user.Admin {
if (in.IsTrusted != nil || in.Timeout != nil || in.BuildCounter != nil) && !user.Admin {
c.String(403, "Insufficient privileges")
return
}
@ -133,6 +133,9 @@ func PatchRepo(c *gin.Context) {
return
}
}
if in.BuildCounter != nil {
repo.Counter = *in.BuildCounter
}
err := store.UpdateRepo(c, repo)
if err != nil {