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 |
|---|---|---|---|
| Integer | Id of the Project. | Required |
| String | An object containing a project name as an alternative to projectId. You can set the following properties:
| Optional |
| integer | Id of the Git integration to use to create the pipeline source. For more information, see Get Project Integrations. | Required |
| 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 |
| String | For single branch pipeline sources. Name of branch that has the pipeline definition. | Required for a single branch pipeline |
| 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 |
| String | Name of the source. | Required |
| String | Type of the protocol. Allowed values are | Required |
| Boolean | True if the pipeline source is to be a multi-branch pipeline source. Otherwise, it will be a single-branch pipeline source. | Optional |
| String | For multi-branch pipeline sources, a regular expression of the branches to exclude. | Optional |
| String | For multi-branch pipeline sources, a regular expression of the branches to include. | Optional |
| Array | In a project, an array of environment names in which this pipeline source will be. | Optional |
| Integer | The id of a template to use for this pipeline source, in which case the fileFilter will only specify the values.yml. | Optional |
| 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