-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into enhance/validate-deploy-on-create
- Loading branch information
Showing
29 changed files
with
438 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package build | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/sirupsen/logrus" | ||
|
||
"github.com/go-vela/server/router/middleware/build" | ||
) | ||
|
||
// swagger:operation GET /status/{org}/{repo}/{build} builds GetBuildStatus | ||
// | ||
// Get a build status | ||
// | ||
// --- | ||
// produces: | ||
// - application/json | ||
// parameters: | ||
// - in: path | ||
// name: org | ||
// description: Name of the organization | ||
// required: true | ||
// type: string | ||
// - in: path | ||
// name: repo | ||
// description: Name of the repository | ||
// required: true | ||
// type: string | ||
// - in: path | ||
// name: build | ||
// description: Build number | ||
// required: true | ||
// type: integer | ||
// security: | ||
// - ApiKeyAuth: [] | ||
// responses: | ||
// '200': | ||
// description: Successfully retrieved the build | ||
// schema: | ||
// "$ref": "#/definitions/Build" | ||
// '400': | ||
// description: Invalid request payload or path | ||
// schema: | ||
// "$ref": "#/definitions/Build" | ||
// '401': | ||
// description: Unauthorized | ||
// schema: | ||
// "$ref": "#/definitions/Build" | ||
// '404': | ||
// description: Not found | ||
// schema: | ||
// "$ref": "#/definitions/Build" | ||
|
||
// GetBuildStatus represents the API handler to return "status", a lite representation of the resource with limited fields for unauthenticated access. | ||
func GetBuildStatus(c *gin.Context) { | ||
// capture middleware values | ||
l := c.MustGet("logger").(*logrus.Entry) | ||
b := build.Retrieve(c) | ||
|
||
l.Debug("reading status for build") | ||
|
||
// sanitize fields for the unauthenticated response | ||
b.StatusSanitize() | ||
|
||
c.JSON(http.StatusOK, b) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package repo | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/sirupsen/logrus" | ||
|
||
"github.com/go-vela/server/router/middleware/repo" | ||
) | ||
|
||
// swagger:operation GET /status/{org}/{repo} repos GetRepoStatus | ||
// | ||
// Get a repository status | ||
// | ||
// --- | ||
// produces: | ||
// - application/json | ||
// parameters: | ||
// - in: path | ||
// name: org | ||
// description: Name of the organization | ||
// required: true | ||
// type: string | ||
// - in: path | ||
// name: repo | ||
// description: Name of the repository | ||
// required: true | ||
// type: string | ||
// security: | ||
// - ApiKeyAuth: [] | ||
// responses: | ||
// '200': | ||
// description: Successfully retrieved the repo | ||
// schema: | ||
// "$ref": "#/definitions/Repo" | ||
// '400': | ||
// description: Invalid request payload or path | ||
// schema: | ||
// "$ref": "#/definitions/Repo" | ||
// '401': | ||
// description: Unauthorized | ||
// schema: | ||
// "$ref": "#/definitions/Repo" | ||
// '404': | ||
// description: Not found | ||
// schema: | ||
// "$ref": "#/definitions/Repo" | ||
|
||
// GetRepoStatus represents the API handler to return "status", a lite representation of the resource with limited fields for unauthenticated access. | ||
func GetRepoStatus(c *gin.Context) { | ||
// capture middleware values | ||
l := c.MustGet("logger").(*logrus.Entry) | ||
r := repo.Retrieve(c) | ||
|
||
l.Debug("reading status for repo") | ||
|
||
// sanitize fields for the unauthenticated response | ||
r.StatusSanitize() | ||
|
||
c.JSON(http.StatusOK, r) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.