<!-- https://staircase.co/delivery/shipping/deploy -->
# Deploy

# Deploy

Deploying any bundle to any environment, with retry, skip-if-unchanged, and completion reported to the health surface.

A deployment takes a bundle and an environment. It retries on transient failure, cancels cleanly when the platform's code-storage limit is reached rather than half-deploying, and skips entirely when the commit already deployed there.

Completion reports to Health, so the record of what is where is a consequence of deploying rather than a separate bookkeeping step.

## How it works

The skip is keyed on the commit rather than on a version string. A version can be re-tagged; a commit cannot, so the check answers the actual question — is this exact code already running here.

## Operations

<!--source:api-specifications-->

### Foo
<!--/source-->

`POST` `/hello-world`

<!--source:api-specifications-->

#### Bar
<!--/source-->

`helloWorld`

<!--source:api-specifications-->
Hello World
<!--/source-->

<!--source:api-specifications-->
Dummy hello world endpoint

<!--/source-->

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Foo<!--/source-->Example `Hello, World!` |

<!--source:api-specifications-->

### Deployments
<!--/source-->

`POST` `/deployments`

<!--source:api-specifications-->

#### Deploy Artifact
<!--/source-->

`deployArtifact`

<!--source:api-specifications-->

#### Deploy Artifact

Deploy Artifact deploys a product or configuration artifact_url to a specific environment using only environment token from Environment product to provide information about the environment which is the final target of the deployment.

##### Limitations on Deployment

- Deployment which handled by lambda worker supports up to 3 GB artifact size.
- Deployment retries deployment up to 5 times if Deployer receives service error or throttling error.
- Deployer will cancel deployment if lambda code storage hit %99 percent. The code storage percentage cache TTL is 10 minutes.

##### Legacy deployment

- By default, the Deploy uses the new deployment strategy via StepFunctions. If you want to use the legacy deployment strategy via CodeBuild, you can enable it by passing `legacy_deploy` as true in the request body.
- The legacy deployment strategy is deprecated and will be removed in the future.
- The legacy deployment strategy is slower than the new deployment strategy.

##### Force Deployment

Deployer skips product deployment based on the following conditions:

Show the rest
- The Last deployment should be successful.
- The last deployment commit SHA should match the current bundle commit SHA. This indicates there is no code change in the given bundle.

Note: This behavior does not apply to configuration bundles. Configuration bundle deployments will be executed on every attempt.

This behavior can be changed by forcing the Deployer to execute deployment with the following options:

1. Updating `service.yml`

```
deployment:
 force_deployment: true
```

1. Giving `force_deployment` parameter in the request body.

Note: Parameter in request body overrides `service.yml` configuration. The deployment process will report to the Health after deployment finished or failed. The following health metric parameters will be sent: product_identifier: Taken from product_identifier field in the frontend bundles. Support for other bundles coming soon. product_api_identifier: always `be5bed79-df72-4a56-b77c-5c12d4e21d8e` status: "SUCCEEDED" or "FAILED" The deployment accepts optional parameter for transaction ID. If not provided, the deployment will create the transaction for the deployment.. The deployment process will persist following data into collection: Deployment status, `Failed` or `Succeeded`. Start time and end time of deployment. Bundle type of the deployment. `Service`, `Chat`, `FrontEnd`, `Data`.

Example of the collection:

```
{
 "metadata": {
 "fuzzy_searchable": false,
 "version": 3,
 "validation": true,
 "serialise_to_graph": true
 },
 "data": {
 "bundles": [
 {
 "@type": "bundle",
 "@id": "bundle_id",
 "bundle_type": "Service",
 "base_path": "your-base-path",
 "has_product": "p_id"
 }
 ],
 "products": [
 {
 "@id": "p_id",
 "@type": "product",
 "name": "MyProductName"
 },
 {
 "@id": "p_id_2",
 "@type": "product",
 "name": "Deploy",
 "product_identifier": "229c0982-b5fe-4d4c-8f9e-80ad38f5d4b8",
 "has_product_api": "product_api_id"
 }
 ],
 "deployments": [
 {
 "deployment_status_type": "Succeeded",
 "@type": "deployment",
 "@id": "depl_id",
 "has_invocation": "inv_id",
 "has_bundle": "bundle_id",
 "start_time": "2024-05-16T05:41:07.868339-04:00",
 "end_time": "2024-05-16T05:41:07.868339-04:00"
 }
 ],
 "product_apis": [
 {
 "@type": "product_api",
 "@id": "product_api_id",
 "name": "Deployment",
 "product_api_identifier": "a1257a35-5261-4293-9747-2e958c56f53c"
 }
 ],
 "invocations": [
 {
 "@type": "invocation",
 "invocation_message": "my-deployment-id",
 "@id": "inv_id",
 "has_product_api": "product_api_id"
 }
 ]
 }
}
```

<!--/source-->

##### Request

<!--source:api-specifications-->
FullExampleMinimalExampleParallelDeploymentExample
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "bundle_id": "e00feb67-f6d7-46e4-95a-52375ece86ef",
 "transaction_id": "01HY0C4V3JS796NF9FXWDDNXT4",
 "artifacts_url": "https://example.com/artifact.zip",
 "environment_token": "rWiaN6NN6l0RPrrmM6he3QABhqCAAAAAAGBkJt205xbT9RPaH4kyB2JcGic4f-8vjZCIU7NZE8hVE2Trw6gqsDm0V7OMqST--jJUM3ri24BvyRYrI2EolmyWWKPNGlpVaA7",
 "callback_url": "https://example.com/call-me-back-please"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "artifacts_url": "https://example.com/artifact.zip",
 "environment_token": "rWiaN6NN6l0RPrrmM6he3QABhqCAAAAAAGBkJt205xbT9RPaH4kyB2JcGic4f-8vjZCIU7NZE8hVE2Trw6gqsDm0V7OMqST--jJUM3ri24BvyRYrI2EolmyWWKPNGlpVaA7"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "environment_token": "env_token",
 "artifacts_url": "https://example.com/artifact.zip",
 "callback_url": "https://example.com/call-me-back-please"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200 SuccessfulExample200 SuccessfulParallelDeploymentExample400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Deployment started.

```
{
 "deploy_id": "devops-deployer-dev:490f5d55-2ea4-47b5-81cb-38a54a01f2af",
 "bundle_id": "e00feb67-f6d7-46e4-95a-52375ece86ef",
 "transaction_id": "01HY0C4V3JS796NF9FXWDDNXT4"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Deployment started.

```
{
 "deploy_id": "948d0a4b-f228-4f88-b6be-b62627e1c2fd",
 "bundle_id": "1906999e-af6a-41eb-92a4-0f9545abd3b8",
 "transaction_id": "01HY0C4V3JS796NF9FXWDDNXT4"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Parameter validation error

```
{
 "artifacts_url": [
 "Missing data for required field."
 ],
 "environment_token": [
 "Missing data for required field."
 ]
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Environment API Key.<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
9 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string` | <!--source:api-specifications-->Valid transaction ID from the Persistence product.<!--/source--> |
| `bundle_id` | `string (uuid)` | <!--source:api-specifications-->Any UUID.<!--/source--> |
| `environment_token`required | `string` | <!--source:api-specifications-->Token from Environment product.<!--/source--> |
| `artifacts_url`required | `string (uri)` | <!--source:api-specifications-->Link to the artifacts zip file. Content of artifacts file described in Artifacts content section. Deployer will download artifacts from artifacts_url, and deploy them.<!--/source-->Example `https://example.com/artifact.zip` |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->(Optional) When deployment is done, POST to this API information about deployment. If a transient error is returned from callback deploy will retry 10 times to call callback using exponential back off algorithm. Transient error means either: a timeout, an FTP 5xx response code or an HTTP 5xx response code.<!--/source-->Example `https://example.com/call-me-back-please` |
| `log_level` | `string` | <!--source:api-specifications-->Log level, that is used in deployment process. Can be used with \"DEBUG\" value for Deploy product debugging.<!--/source-->`DEBUG``INFO`Example `INFO` |
| `force_deployment` | `boolean` | <!--source:api-specifications-->This allows Deployer to force execute deployment.<!--/source-->Example `true` |
| `legacy_deploy` | `boolean` | <!--source:api-specifications-->Use legacy deployment strategy via CodeBuild. This option is deprecated and will be removed in the future.<!--/source-->Example `false` |
| `configuration` | `object` | <!--source:api-specifications-->This option configures deployment and is only effective when legacy_deploy disabled.<!--/source--> |
| `limit_check_on_pre_deployment` | `string` | <!--source:api-specifications-->Enables AWS quota and limit check before deployment.<!--/source-->Example `true` |
| `parallel_module_deployment` | `string` | <!--source:api-specifications-->Allows configuring parallel or sequential module deployment. Sequential deployment is important when module deployment order matters. This option is valid only for legacy_deploy deployment disabled.<!--/source-->Example `true` |

##### Response `200``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
Deployment started.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `deploy_id` | `string` | <!--source:api-specifications-->ID of the deployment.<!--/source-->Example `devops-deployer-dev:490f5d55-2ea4-47b5-81cb-38a54a01f2af` |
| `bundle_id` | `string (uuid)` | <!--source:api-specifications-->Usually a hash of the commit but can be any UUID.<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->The transaction ID.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Parameter validation error
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `artifacts_url` | `string[]` | <!--source:api-specifications-->Artifact URL errors<!--/source--> |
| `environment_token` | `string[]` | <!--source:api-specifications-->Environment token errors<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Other responses

`422`

`GET` `/deployments/{bundle_id}`

<!--source:api-specifications-->

#### Retrieve Deployment Status
<!--/source-->

`retrieveDeploymentStatus`

<!--source:api-specifications-->
Retrieve Deployment Metadata retrieves metadata generated by the deployment.

- Metadata is available only for deployments that succeed (deploy_status==SUCCEEDED).
- The artifact_url key in the response body contains the URL to the artifact that was deployed. This URL only supports the GET method and is valid for one hour. A new request to this endpoint will provide a new artifact_url.
- The response to a GET request for artifact_url will contain headers describing the artifact metadata. Only header names that start with x-amz-meta-service are considered service metadata.

<!--/source-->

##### Response

<!--source:api-specifications-->
200 SuccessfulDeployment200 FailedDeployment200 ParallelDeployment
<!--/source-->

<!--source:api-specifications-->
application/json Copy 200 response

```
{
 "deploy_status": "SUCCEEDED",
 "metadata": {
 "target_url": "https://sandbox.api.staircaseapi.com/code-assessor/",
 "code": {
 "id": "4ad1c152-4990-45b4-a2ab-f0d31d1fc303",
 "timestamp": 1611753194.053118,
 "version": "1.1",
 "status": "SUCCEEDED",
 "commit_hash": "31e47b3e883cec9c46c435d57c58565e1f73b3a8",
 "issuer": "https://deploy.staircaseapi.com/code"
 },
 "builder": {
 "id": "f128507e-21c1-4dd8-b6bc-7bb0d220eeb8",
 "timestamp": 1611753314.9771907,
 "version": "1.1",
 "status": "SUCCEEDED",
 "issuer": "https://api.staircaseapi.com/infra-builder"
 },
 "deployer": {
 "id": "032e2794-7aa8-4e3a-912b-605f5c370913",
 "timestamp": 1611753374.9128177,
 "version": "1.1",
 "status": "SUCCEEDED",
 "issuer": "https://deploy.staircaseapi.com/infra-deployer/"
 }
 },
 "artifact_url": "https://deployer-dev-artifcatsbucket-1freahxorpmya.s3.amazonaws.com/build_artifacts/00c5f4ab-d3d4-4cd9-bc9d-eefe8b6b1c26/devops-deployer-dev/artifacts.zip?AWSAccessKeyId=<redacted>&Signature=<redacted>&Expires=1611832432",
 "logs": [
 "[Container] 2020/12/14 16:24:03 Waiting for agent ping\n",
 "[Container] 2020/12/14 16:24:05 Waiting for DOWNLOAD_SOURCE\n",
 "[Container] 2020/12/14 16:24:06 Phase is DOWNLOAD_SOURCE\n",
 "[Container] 2020/12/14 16:24:06 CODEBUILD_SRC_DIR=/codebuild/output/src405111012/src\n",
 "[Container] 2020/12/14 16:24:06 YAML location is /codebuild/readonly/buildspec.yml\n",
 "[Container] 2020/12/14 16:24:06 No commands found for phase name: install\n",
 "[Container] 2020/12/14 16:24:06 Processing environment variables\n",
 "[Container] 2020/12/14 16:24:06 Selecting 'python' runtime version '3.8' based on manual selections...\n",
 "[Container] 2020/12/14 16:24:06 Running command echo \"Installing Python version 3.8 ...\"\n",
 "Installing Python version 3.8 ...\n",
 "\n",
 "[Container] 2020/12/14 16:24:06 Running command pyenv global $PYTHON_38_VERSION\n",
 "\n",
 "[Container] 2020/12/14 16:24:07 Moving to directory /codebuild/output/src405111012/src\n",
 "[Container] 2020/12/14 16:24:07 Registering with agent\n",
 "[Container] 2020/12/14 16:24:07 Phases found in YAML: 2\n",
 "[Container] 2020/12/14 16:24:07 INSTALL: 0 commands\n",
 "[Container] 2020/12/14 16:24:07 BUILD: 6 commands\n",
 "[Container] 2020/12/14 16:24:07 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:24:07 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:24:07 Entering phase INSTALL\n",
 "[Container] 2020/12/14 16:24:07 Phase complete: INSTALL State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:24:07 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:24:07 Entering phase PRE_BUILD\n",
 "[Container] 2020/12/14 16:24:07 Phase complete: PRE_BUILD State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:24:07 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:24:07 Entering phase BUILD\n",
 "[Container] 2020/12/14 16:24:07 Running command curl -sS \"\"$HOST\"infra-deployer/deploy.py\" --output deploy.py\n",
 "\n",
 "[Container] 2020/12/14 16:24:10 Running command curl -sS $ARTIFACTS_URL --output artifacts.zip\n",
 "\n",
 "[Container] 2020/12/14 16:24:11 Running command unzip -qq artifacts.zip -d build_folder\n",
 "\n",
 "[Container] 2020/12/14 16:24:11 Running command printf \"$ACCESS_KEY\\n$SECRET_KEY\\nus-east-1\\njson\" > creds.txt\n",
 "\n",
 "[Container] 2020/12/14 16:24:11 Running command aws configure < creds.txt\n",
 "AWS Access Key ID [None]: AWS Secret Access Key [None]: Default region name [None]: Default output format [None]:\n",
 "[Container] 2020/12/14 16:24:16 Running command python3.8 deploy.py build_folder\n",
 "2020-12-14 16:24:17,684 Found credentials in shared credentials file: ~/.aws/credentials\n",
 "2020-12-14 16:24:18,007 Creating bucket 2b7d31ed-7ff3-4da8-9ad9-324f40bf41a0\n",
 "2020-12-14 16:24:18,323 Bucket created\n",
 "2020-12-14 16:24:18,324 Uploading artifacts\n",
 "2020-12-14 16:24:18,574 Artifacts uploaded\n",
 "2020-12-14 16:24:18,574 Deployment started\n",
 "2020-12-14 16:25:30,449 Deployed\n",
 "2020-12-14 16:25:30,449 Removing bucket 2b7d31ed-7ff3-4da8-9ad9-324f40bf41a0\n",
 "2020-12-14 16:25:31,128 Bucket removed\n",
 "\n",
 "[Container] 2020/12/14 16:25:31 Running command if [ \"$CALLBACK_URL\" != \"null\" ]; then\n",
 "\n if [ \"$CODEBUILD_BUILD_SUCCEEDING\" = \"1\" ]; then\n",
 "\n curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"SUCCEEDED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'\n",
 "\n else\n",
 "\n curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"FAILED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'\n",
 "\n fi\n",
 "fi\n",
 "",
 "\n % Total % Received % Xferd Average Speed Time Time Time Current\n",
 "\n Dload Upload Total Spent Left Speed\n",
 "\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 75 0 0 100 75 0 247 --:--:-- --:--:-- --:--:-- 246\n",
 "\n",
 "[Container] 2020/12/14 16:25:31 Phase complete: BUILD State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:25:31 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:25:31 Entering phase POST_BUILD\n",
 "[Container] 2020/12/14 16:25:31 Phase complete: POST_BUILD State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:25:31 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:25:31 Expanding base directory path: .\n",
 "[Container] 2020/12/14 16:25:31 Assembling file list\n",
 "[Container] 2020/12/14 16:25:31 Expanding .\n",
 "[Container] 2020/12/14 16:25:31 Expanding file paths for base directory .\n",
 "[Container] 2020/12/14 16:25:31 Assembling file list\n",
 "[Container] 2020/12/14 16:25:31 Expanding deploy_output.json\n",
 "[Container] 2020/12/14 16:25:31 Found 1 file(s)\n",
 "[Container] 2020/12/14 16:25:31 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:25:31 Phase context status code: Message:\n"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 200 response

```
{
 "deploy_status": "FAILED",
 "metadata": null,
 "artifact_url": null,
 "logs": [
 "[Container] 2020/12/14 16:55:13 Waiting for agent ping\n",
 "[Container] 2020/12/14 16:55:15 Waiting for DOWNLOAD_SOURCE\n",
 "[Container] 2020/12/14 16:55:16 Phase is DOWNLOAD_SOURCE\n",
 "[Container] 2020/12/14 16:55:16 CODEBUILD_SRC_DIR=/codebuild/output/src092437202/src\n",
 "[Container] 2020/12/14 16:55:16 YAML location is /codebuild/readonly/buildspec.yml\n",
 "[Container] 2020/12/14 16:55:16 No commands found for phase name: install\n",
 "[Container] 2020/12/14 16:55:16 Processing environment variables\n",
 "[Container] 2020/12/14 16:55:16 Selecting 'python' runtime version '3.8' based on manual selections...\n",
 "[Container] 2020/12/14 16:55:16 Running command echo \"Installing Python version 3.8 ...\"\n",
 "Installing Python version 3.8 ...\n",
 "\n",
 "[Container] 2020/12/14 16:55:16 Running command pyenv global $PYTHON_38_VERSION\n",
 "\n",
 "[Container] 2020/12/14 16:55:16 Moving to directory /codebuild/output/src092437202/src\n",
 "[Container] 2020/12/14 16:55:16 Registering with agent\n",
 "[Container] 2020/12/14 16:55:16 Phases found in YAML: 2\n",
 "[Container] 2020/12/14 16:55:16 INSTALL: 0 commands\n",
 "[Container] 2020/12/14 16:55:16 BUILD: 6 commands\n",
 "[Container] 2020/12/14 16:55:16 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:55:16 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:55:16 Entering phase INSTALL\n",
 "[Container] 2020/12/14 16:55:16 Phase complete: INSTALL State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:55:16 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:55:16 Entering phase PRE_BUILD\n",
 "[Container] 2020/12/14 16:55:16 Phase complete: PRE_BUILD State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:55:16 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:55:16 Entering phase BUILD\n",
 "[Container] 2020/12/14 16:55:16 Running command curl -sS \"\"$HOST\"infra-deployer/deploy.py\" --output deploy.py\n",
 "\n",
 "[Container] 2020/12/14 16:55:20 Running command curl -sS $ARTIFACTS_URL --output artifacts.zip\n",
 "\n",
 "[Container] 2020/12/14 16:55:20 Running command unzip -qq artifacts.zip -d build_folder\n",
 "[artifacts.zip]\n",
 "\n End-of-central-directory signature not found. Either this file is not\n",
 "\n a zipfile, or it constitutes one disk of a multi-part archive. In the\n",
 "\n latter case the central directory and zipfile comment will be found on\n",
 "\n the last disk(s) of this archive.\n",
 "unzip: cannot find zipfile directory in one of artifacts.zip or\n",
 "\n artifacts.zip.zip, and cannot find artifacts.zip.ZIP, period.\n",
 "\n",
 "[Container] 2020/12/14 16:55:20 Command did not exit successfully unzip -qq artifacts.zip -d build_folder exit status 9\n",
 "[Container] 2020/12/14 16:55:20 Running command if [ \"$CALLBACK_URL\" != \"null\" ]; then\n",
 "\n if [ \"$CODEBUILD_BUILD_SUCCEEDING\" = \"1\" ]; then\n",
 "\n curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"SUCCEEDED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'\n",
 "\n else\n",
 "\n curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"FAILED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'\n",
 "\n fi\n",
 "fi\n",
 "\n",
 "[Container] 2020/12/14 16:55:20 Phase complete: BUILD State: FAILED\n",
 "[Container] 2020/12/14 16:55:20 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: unzip -qq artifacts.zip -d build_folder. Reason: exit status 9\n",
 "[Container] 2020/12/14 16:55:20 Entering phase POST_BUILD\n",
 "[Container] 2020/12/14 16:55:20 Phase complete: POST_BUILD State: SUCCEEDED\n",
 "[Container] 2020/12/14 16:55:20 Phase context status code: Message:\n",
 "[Container] 2020/12/14 16:55:20 Expanding base directory path: .\n",
 "[Container] 2020/12/14 16:55:20 Assembling file list\n",
 "[Container] 2020/12/14 16:55:20 Expanding .\n",
 "[Container] 2020/12/14 16:55:20 Expanding file paths for base directory .\n",
 "[Container] 2020/12/14 16:55:20 Assembling file list\n",
 "[Container] 2020/12/14 16:55:20 Expanding deploy_output.json\n",
 "[Container] 2020/12/14 16:55:20 Skipping invalid file path deploy_output.json\n",
 "[Container] 2020/12/14 16:55:20 Phase complete: UPLOAD_ARTIFACTS State: FAILED\n",
 "[Container] 2020/12/14 16:55:20 Phase context status code: CLIENT_ERROR Message: no matching artifact paths found\n"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy 200 response

```
{
 "bundle_id": "225b1744-2b9f-4861-b8b5-55bf4dd0726f",
 "deploy_id": "fb27c142-5421-4f51-8a5d-bb5078e6e7c6",
 "metadata": {
 "assessor": {
 "id": "877c9b30-8179-4719-855b-2206984a34e2",
 "timestamp": 1653058579.240083,
 "version": "1.0.12",
 "issuer": "https://template.staircaseapi.com/code-assessor",
 "status": "SUCCEEDED",
 "applied_rules": 39,
 "version_hash": "635c7ac814f451e200f8ce55462a576600767300da6539cf77deaa056397c670"
 },
 "code": {
 "id": "f1321002-9f83-46a7-8eb5-ab8db6f5d197",
 "timestamp": 1653058526.3055882,
 "version": "1.1",
 "status": "SUCCEEDED",
 "commit_hash": "d8300821be61e603f549747dd0c44350069f1f9f",
 "issuer": "https://template.staircaseapi.com/code"
 },
 "builder": {
 "id": "d126a1d2-b222-4ab7-8880-e66737cbb79d",
 "timestamp": 1653058800.9849484,
 "version": "1.1",
 "status": "SUCCEEDED",
 "bundle_type": "SERVICE",
 "issuer": "https://template.staircaseapi.com/infra-builder"
 },
 "deployer": {
 "id": "fb27c142-5421-4f51-8a5d-bb5078e6e7c6",
 "timestamp": 1653059651.2567577,
 "version": "1.1",
 "status": "SUCCEEDED",
 "issuer": "https://template.staircaseapi.com/infra-deployer/"
 }
 },
 "deploy_status": "SUCCEEDED",
 "bundle_details": [
 {
 "created_at": "2022-05-20:15:14:14",
 "status": "SUCCEEDED",
 "finished_at": "2022-05-20:15:14:33",
 "stack_id": "arn:aws:cloudformation:us-east-1:111122222:stack/deployer-dev/4d607ab0-69f3-11eb-99cd-0ae749a35905",
 "cf_status": "UPDATE_COMPLETE",
 "bundle_id": "225b1744-2b9f-4861-b8b5-55bf4dd0726f"
 },
 {
 "created_at": "2022-05-20:15:13:53",
 "deploy_id": "fb27c142-5421-4f51-8a5d-bb5078e6e7c6",
 "status": "REQUEST_MADE",
 "stack_id": "root",
 "callback_url": "callback_url",
 "bundle_id": "225b1744-2b9f-4861-b8b5-55bf4dd0726f"
 }
 ]
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Environment API Key.<!--/source--> |
| `bundle_id` required | `string (uuid)` path | `e00feb67-f6d7-46e4-95a-52375ece86ef` | <!--source:api-specifications-->Usually a hash of the commit but can be any UUID.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->
<!--source:api-specifications-->
200 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `deploy_status` | `string` | <!--source:api-specifications-->Deploy status can be SUCCEEDED'|'FAILED'|'FAULT'|'TIMED_OUT'|'IN_PROGRESS'|'STOPPED.<!--/source-->`FAILED``FAULT``IN_PROGRESS``STOPPED``SUCCEEDED``TIMED_OUT` |
| `metadata` | `object` | <!--source:api-specifications-->Metadata<!--/source--> |
| `target_url` | `string (uri)` | <!--source:api-specifications-->Target URL<!--/source-->Example `https://sandbox.api.staircaseapi.com/code-assessor/` |
| `artifact_url` | `string (uri)` | <!--source:api-specifications-->URL of deployed artifact, with proper metadata in headers.<!--/source--> |
| `logs` | `string[]` | <!--source:api-specifications-->Logs of deployment.<!--/source--> |
| `bundle_details` | `object[]` | <!--source:api-specifications-->Bundle deployment details<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request could not be processed because of conflict in the current state of the resource
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Other responses

`400``422`

`GET` `/deployments/logs/{response_collection_id}`

<!--source:api-specifications-->

#### Retrieve Deployment Logs
<!--/source-->

`retrieveDeploymentLogs`

<!--source:api-specifications-->
Retrieve Deployment Logs retrieves logs and stack traces if an exception occurred during deployment. This endpoint is reachable with an API key and health key.

#### Limitations:

- Logs have 7 days TTL.

<!--/source-->

##### Response

<!--source:api-specifications-->
application/json Copy 200 response

```
[
 {
 "response_collection_id": "225b1744-2b9f-4861-b8b5-55bf4dd0726f",
 "product_api_identifier": "11225b1744-239f-4861-b8b5-55bf4dd072",
 "transaction_id": "fb27c142-5421-4f51-8a5d-bb5078e6e7c6",
 "stack_trace": "stack_trace_value",
 "created_at": "2022-12-01:07:23:07",
 "expire_at": 1670484187
 }
]
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-api-key` required | `string` header | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | <!--source:api-specifications-->Environment API Key.<!--/source--> |
| `response_collection_id` required | `string (uuid)` path | `e00feb67-f6d7-46e4-95a-52375ece86ef` | <!--source:api-specifications-->The value of response collection_id.<!--/source--> |
| `product_api_identifier` | `string` query | `11225b1744-239f-4861-b8b5-55bf4dd072` | <!--source:api-specifications-->Product API identifier<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
6 fields
<!--/source-->
<!--source:api-specifications-->
200 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `response_collection_id` | `string` | <!--source:api-specifications-->Response collection identifier.<!--/source--> |
| `product_api_identifier` | `string` | <!--source:api-specifications-->Product API identifier.<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Transaction identifier<!--/source--> |
| `stack_trace` | `string` | <!--source:api-specifications-->Execution stack trace<!--/source--> |
| `created_at` | `string` | <!--source:api-specifications-->Log creation date.<!--/source--> |
| `expire_at` | `number` | <!--source:api-specifications-->Log expiration specifier.<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Forbidden
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request could not be processed because of conflict in the current state of the resource
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

##### Other responses

`400``422`

<!--source:api-specifications-->

### Operations
<!--/source-->

`GET` `/deployments/{deployId}`

<!--source:api-specifications-->

#### Get deploy status
<!--/source-->

`Getdeploy`

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Description |
| --- | --- | --- |
| `deployId` required | `string` path | <!--source:api-specifications-->ID of deploy, looks like 5f0631cd1487f8000897e143<!--/source--> |

##### Other responses

`200`

`POST` `/deploymentStrategies/blue-green/execute`

<!--source:api-specifications-->

#### Redeploy
<!--/source-->

`Redeploy`

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "applicationName": "app",
 "oldDeployId": "5efb0e03b61e2500082c8292",
 "revisionLocation": "s3://staircase-poc/GreenDeploy_Linux.zip"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `applicationName`required | `string` | — |
| `oldDeployId`required | `string` | — |
| `revisionLocation`required | `string` | — |

##### Other responses

`200`

## Errors

`400``403``404``409``422`

## More in Shipping

- Previous product: Comply
- Next product: Health
