Description: Triggers a pipeline. If a runId is supplied in the request body, environment variables from the specified run will be reused. Environment variables can be overridden and extended. Resource versions can be overridden. Any integrations will use the most recent version of the integration.
Security: Requires a valid user
Usage: POST api/v1/pipelines/trigger
Produces: application/json
Request Parameters:
Parameter | Type | Description | Required/Optional |
---|---|---|---|
| Integer | The ID of a previous run that should be rerun. If this parameter is supplied, pipelineName, pipielineBranch and projectKey will be ignored. | Optional (required if pipelineName is not supplied) |
| string | The name of the pipeline to trigger. | Optional |
| string | The branch of the pipeline to trigger. If runId is not supplied, this field is required for multibranch pipelines. | Optional |
| Object | The project key of the pipeline to trigger. If runId is not supplied, this field is required for installations with more than one project. | Optional |
| Array of Objects | The steps to run in the pipeline. Any downstream steps will run automatically, but can also be specified. If this field is blank and a runId is supplied, all steps that ran in the specified run will run. If this field is blank and a pipelineName is supplied, all steps defined in the pipeline will run.
| Optional |
| Array of Objects | Pipeline-level environment variables. These are used in all steps in the pipeline. | Optional |
Sample request bodies:
// trigger a pipeline { pipelineName: 123, projectKey: foo, branchName: dev, injectedPipeEnvs: [ # these apply to all steps in the run { key: password, value: password } ], steps: [ { name: step1, injectedEnvs: [ # these apply only to the single step { key: hello, value: world } ], resourceOverrides: [ { resourceVersionId: 42, resourceId: 43 } ] }, { name: step2, injectedEnvs: [ { key: abc, value: 123 } ] } ] } // retrigger a run { runId: 42 injectedPipeEnvs: [ { key: password, value: password } ], steps: [ { name: step1, injectedEnvs: [ { key: hello, value: world } ], resourceOverrides: [ { resourceVersionId: 42, resourceId: 43 } ] }, { name: step2, injectedEnvs: [ { key: abc, value: 123 } ] } ] }
Sample Response:
{ triggerId: 123 }
Response Codes:
200: Success
400: Bad Request