Documentation
¶
Overview ¶
Package build provides the build handlers for the Vela API.
Usage:
import "github.com/go-vela/server/api/build"
Index ¶
- Constants
- func ApproveBuild(c *gin.Context)
- func AutoCancel(c *gin.Context, b *types.Build, rB *types.Build, ...) (bool, error)
- func CancelBuild(c *gin.Context)
- func CleanBuild(ctx context.Context, database database.Interface, b *types.Build, ...)
- func CompileAndPublish(ctx context.Context, cfg CompileAndPublishConfig, database database.Interface, ...) (*pipeline.Build, *models.Item, int, error)
- func CreateBuild(c *gin.Context)
- func DeleteBuild(c *gin.Context)
- func Enqueue(ctx context.Context, queue queue.Service, db database.Interface, ...)
- func GatekeepBuild(c *gin.Context, b *types.Build, r *types.Repo) error
- func GetBuild(c *gin.Context)
- func GetBuildByID(c *gin.Context)
- func GetBuildExecutable(c *gin.Context)
- func GetBuildGraph(c *gin.Context)
- func GetBuildStatus(c *gin.Context)
- func GetBuildToken(c *gin.Context)
- func GetIDRequestToken(c *gin.Context)
- func GetIDToken(c *gin.Context)
- func ListBuildsForOrg(c *gin.Context)
- func ListBuildsForRepo(c *gin.Context)
- func PlanBuild(ctx context.Context, database database.Interface, scm scm.Service, ...) error
- func PublishBuildExecutable(ctx context.Context, db database.Interface, p *pipeline.Build, b *types.Build) error
- func RestartBuild(c *gin.Context)
- func ShouldAutoCancel(opts *pipeline.CancelOptions, b *types.Build, defaultBranch string) bool
- func ShouldEnqueue(c *gin.Context, l *logrus.Entry, b *types.Build, r *types.Repo) (bool, error)
- func SkipEmptyBuild(p *pipeline.Build) string
- func UpdateBuild(c *gin.Context)
- func UpdateComponentStatuses(c *gin.Context, b *types.Build, status string) error
- type CompileAndPublishConfig
- type Graph
Constants ¶
const ( // clusters determine graph orientation. BuiltInCluster = 2 PipelineCluster = 1 ServiceCluster = 0 GraphComplexityLimit = 1000 // arbitrary value to limit render complexity. )
Variables ¶
This section is empty.
Functions ¶
func ApproveBuild ¶ added in v0.23.0
ApproveBuild represents the API handler to approve a build to run.
func AutoCancel ¶ added in v0.22.0
func AutoCancel(c *gin.Context, b *types.Build, rB *types.Build, cancelOpts *pipeline.CancelOptions) (bool, error)
AutoCancel is a helper function that checks to see if any pending or running builds for the repo can be replaced by the current build.
func CancelBuild ¶
CancelBuild represents the API handler to cancel a build.
func CleanBuild ¶
func CleanBuild(ctx context.Context, database database.Interface, b *types.Build, services []*types.Service, steps []*types.Step, e error)
cleanBuild is a helper function to kill the build without execution. This will kill all resources, like steps and services, for the build.
func CompileAndPublish ¶ added in v0.24.0
func CompileAndPublish( ctx context.Context, cfg CompileAndPublishConfig, database database.Interface, scm scm.Service, compiler compiler.Engine, queue queue.Service, ) (*pipeline.Build, *models.Item, int, error)
CompileAndPublish is a helper function to generate the queue items for a build. It takes a form as well as the database, scm, compiler, and queue services as arguments. It is used in webhook handling, schedule processing, and API build creation.
func CreateBuild ¶
CreateBuild represents the API handler to create a build.
func DeleteBuild ¶
DeleteBuild represents the API handler to remove a build for a repo.
func Enqueue ¶ added in v0.24.0
func Enqueue(ctx context.Context, queue queue.Service, db database.Interface, item *models.Item, route string)
Enqueue is a helper function that pushes a queue item (build, repo, user) to the queue.
func GatekeepBuild ¶ added in v0.26.0
GatekeepBuild is a helper function that will set the status of a build to 'pending approval' and send a status update to the SCM.
func GetBuildByID ¶
GetBuildByID represents the API handler to get a build by its id.
func GetBuildExecutable ¶ added in v0.21.0
GetBuildExecutable represents the API handler to get a build executable for a repository.
func GetBuildGraph ¶ added in v0.22.0
GetBuildGraph represents the API handler to get a directed a-cyclical graph for a build.
func GetBuildStatus ¶ added in v0.26.0
GetBuildStatus represents the API handler to return "status", a lite representation of the resource with limited fields for unauthenticated access.
func GetBuildToken ¶
GetBuildToken represents the API handler to generate a build token.
func GetIDRequestToken ¶ added in v0.24.0
GetIDRequestToken represents the API handler to generate and return an ID request token.
func GetIDToken ¶ added in v0.24.0
GetIDToken represents the API handler to generate a id token.
func ListBuildsForOrg ¶
ListBuildsForOrg represents the API handler to get a list of builds associated with an organization.
func ListBuildsForRepo ¶
ListBuildsForRepo represents the API handler to get a list of builds for a repository.
func PlanBuild ¶
func PlanBuild(ctx context.Context, database database.Interface, scm scm.Service, p *pipeline.Build, b *types.Build, r *types.Repo) error
PlanBuild is a helper function to plan the build for execution. This creates all resources, like steps and services, for the build. TODO: - return build and error.
func PublishBuildExecutable ¶ added in v0.23.0
func PublishBuildExecutable(ctx context.Context, db database.Interface, p *pipeline.Build, b *types.Build) error
PublishBuildExecutable marshals a pipeline.Build into bytes and pushes that data to the build_executables table to be requested by a worker whenever the build has been picked up.
func RestartBuild ¶
RestartBuild represents the API handler to restart an existing build.
func ShouldAutoCancel ¶ added in v0.23.0
ShouldAutoCancel is a helper function that determines whether or not a build should be eligible to auto cancel currently running / pending builds.
func ShouldEnqueue ¶ added in v0.26.0
ShouldEnqueue is a helper function that will determine whether to publish a build to the queue or place it in pending approval status.
func SkipEmptyBuild ¶
SkipEmptyBuild checks if the build should be skipped due to it not containing any steps besides init or clone.
func UpdateBuild ¶
UpdateBuild represents the API handler to update a build for a repo.
Types ¶
type CompileAndPublishConfig ¶ added in v0.24.0
type CompileAndPublishConfig struct { Build *types.Build Deployment *types.Deployment Metadata *internal.Metadata BaseErr string Source string Comment string Labels []string Retries int }
CompileAndPublishConfig is a struct that contains information for the CompileAndPublish function.
type Graph ¶ added in v0.22.0
type Graph struct { BuildID int64 `json:"build_id"` BuildNumber int `json:"build_number"` Org string `json:"org"` Repo string `json:"repo"` Nodes map[int]*node `json:"nodes"` Edges []*edge `json:"edges"` }
Graph contains nodes, and relationships between nodes, or edges.
a node is a pipeline stage and its relevant steps. an edge is a relationship between nodes, defined by the 'needs' tag.
swagger:model Graph