Deploying code to an OC application via git


#1
curl -X POST \
     -H "Authorization: Bearer <thy_api_key>" \
     -d '<request_body_json>'
https://www.opscaptain.com/api/instances/app/gitdeploy

Request body JSON format

{
     "appid": "STRING", 
     "provider": "STRING",
     "repo": "STRING", 
     "branch": "STRING", 
     "clone": "STRING", 
     "head": "optional STRING", 
     "buildpacks": ["optional STRING ARRAY"], 
     "runcmd": "optional STRING"
}

Request body parameters explained

appid – The application to reference when deploying the code

provider – The git repository provider. Possible values include: github, bitbucet and gitlab. Note, for this feature to work, you must have logged into OC using one of the mentioned providers.

repo – The name of the repository to deploy.

branch – The branch to deploy. For example: master.

clone – This is the git URL to the repository that ends with .git. You do not have to include authentication information in the URL as OC will auto inject it at execution time.

head – If you want to deploy up to a specific commit. You can provide the ID hash of the commit to use.

buildpacks – If you want to specify the build packs to be used, you can use this parameter to provide the git urls of the build packs. This parameter is rarely used as the default provided build packs are more than adequate for most use cases. Note, the build packs will be executed in the order as provided by the array.

runcmd – If you have a Procfile with multiple named commands, you can use this parameter to specify which of the commands to run. For example, lets say the same repo runs both your jobs and web application and you have the below Procfile and you want the application to start running your jobs, you will specify job for this parameter. See example Procfile:

web: node app.js
job: node job.js

Remarks
This request returns a response when the deployment is complete or fails. As such, expect a few minutes before completion. If a deployment is on going, initiating another deployment will fail.