Skip to content

Pipeline

To interact with pipelines, the pipelineService object is defined.

The pipeline entity contains the following data:

class Pipeline {...}
Name Data Type Description
id string Pipeline UUID
status string Pipeline status. Possible values: CREATED, PENDING, RUNNING, SUCCESS, FAILED, CANCELED, SKIPPED, MANUAL, SCHEDULED, PREPARING, WAITING_FOR_RESOURCE
duration number Pipeline execution time in milliseconds
projectId string Project UUID where the pipeline was created
userId string UUID of the user who triggered the pipeline
localId number Local number of the pipeline
mergeRequestId string Related merge request UUID
commitId string Commit hash the pipeline was created on
beforeCommitId string Previous commit hash
sourceCommitId string Source commit hash
ref string Git reference to the tag or branch
isTag boolean Pipeline was created from a tag: true or not: false
yamlErrors string Configuration file errors
source string Trigger source. Possible values: PUSH, TRIGGER, SCHEDULE, WEB, API, PARENTT_PIPELINE, MERGE_REQUEST_EVENT, SCRIPT
configSource number Numeric designation of the trigger source
failureReason string Reason for pipeline failure
startedAt string Pipeline start time
finishedAt string Pipeline finish time
createdAt string Pipeline creation time
isMergedResults boolean The pipeline is the result of a merge: true or not: false

Methods for Working with Pipelines

The following methods exist for working with the pipeline entity:

Creating a Pipeline

pipelineService.create({projectId}, {ref}) => Pipeline

This method creates a pipeline on the default branch of the project and returns it. You need to provide the following values:

Name Data Type Description
projectId string Project UUID where the pipeline will be created
ref string Git reference to the tag or branch

Creating a Blank Pipeline

This pipeline cannot be run in GitFlic

pipelineService.createBlank({projectId}, {ref}) => Pipeline

This method creates a blank pipeline and returns it. You need to provide the following values:

Name Data Type Description
projectId string Project UUID where the pipeline will be created
ref string Git reference to the tag or branch

Getting a List of All Pipelines

pipelineService.findAllByProject({projectId}, {startPage}, {pageSize}) => Page<Pipeline>

This method returns an object with all pipelines in a project. You need to provide the following values:

Name Data Type Description
projectId string Project UUID to search in
startPage number Requested page number
pageSize number Page size

Getting a List of Pipelines by Branch or Tag

pipelineService.findByProjectIdAndRef({projectId}, {ref}, {startPage}, {pageSize}) => Page<Pipeline>

This method returns an object with pipelines created for the specified branch or tag. You need to provide the following values:

Name Data Type Description
projectId string Project UUID to search in
ref string Git reference to the tag or branch
startPage number Requested page number
pageSize number Page size

Getting a Pipeline by Local Number

pipelineService.findByLocalId({projectId}, {localId}) => Pipeline

This method returns a pipeline with the specified number in the project. You need to provide the following values:

Name Data Type Description
projectId string Project UUID to search in
localId number Local pipeline number

Getting a Pipeline by UUID

pipelineService.findById({pipelineId}) => Pipeline

This method returns a pipeline with the specified UUID. You need to provide the following values:

Name Data Type Description
pipelineId string Pipeline UUID

Getting a List of Pipelines in a Merge Request

pipelineService.findByMergeRequestId({mergeRequestId}, {startPage}, {pageSize}) => Page<Pipeline>

This method returns an object with all pipelines associated with the specified merge request. You need to provide the following values:

Name Data Type Description
mergeRequestId string Merge request UUID
startPage number Requested page number
pageSize number Page size

Restarting a Pipeline

pipelineService.restart({pipelineId}) => void

This method restarts the specified pipeline. You need to provide the following values:

Name Data Type Description
pipelineId string Pipeline UUID

Canceling a Pipeline

pipelineService.cancelPipeline({pipelineId}) => void

This method cancels the specified pipeline. You need to provide the following values:

Name Data Type Description
pipelineId string Pipeline UUID

Changing Pipeline Status

pipelineService.changeStatus({pipelineId}, {status}) => void

This method changes the status of the specified pipeline. You need to provide the following values:

Name Data Type Description
pipelineId string Pipeline UUID
status string Pipeline status. Possible values: CREATED, PENDING, RUNNING, SUCCESS, FAILED, CANCELED, SKIPPED, MANUAL, SCHEDULED, PREPARING, WAITING_FOR_RESOURCE

Updating Pipeline Start Time

pipelineService.setStartTime({pipelineId}, {startTimeMillis}) => void

This method changes the start time of the specified pipeline. You need to provide the following values:

Name Data Type Description
pipelineId string Pipeline UUID
startTimeMillis number UnixTime to the thousandth of a second

Updating Pipeline Finish Time

pipelineService.setFinishTime({pipelineId}, {finishTimeMillis}) => void

This method changes the finish time of the specified pipeline. You need to provide the following values:

Name Data Type Description
pipelineId string Pipeline UUID
finishTimeMillis number UnixTime to the thousandth of a second

Changing Pipeline Execution Time

pipelineService.setExecutionTime({pipelineId}, {duration}) => void

This method changes the execution time of the specified pipeline. You need to provide the following values:

Name Data Type Description
pipelineId string Pipeline UUID
duration number Execution time in milliseconds

Creating a Stage

pipelineService.createStage({pipelineId}, {name}, {status}) => Stage

This method creates a new empty stage in the pipeline and returns it. You need to provide the following values:

Name Data Type Description
pipelineId string Pipeline UUID
name string Stage name
status string Pipeline status. Possible values: CREATED, PENDING, RUNNING, SUCCESS, FAILED, CANCELED, SKIPPED, MANUAL, SCHEDULED, PREPARING, WAITING_FOR_RESOURCE

Changing Stage Status

pipelineService.changeStageStatus({stageId}, {status}) => Stage

This method changes the status of a stage in the pipeline and returns it. You need to provide the following values:

Name Data Type Description
stageId string Stage UUID
status string Pipeline status. Possible values: CREATED, PENDING, RUNNING, SUCCESS, FAILED, CANCELED, SKIPPED, MANUAL, SCHEDULED, PREPARING, WAITING_FOR_RESOURCE

Automated translation!

This page was translated using automatic translation tools. The text may contain inaccuracies.