pipeline

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const LoadPipelineBuildRequest = `` /* 1023-byte string literal not displayed */

LoadPipelineBuildRequest Load pipeline build activities. Use also in api/project/project.go to load the last 5 builds by applications

View Source
const LoadPipelineBuildStage = `` /* 701-byte string literal not displayed */

LoadPipelineBuildStage Load pipeline build stage + action builds

View Source
const LoadPipelineBuildWithActions = `` /* 1148-byte string literal not displayed */

LoadPipelineBuildWithActions loads pipelines builds with its stages and action builds

View Source
const LoadPipelineHistoryRequest = `` /* 1040-byte string literal not displayed */

LoadPipelineHistoryRequest Load pipeline history request without json data

Variables

View Source
var (
	// ErrAlreadyTaken Action already taken by a worker
	ErrAlreadyTaken = fmt.Errorf("cds: action already taken")
)
View Source
var (
	// ErrNoStage when request requires specific stage but it does not exist
	ErrNoStage = fmt.Errorf("cds: stage does not exist")
)

Functions

func AWOLPipelineKiller

func AWOLPipelineKiller()

AWOLPipelineKiller will search in database for actions : - Having building status - Without any logs ouput in the last 15 minutes

func BuildExists

func BuildExists(db database.Querier, appID, pipID, envID int64, trigger *sdk.PipelineBuildTrigger) (bool, error)

BuildExists checks if a build already exist

func CheckParameterInPipeline

func CheckParameterInPipeline(db database.Querier, pipelineID int64, paramName string) (bool, error)

CheckParameterInPipeline check if the parameter is already in the pipeline or not

func CheckPrerequisites

func CheckPrerequisites(s sdk.Stage, pb sdk.PipelineBuild) (bool, error)

CheckPrerequisites verifies that all prerequisite are matched before scheduling

func CountPipelineByProject

func CountPipelineByProject(db database.Querier, projectID int64) (int, error)

CountPipelineByProject Count the number of pipelines for the given project

func CountStageByPipelineID

func CountStageByPipelineID(db database.Querier, pipelineID int64) (int, error)

CountStageByPipelineID Count the number of stages for the given pipeline

func CurrentAndPreviousPipelineBuildNumberAndHash

func CurrentAndPreviousPipelineBuildNumberAndHash(db database.Querier, buildNumber, pipelineID, applicationID, environmentID int64) (*BuildNumberAndHash, *BuildNumberAndHash, error)

CurrentAndPreviousPipelineBuildNumberAndHash returns a struct with BuildNumber, Commit Hash and Branch for the current pipeline build and the previous one on the same branch. Returned pointers may be null if pipeline build are not found

func DeleteActionBuild added in v0.4.0

func DeleteActionBuild(db database.QueryExecuter, pipelineActionIDs []int64) error

DeleteActionBuild Delete Action Build

func DeleteAllParameterFromPipeline

func DeleteAllParameterFromPipeline(db database.Executer, pipelineID int64) error

DeleteAllParameterFromPipeline Delete all parameters from the given pipeline

func DeleteAllStage

func DeleteAllStage(db database.QueryExecuter, pipelineID int64, userID int64) error

DeleteAllStage Delete all stages from pipeline ID

func DeleteBuild added in v0.4.0

func DeleteBuild(db database.QueryExecuter, buildID int64) error

DeleteBuild Delete a build

func DeleteBuildLogs added in v0.4.0

func DeleteBuildLogs(db database.Executer, actionBuildID int64) error

DeleteBuildLogs delete build log

func DeleteJob

func DeleteJob(db database.QueryExecuter, job sdk.Job, userID int64) error

DeleteJob Delete a job ( action + pipeline_action )

func DeleteParameterFromPipeline

func DeleteParameterFromPipeline(db database.Executer, pipelineID int64, paramName string) error

DeleteParameterFromPipeline Delete a parameter from the given pipeline

func DeletePipeline

func DeletePipeline(db database.QueryExecuter, pipelineID int64, userID int64) error

DeletePipeline remove given pipeline and all history from database

func DeletePipelineAction

func DeletePipelineAction(db database.QueryExecuter, pipelineActionID int64) error

DeletePipelineAction Delete an action in a pipeline

func DeletePipelineActionByStage

func DeletePipelineActionByStage(db database.QueryExecuter, stageID int64, userID int64) error

DeletePipelineActionByStage Delete all action from a stage

func DeletePipelineBuild

func DeletePipelineBuild(db database.QueryExecuter, pipelineBuildID int64) error

DeletePipelineBuild deletes a pipeline build and generated artifacts

func DeletePipelineBuildArtifact

func DeletePipelineBuildArtifact(db database.QueryExecuter, pipelineBuildID int64) error

DeletePipelineBuildArtifact Delete artifact for the current build

func DeletePipelineTestResults added in v0.4.0

func DeletePipelineTestResults(db database.Executer, pipID int64) error

DeletePipelineTestResults removes from database test results for a specific pipeline

func DeleteStageByID

func DeleteStageByID(tx database.QueryExecuter, s *sdk.Stage, userID int64) error

DeleteStageByID Delete stage with associated pipeline action

func DeleteTestResults added in v0.4.0

func DeleteTestResults(db database.Executer, pbID int64) error

DeleteTestResults removes from database test results for a specific pipeline build

func ExistPipeline

func ExistPipeline(db database.Querier, projectID int64, name string) (bool, error)

ExistPipeline Check if the given pipeline exist in database

func GetAllLastBuildByApplication

func GetAllLastBuildByApplication(db database.Querier, applicationID int64, branchName string) ([]sdk.PipelineBuild, error)

GetAllLastBuildByApplication Get the last build result for all pipelines in the given application

func GetAllLastBuildByApplicationAndVersion

func GetAllLastBuildByApplicationAndVersion(db database.Querier, applicationID int64, branchName string, version int) ([]sdk.PipelineBuild, error)

GetAllLastBuildByApplicationAndVersion Get the last build for current application/branch/version

func GetAllParametersInPipeline

func GetAllParametersInPipeline(db database.Querier, pipelineID int64) ([]sdk.Parameter, error)

GetAllParametersInPipeline Get all parameters for the given pipeline

func GetBranchHistory

func GetBranchHistory(db database.Querier, projectKey, appName string, page, nbPerPage int) ([]sdk.PipelineBuild, error)

GetBranchHistory Get last build for all branches

func GetBranches

func GetBranches(db *sql.DB, app *sdk.Application) ([]sdk.VCSBranch, error)

GetBranches from pipeline build and pipeline history for the given application

func GetDeploymentHistory

func GetDeploymentHistory(db database.Querier, projectKey, appName string) ([]sdk.PipelineBuild, error)

GetDeploymentHistory Get all last deployment

func GetLastBuildNumber

func GetLastBuildNumber(tx database.QueryExecuter, pipelineID int64, applicationID int64, environmentID int64) (int64, bool, error)

GetLastBuildNumber Get the last build number for the given pipeline

func GetProbableLastBuildNumber

func GetProbableLastBuildNumber(db *sql.DB, pipID, appID, envID int64) (int64, bool, error)

GetProbableLastBuildNumber returns the last build number at the time of query. Should be used only for non-sensitive query

func GetVersions

func GetVersions(db database.Querier, app *sdk.Application, branchName string) ([]int, error)

GetVersions Get version for the given application and branch

func Import

func Import(db database.QueryExecuter, proj *sdk.Project, pip *sdk.Pipeline, msgChan chan<- msg.Message) error

Import insert the pipeline in the project of check if the template is the same as existing

func InsertBuildVariable

func InsertBuildVariable(db *sql.DB, pbID int64, v sdk.Variable) error

InsertBuildVariable adds a variable exported in user scripts and forwarded by building worker

func InsertJob

func InsertJob(db database.QueryExecuter, job *sdk.Job, stageID int64, pip *sdk.Pipeline) error

InsertJob Insert a new Job ( pipeline_action + joinedAction )

func InsertLog added in v0.4.0

func InsertLog(db database.Executer, actionBuildID int64, step string, value string) error

InsertLog insert build log into database

func InsertParameterInPipeline

func InsertParameterInPipeline(db database.QueryExecuter, pipelineID int64, param *sdk.Parameter) error

InsertParameterInPipeline Insert a new parameter in the given pipeline

func InsertPipeline

func InsertPipeline(db database.QueryExecuter, p *sdk.Pipeline) error

InsertPipeline inserts pipeline informations in database

func InsertPipelineAction

func InsertPipelineAction(db database.QueryExecuter, projectKey, pipelineName string, actionID int64, args string, stageID int64) (int64, error)

InsertPipelineAction insert an action in a pipeline

func InsertPipelineBuild

func InsertPipelineBuild(tx database.QueryExecuter, project *sdk.Project, p *sdk.Pipeline, applicationData *sdk.Application, applicationPipelineArgs []sdk.Parameter, params []sdk.Parameter, env *sdk.Environment, version int64, trigger sdk.PipelineBuildTrigger) (sdk.PipelineBuild, error)

InsertPipelineBuild insert build informations in database so Scheduler can pick it up

func InsertPipelineJob

func InsertPipelineJob(db database.QueryExecuter, pip *sdk.Pipeline, s *sdk.Stage, a *sdk.Action) error

InsertPipelineJob insert data in pipeline_action table DEPRECATED

func InsertStage

func InsertStage(db database.QueryExecuter, s *sdk.Stage) error

InsertStage insert given stage into given database

func InsertStagePrequisites

func InsertStagePrequisites(db database.QueryExecuter, s *sdk.Stage) error

InsertStagePrequisites insert prequisite for given stage in database

func InsertTestResults added in v0.4.0

func InsertTestResults(db database.Executer, pbID int64, tests sdk.Tests) error

InsertTestResults inserts test results of a specific pipeline build in database

func LoadActionBuild added in v0.4.0

func LoadActionBuild(db *sql.DB, id string) (sdk.ActionBuild, error)

LoadActionBuild Load an action_build by ID

func LoadActionStatus

func LoadActionStatus(db database.Querier, pipelineActionID int64, pipelineBuildID int64) (sdk.Status, error)

LoadActionStatus Load status of action_build for the given pipeline_action

func LoadBuildByPipelineBuildID added in v0.4.0

func LoadBuildByPipelineBuildID(db *sql.DB, pipelineBuildID int64) ([]sdk.ActionBuild, error)

LoadBuildByPipelineBuildID Load all actions_build by pipeline ID

func LoadBuildIDsToArchive

func LoadBuildIDsToArchive(db *sql.DB, hours int) ([]int64, error)

LoadBuildIDsToArchive Load build to archive

func LoadBuildingPipelines

func LoadBuildingPipelines(db *sql.DB, args ...FuncArg) ([]sdk.PipelineBuild, error)

LoadBuildingPipelines retrieves pipelines in database having a build running

func LoadCompletePipelineBuildToArchive

func LoadCompletePipelineBuildToArchive(db database.Querier, pipelineBuildID int64) (sdk.PipelineBuild, error)

LoadCompletePipelineBuildToArchive Load all information about a build

func LoadGroupByPipeline

func LoadGroupByPipeline(db database.Querier, pipeline *sdk.Pipeline) error

func LoadGroupWaitingQueue added in v0.4.0

func LoadGroupWaitingQueue(db *sql.DB, groupID int64) ([]sdk.ActionBuild, error)

LoadGroupWaitingQueue loads action build in queue accessbible to given group

func LoadLogs added in v0.4.0

func LoadLogs(db *sql.DB, actionBuildID int64, tail int64, start int64) ([]sdk.Log, error)

LoadLogs retrieves build logs from databse given an offset and a size

func LoadPipeline

func LoadPipeline(db database.Querier, projectKey, name string, deep bool) (*sdk.Pipeline, error)

LoadPipeline loads a pipeline from database

func LoadPipelineActionBuildLogs added in v0.4.0

func LoadPipelineActionBuildLogs(db *sql.DB, pipelineBuildID, pipelineActionID int64, offset int64) (sdk.BuildState, error)

LoadPipelineActionBuildLogs Load log for the given pipeline action

func LoadPipelineBuild

func LoadPipelineBuild(db database.Querier, pipelineID int64, applicationID int64, buildNumber int64, environmentID int64, args ...FuncArg) (sdk.PipelineBuild, error)

LoadPipelineBuild retrieves informations about a specific build

func LoadPipelineBuildByHash

func LoadPipelineBuildByHash(db *sql.DB, hash string) ([]sdk.PipelineBuild, error)

LoadPipelineBuildByHash look for a pipeline build triggered by a change with given hash

func LoadPipelineBuildByID added in v0.4.0

func LoadPipelineBuildByID(tx *sql.Tx, pipelineBuildID int64) (sdk.PipelineBuild, error)

LoadPipelineBuildByID look for a pipeline build by pipelineBuildID

func LoadPipelineBuildChildren

func LoadPipelineBuildChildren(db *sql.DB, pipelineID int64, applicationID int64, buildNumber int64, environmentID int64) ([]sdk.PipelineBuild, error)

LoadPipelineBuildChildren load triggered pipeline from given build

func LoadPipelineBuildHistoryByApplication

func LoadPipelineBuildHistoryByApplication(db database.Querier, applicationID int64, limit int) ([]sdk.PipelineBuild, error)

LoadPipelineBuildHistoryByApplication Load application history DEPRECATED! See: project.LoadBuildActivity

func LoadPipelineBuildHistoryByApplicationAndPipeline

func LoadPipelineBuildHistoryByApplicationAndPipeline(db database.Querier, applicationID, pipelineID, environmentID int64, limit int, status, branchName string, args ...FuncArg) ([]sdk.PipelineBuild, error)

LoadPipelineBuildHistoryByApplicationAndPipeline Load pipeline history

func LoadPipelineBuildLogs added in v0.4.0

func LoadPipelineBuildLogs(db *sql.DB, pipelineBuildID int64, offset int64) ([]sdk.Log, error)

LoadPipelineBuildLogs Load pipeline build logs by pipeline ID

func LoadPipelineByGroup

func LoadPipelineByGroup(db database.Querier, group *sdk.Group) error

LoadPipelineByGroup loads all pipelines where group has access

func LoadPipelineByID

func LoadPipelineByID(db database.Querier, pipelineID int64, deep bool) (*sdk.Pipeline, error)

LoadPipelineByID loads a pipeline from database

func LoadPipelineHistoryBuild

func LoadPipelineHistoryBuild(db database.Querier, pipelineID int64, applicationID int64, buildNumber int64, environmentID int64) (sdk.PipelineBuild, error)

LoadPipelineHistoryBuild retrieves informations about a specific build in pipeline_history

func LoadPipelineStage

func LoadPipelineStage(db database.Querier, p *sdk.Pipeline, args ...FuncArg) error

func LoadPipelines

func LoadPipelines(db database.Querier, projectID int64, loadDependencies bool, user *sdk.User) ([]sdk.Pipeline, error)

LoadPipelines loads all pipelines in a project

func LoadRecentPipelineBuild

func LoadRecentPipelineBuild(db *sql.DB, args ...FuncArg) ([]sdk.PipelineBuild, error)

LoadRecentPipelineBuild retrieves pipelines in database having a build running or finished less than a minute ago

func LoadStage

func LoadStage(db database.Querier, pipelineID int64, stageID int64) (*sdk.Stage, error)

LoadStage Get a stage from its ID and pipeline ID

func LoadStages

func LoadStages(db *sql.DB, pipelineID int64) ([]sdk.Stage, error)

LoadStages Get all stages for the given pipeline

func LoadTestResults added in v0.4.0

func LoadTestResults(db *sql.DB, pbID int64) (sdk.Tests, error)

LoadTestResults retrieves tests on a specific build in database

func LoadUserBuildingPipelines

func LoadUserBuildingPipelines(db *sql.DB, userID int64) ([]sdk.PipelineBuild, error)

LoadUserBuildingPipelines retrieves all building pipelines user has access to

func LoadUserRecentPipelineBuild

func LoadUserRecentPipelineBuild(db *sql.DB, userID int64) ([]sdk.PipelineBuild, error)

LoadUserRecentPipelineBuild retrieves all user accessible pipeline build finished less than a minute ago

func LoadUserWaitingQueue added in v0.4.0

func LoadUserWaitingQueue(db *sql.DB, u *sdk.User) ([]sdk.ActionBuild, error)

LoadUserWaitingQueue loads action build in queue where user has access

func LoadWaitingQueue added in v0.4.0

func LoadWaitingQueue(db *sql.DB) ([]sdk.ActionBuild, error)

LoadWaitingQueue Load Waiting action_build

func MoveStage

func MoveStage(db *sql.DB, stageToMove *sdk.Stage, newBuildOrder int, p *sdk.Pipeline) error

MoveStage Move a stage

func ProcessPipelineBuildVariables

func ProcessPipelineBuildVariables(pipelineParams []sdk.Parameter, applicationPipelineArgs []sdk.Parameter, buildArgs []sdk.Parameter) (map[string]sdk.Parameter, error)

ProcessPipelineBuildVariables gathers together parameters from: - RunRequest -> add "cds.pip." prefix to them - Trigger parameters - Default PipelineApplication parameters - Builtin cds variables (.cds.* and .git.*)

func RestartActionBuild

func RestartActionBuild(db *sql.Tx, actionBuildID int64) error

RestartActionBuild destroy action build data and queue it up again

func RestartPipelineBuild

func RestartPipelineBuild(db *sql.DB, pb sdk.PipelineBuild) error

RestartPipelineBuild restarts failed actions build

func SavePipelineBuildHistory

func SavePipelineBuildHistory(db database.QueryExecuter, pb sdk.PipelineBuild) error

SavePipelineBuildHistory Archive current build

func SelectBuildForUpdate

func SelectBuildForUpdate(db database.Querier, buildID int64) error

SelectBuildForUpdate Select a build and lock a build

func SelectBuildInHistory

func SelectBuildInHistory(db database.Querier, pipelineID int64, applicationID int64, buildNumber int64, environmentID int64) (sdk.PipelineBuild, error)

SelectBuildInHistory load history of the given build

func SelectBuildsInHistory

func SelectBuildsInHistory(db database.Querier, pipelineID int64, applicationID int64, environmentID int64, limit int, status string) ([]sdk.PipelineBuild, error)

SelectBuildsInHistory load history

func StopPipelineBuild

func StopPipelineBuild(db *sql.DB, pbID int64) error

StopPipelineBuild fails all currently building actions

func TakeActionBuild added in v0.4.0

func TakeActionBuild(db *sql.DB, buildID string, worker *sdk.Worker) (sdk.ActionBuild, error)

TakeActionBuild Take an action build for update

func UpdateActionBuildStatus added in v0.4.0

func UpdateActionBuildStatus(db *sql.Tx, ab *sdk.ActionBuild, status sdk.Status) error

UpdateActionBuildStatus Update status of an action_build

func UpdateJob

func UpdateJob(db database.QueryExecuter, job *sdk.Job, userID int64) error

UpdateJob updates the job by actionData.PipelineActionID and actionData.ID

func UpdateParameterInPipeline

func UpdateParameterInPipeline(db database.Executer, pipelineID int64, param sdk.Parameter) error

UpdateParameterInPipeline Update a parameter in the given pipeline

func UpdatePipeline

func UpdatePipeline(db database.Executer, p *sdk.Pipeline) error

UpdatePipeline update the pipeline

func UpdatePipelineAction

func UpdatePipelineAction(db database.Executer, action sdk.Action, args string) error

UpdatePipelineAction Update an action in a pipeline

func UpdatePipelineBuildStatus

func UpdatePipelineBuildStatus(db database.QueryExecuter, pb sdk.PipelineBuild, status sdk.Status) error

UpdatePipelineBuildStatus Update status of pipeline_build

func UpdatePipelineLastModified

func UpdatePipelineLastModified(db database.QueryExecuter, p *sdk.Pipeline) error

UpdatePipelineLastModified Update last_modified date on pipeline

func UpdateStage

func UpdateStage(db database.QueryExecuter, s *sdk.Stage) error

UpdateStage update Stage and all its prequisites

func UpdateTestResults added in v0.4.0

func UpdateTestResults(db *sql.DB, pbID int64, tests sdk.Tests) error

UpdateTestResults update test results of a specific pipeline build in database

Types

type BuildNumberAndHash

type BuildNumberAndHash struct {
	BuildNumber int64
	Hash        string
	Branch      string
}

BuildNumberAndHash represents BuildNumber, Commit Hash and Branch for a Pipeline Build

type FuncArg

type FuncArg func(args *structarg)

FuncArg defines the base type for functional argument of pipeline funcs

func WithParameters

func WithParameters() FuncArg

WithParameters set boolean to load parameters

func WithStages

func WithStages() FuncArg

WithStages set boolean to load stages

Jump to

Keyboard shortcuts

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