build

package
v0.23.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package build provides the build handlers for the Vela API.

Usage:

import "github.com/go-vela/server/api/build"

Index

Constants

View Source
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

func ApproveBuild(c *gin.Context)

CreateBuild represents the API handler to approve a build to run in the configured backend.

func AutoCancel added in v0.22.0

func AutoCancel(c *gin.Context, b *library.Build, rB *library.Build, r *library.Repo, 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

func CancelBuild(c *gin.Context)

CancelBuild represents the API handler to cancel a running build.

func CleanBuild

func CleanBuild(ctx context.Context, database database.Interface, b *library.Build, services []*library.Service, steps []*library.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 in the configured backend.

func CreateBuild

func CreateBuild(c *gin.Context)

CreateBuild represents the API handler to create a build in the configured backend.

func DeleteBuild

func DeleteBuild(c *gin.Context)

DeleteBuild represents the API handler to remove a build for a repo from the configured backend.

func GetBuild

func GetBuild(c *gin.Context)

GetBuild represents the API handler to capture a build for a repo from the configured backend.

func GetBuildByID

func GetBuildByID(c *gin.Context)

GetBuildByID represents the API handler to capture a build by its id from the configured backend.

func GetBuildExecutable added in v0.21.0

func GetBuildExecutable(c *gin.Context)

GetBuildExecutable represents the API handler to capture a build executable for a repo from the configured backend.

func GetBuildGraph added in v0.22.0

func GetBuildGraph(c *gin.Context)

GetBuildGraph represents the API handler to capture a directed a-cyclical graph for a build from the configured backend.

func GetBuildToken

func GetBuildToken(c *gin.Context)

GetBuildToken represents the API handler to generate a build token.

func ListBuildsForOrg

func ListBuildsForOrg(c *gin.Context)

ListBuildsForOrg represents the API handler to capture a list of builds associated with an org from the configured backend.

func ListBuildsForRepo

func ListBuildsForRepo(c *gin.Context)

ListBuildsForRepo represents the API handler to capture a list of builds for a repo from the configured backend.

func PlanBuild

func PlanBuild(ctx context.Context, database database.Interface, p *pipeline.Build, b *library.Build, r *library.Repo) error

PlanBuild is a helper function to plan the build for execution. This creates all resources, like steps and services, for the build in the configured backend. TODO: - return build and error.

func PublishBuildExecutable added in v0.23.0

func PublishBuildExecutable(ctx context.Context, db database.Interface, p *pipeline.Build, b *library.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 PublishToQueue

func PublishToQueue(ctx context.Context, queue queue.Service, db database.Interface, b *library.Build, r *library.Repo, u *library.User, route string)

PublishToQueue is a helper function that publishes a queue item (build, repo, user) to the queue.

func RestartBuild

func RestartBuild(c *gin.Context)

RestartBuild represents the API handler to restart an existing build in the configured backend.

func ShouldAutoCancel added in v0.23.0

func ShouldAutoCancel(opts *pipeline.CancelOptions, b *library.Build, defaultBranch string) bool

ShouldAutoCancel is a helper function that determines whether or not a build should be eligible to auto cancel currently running / pending builds.

func SkipEmptyBuild

func SkipEmptyBuild(p *pipeline.Build) string

SkipEmptyBuild checks if the build should be skipped due to it not containing any steps besides init or clone.

func UpdateBuild

func UpdateBuild(c *gin.Context)

UpdateBuild represents the API handler to update a build for a repo in the configured backend.

func UpdateComponentStatuses added in v0.23.1

func UpdateComponentStatuses(c *gin.Context, b *library.Build, status string) error

UpdateComponentStatuses updates all components (steps and services) for a build to a given status.

Types

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL