Create deploy pipeline

3 minute read

POST /organizations/{organization_uuid}/projects/{project_uuid}/deploy_pipelines

Creates a new deploy pipeline on the specified project.

config is expressed as an array of deployment objects and some of the keys on those objects might differ between deployment types.

There are two required keys for all deployments:

  • position represents the order of the deployments

  • type represents the kind of deployment

Deployment types

A list of all supported types of deployments and corresponding required/optional attributes for each of them.

Custom script

  • Type: script_deployment

  • Required fields:

    • commands array[string]

AWS Elastic Beanstalk

  • Type: elastic_beanstalk_deployment

  • Required fields:

    • aws_access_key_id

    • aws_secret_access_key

    • region

    • s3_bucket

    • application_name

    • environment_name

AWS S3

  • Type: s3_deployment

  • Required fields:

    • aws_access_key_id

    • aws_secret_access_key

    • region

    • s3_bucket

    • local_path

    • acl

AWS Code Deploy

  • Type: aws_code_deploy_deployment

  • Required fields:

    • aws_access_key_id

    • aws_secret_access_key

    • region

    • s3_bucket

    • application_name

    • deployment_group_name

  • Optional fields

    • deployment_config_name

Google App Engine

  • Type: app_engine_deployment

  • Required fields:

    • path

    • url

    • refresh_token

Heroku

  • Type: heroku_deployment

  • Required fields:

    • name

    • api_key

  • Optional fields:

    • url

    • restore_from

    • post_deploy

    • backup

    • force

    • check_url

Authentication

  • OAuth2

OAuth2 scopes

  • project.write

Path parameters

Field name Type Required

organization_uuid

string

X

project_uuid

string

X

Headers

Field name Type Required

Authorization

string

X

Request body schema

  • Content type: application/json

  • Response schema type: object

Field name Type Required

branch

string

X

match_mode

string

X

config

array[object]

X

  • position

number

X

  • type

string Allowed values: script_deployment, elastic_beanstalk_deployment, s3_deployment, aws_code_deploy_deployment, app_engine_deployment, heroku_deployment

X

  • aws_access_key_id

string

  • aws_secret_access_key

string

  • region

string

  • application_name

string

  • environment_name

string

  • s3_bucket

string

  • local_path

string

  • acl

string

  • deployment_group_name

string

  • deployment_config_name

string

  • path

string

  • url

string

  • refresh_token

string

  • name

string

  • api_key

string

  • restore_from

string

  • post_deploy

string

  • backup

string

  • force

string

  • check_url

string

  • commands

array[string]

Responses

Code Datatype

200

Response schema

400

Error

401

Error

403

Error

404

Error

500

Error

Response schema

  • Content type: application/json

  • Response schema type: object

Field name Type

id

number

project_uuid

string

branch

string

match_mode

string

config

array[object]

created_at

string

updated_at

string

Code examples

cURL
Go
Java
Node
PHP
Python
Ruby
C#
curl --request POST \ --url https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/deploy_pipelines \ --header 'authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9' \ --header 'content-type: application/json' \ --data '{"branch":"string (required)","match_mode":"string (required)","config":[{"position":"number (required)","type":"string (required)","aws_access_key_id":"string (optional)","aws_secret_access_key":"string (optional)","region":"string (optional)","application_name":"string (optional)","environment_name":"string (optional)","s3_bucket":"string (optional)","local_path":"string (optional)","acl":"string (optional)","deployment_group_name":"string (optional)","deployment_config_name":"string (optional)","path":"string (optional)","url":"string (optional)","refresh_token":"string (optional)","name":"string (optional)","api_key":"string (optional)","restore_from":"string (optional)","post_deploy":"string (optional)","backup":"string (optional)","force":"string (optional)","check_url":"string (optional)","commands":["string"]}]}'
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/deploy_pipelines" payload := strings.NewReader("{\"branch\":\"string (required)\",\"match_mode\":\"string (required)\",\"config\":[{\"position\":\"number (required)\",\"type\":\"string (required)\",\"aws_access_key_id\":\"string (optional)\",\"aws_secret_access_key\":\"string (optional)\",\"region\":\"string (optional)\",\"application_name\":\"string (optional)\",\"environment_name\":\"string (optional)\",\"s3_bucket\":\"string (optional)\",\"local_path\":\"string (optional)\",\"acl\":\"string (optional)\",\"deployment_group_name\":\"string (optional)\",\"deployment_config_name\":\"string (optional)\",\"path\":\"string (optional)\",\"url\":\"string (optional)\",\"refresh_token\":\"string (optional)\",\"name\":\"string (optional)\",\"api_key\":\"string (optional)\",\"restore_from\":\"string (optional)\",\"post_deploy\":\"string (optional)\",\"backup\":\"string (optional)\",\"force\":\"string (optional)\",\"check_url\":\"string (optional)\",\"commands\":[\"string\"]}]}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9") req.Header.Add("content-type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"branch\":\"string (required)\",\"match_mode\":\"string (required)\",\"config\":[{\"position\":\"number (required)\",\"type\":\"string (required)\",\"aws_access_key_id\":\"string (optional)\",\"aws_secret_access_key\":\"string (optional)\",\"region\":\"string (optional)\",\"application_name\":\"string (optional)\",\"environment_name\":\"string (optional)\",\"s3_bucket\":\"string (optional)\",\"local_path\":\"string (optional)\",\"acl\":\"string (optional)\",\"deployment_group_name\":\"string (optional)\",\"deployment_config_name\":\"string (optional)\",\"path\":\"string (optional)\",\"url\":\"string (optional)\",\"refresh_token\":\"string (optional)\",\"name\":\"string (optional)\",\"api_key\":\"string (optional)\",\"restore_from\":\"string (optional)\",\"post_deploy\":\"string (optional)\",\"backup\":\"string (optional)\",\"force\":\"string (optional)\",\"check_url\":\"string (optional)\",\"commands\":[\"string\"]}]}"); Request request = new Request.Builder() .url("https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/deploy_pipelines") .post(body) .addHeader("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute();
var http = require("https"); var options = { "method": "POST", "hostname": "api.codeship.com", "port": null, "path": "/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/deploy_pipelines", "headers": { "authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9", "content-type": "application/json" } }; var req = http.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { var body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.write(JSON.stringify({ branch: 'string (required)', match_mode: 'string (required)', config: [ { position: 'number (required)', type: 'string (required)', aws_access_key_id: 'string (optional)', aws_secret_access_key: 'string (optional)', region: 'string (optional)', application_name: 'string (optional)', environment_name: 'string (optional)', s3_bucket: 'string (optional)', local_path: 'string (optional)', acl: 'string (optional)', deployment_group_name: 'string (optional)', deployment_config_name: 'string (optional)', path: 'string (optional)', url: 'string (optional)', refresh_token: 'string (optional)', name: 'string (optional)', api_key: 'string (optional)', restore_from: 'string (optional)', post_deploy: 'string (optional)', backup: 'string (optional)', force: 'string (optional)', check_url: 'string (optional)', commands: [ 'string' ] } ] })); req.end();
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/deploy_pipelines", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\"branch\":\"string (required)\",\"match_mode\":\"string (required)\",\"config\":[{\"position\":\"number (required)\",\"type\":\"string (required)\",\"aws_access_key_id\":\"string (optional)\",\"aws_secret_access_key\":\"string (optional)\",\"region\":\"string (optional)\",\"application_name\":\"string (optional)\",\"environment_name\":\"string (optional)\",\"s3_bucket\":\"string (optional)\",\"local_path\":\"string (optional)\",\"acl\":\"string (optional)\",\"deployment_group_name\":\"string (optional)\",\"deployment_config_name\":\"string (optional)\",\"path\":\"string (optional)\",\"url\":\"string (optional)\",\"refresh_token\":\"string (optional)\",\"name\":\"string (optional)\",\"api_key\":\"string (optional)\",\"restore_from\":\"string (optional)\",\"post_deploy\":\"string (optional)\",\"backup\":\"string (optional)\",\"force\":\"string (optional)\",\"check_url\":\"string (optional)\",\"commands\":[\"string\"]}]}", CURLOPT_HTTPHEADER => array( "authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
import http.client conn = http.client.HTTPSConnection("api.codeship.com") payload = "{\"branch\":\"string (required)\",\"match_mode\":\"string (required)\",\"config\":[{\"position\":\"number (required)\",\"type\":\"string (required)\",\"aws_access_key_id\":\"string (optional)\",\"aws_secret_access_key\":\"string (optional)\",\"region\":\"string (optional)\",\"application_name\":\"string (optional)\",\"environment_name\":\"string (optional)\",\"s3_bucket\":\"string (optional)\",\"local_path\":\"string (optional)\",\"acl\":\"string (optional)\",\"deployment_group_name\":\"string (optional)\",\"deployment_config_name\":\"string (optional)\",\"path\":\"string (optional)\",\"url\":\"string (optional)\",\"refresh_token\":\"string (optional)\",\"name\":\"string (optional)\",\"api_key\":\"string (optional)\",\"restore_from\":\"string (optional)\",\"post_deploy\":\"string (optional)\",\"backup\":\"string (optional)\",\"force\":\"string (optional)\",\"check_url\":\"string (optional)\",\"commands\":[\"string\"]}]}" headers = { 'authorization': "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9", 'content-type': "application/json" } conn.request("POST", "/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/deploy_pipelines", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
require 'uri' require 'net/http' url = URI("https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/deploy_pipelines") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(url) request["authorization"] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9' request["content-type"] = 'application/json' request.body = "{\"branch\":\"string (required)\",\"match_mode\":\"string (required)\",\"config\":[{\"position\":\"number (required)\",\"type\":\"string (required)\",\"aws_access_key_id\":\"string (optional)\",\"aws_secret_access_key\":\"string (optional)\",\"region\":\"string (optional)\",\"application_name\":\"string (optional)\",\"environment_name\":\"string (optional)\",\"s3_bucket\":\"string (optional)\",\"local_path\":\"string (optional)\",\"acl\":\"string (optional)\",\"deployment_group_name\":\"string (optional)\",\"deployment_config_name\":\"string (optional)\",\"path\":\"string (optional)\",\"url\":\"string (optional)\",\"refresh_token\":\"string (optional)\",\"name\":\"string (optional)\",\"api_key\":\"string (optional)\",\"restore_from\":\"string (optional)\",\"post_deploy\":\"string (optional)\",\"backup\":\"string (optional)\",\"force\":\"string (optional)\",\"check_url\":\"string (optional)\",\"commands\":[\"string\"]}]}" response = http.request(request) puts response.read_body
var client = new RestClient("https://api.codeship.com/v2/organizations/721cea10-b6a5-0104-5b93-5240c481c5a2/projects/019f9bcc-ce4b-4179-a533-c3995f4b6161/deploy_pipelines"); var request = new RestRequest(Method.POST); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"); request.AddParameter("application/json", "{\"branch\":\"string (required)\",\"match_mode\":\"string (required)\",\"config\":[{\"position\":\"number (required)\",\"type\":\"string (required)\",\"aws_access_key_id\":\"string (optional)\",\"aws_secret_access_key\":\"string (optional)\",\"region\":\"string (optional)\",\"application_name\":\"string (optional)\",\"environment_name\":\"string (optional)\",\"s3_bucket\":\"string (optional)\",\"local_path\":\"string (optional)\",\"acl\":\"string (optional)\",\"deployment_group_name\":\"string (optional)\",\"deployment_config_name\":\"string (optional)\",\"path\":\"string (optional)\",\"url\":\"string (optional)\",\"refresh_token\":\"string (optional)\",\"name\":\"string (optional)\",\"api_key\":\"string (optional)\",\"restore_from\":\"string (optional)\",\"post_deploy\":\"string (optional)\",\"backup\":\"string (optional)\",\"force\":\"string (optional)\",\"check_url\":\"string (optional)\",\"commands\":[\"string\"]}]}", ParameterType.RequestBody); IRestResponse response = client.Execute(request);