Add a Pipeline Source

JFrog REST APIs

Products
JFrog Xray
Content Type
REST API
ft:sourceType
Paligo

Description: Adds a pipeline source. Requires projectId or project with name.

Security: Requires admin credentials

Usage: POST api/v1/pipelinesources

Produces: application/json

Required Parameters:

Parameter

Type

Description

Required/Optional

projectId

Integer

Id of the Project.

Required

project

String

An object containing a project name as an alternative to projectId.

You can set the following properties:

  • Name: Name of the Project.

  • Key: A unique Project Key to identify and group your Projects.

Optional

projectIntegrationId

integer

Id of the Git integration to use to create the pipeline source. For more information, see Get Project Integrations.

Required

repositoryFullName

String

The full name of the Git repository including the user/organization as it appears in a Git clone command. For example, myOrg/myProject.

Required, unless valuesYmlPropertyBag is provided

branch

String

For single branch pipeline sources. Name of branch that has the pipeline definition.

Required for a single branch pipeline

fileFilter

String

If no templateId was provided, a regular expression to determine which files to include in pipeline sync (the YML files), with default pipelines.yml. If a templateId was provided, it must be values.yml.

Required

name

String

Name of the source.

Required

cloneProtocol

String

Type of the protocol. Allowed values are ssh or https.

Required

isMultiBranch

Boolean

True if the pipeline source is to be a multi-branch pipeline source. Otherwise, it will be a single-branch pipeline source.

Optional

branchExcludePattern

String

For multi-branch pipeline sources, a regular expression of the branches to exclude.

Optional

branchIncludePattern

String

For multi-branch pipeline sources, a regular expression of the branches to include.

Optional

environments

Array

In a project, an array of environment names in which this pipeline source will be.

Optional

templateId

Integer

The id of a template to use for this pipeline source, in which case the fileFilter will only specify the values.yml.

Optional

valuesYmlPropertyBag

Object

An object containing values for the template as an alternative to the repository.

Optional

Sample Usage:

Example: Adds a pipeline source

curl -X POST -H "Authorization: Bearer <your-token> <Pipelines-Url>/api/v1/pipelinesources -d '{
  "projectId": 1,     
  "projectIntegrationId": 66,
  "repositoryFullName": "myrepo/docker-sample",
  "branch": "master",
  "fileFilter": "pipelines.yml",
  "name": "test_my_resource",
  "cloneProtocol": "ssh"
}' 

Response

200 OK
{
    "id": 1181,
    "projectId": 1,
    "projectIntegrationId": 66,
    "repositoryFullName": "myrepo/docker-sample",
    "isMultiBranch": false,
    "branch": "master",
    "branchIncludePattern": null,
    "branchExcludePattern": null,
    "fileFilter": "pipelines.yml",
    "name": "test_my_resource",
    "cloneProtocol": "ssh",
    "isSyncing": false,
    "lastSyncStatusCode": 0,
    "lastSyncStartedAt": "2020-06-01T20:41:04.650Z",
    "lastSyncEndedAt": "2020-06-01T20:41:04.650Z",
    "lastSyncLogs": null,
    "resourceId": 2017,
    "createdBy": "janeroe",
    "updatedBy": "janeroe"
}

Response Codes:

200: Success

404: No pipeline found for the supplied ID