<!-- https://staircase.co/delivery/shipping/build -->
# Build

# Build

One build contract producing five bundle types, so a conversational agent, a front end, a vendor mapping and a service all move through the same pipeline.

Three files describe a unit of work: what it is, what it exposes, and how it deploys. From those, the build produces one of five bundle types — a service, a data bundle, a front end, a front-end configuration, or a chat bundle.

The bundle is the deployable unit everywhere downstream. Deploy takes it, Marketplace publishes it, and Environment installs it.

## How it works

Making a vendor mapping and a React front end the same kind of artifact is what lets one pipeline cover every unit of work. A vendor configuration is not code in the usual sense, but it versions, tests and deploys like everything else, and a separate release path for it would have been a second pipeline to keep correct.

## Operations

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

### Product
<!--/source-->

`POST` `/builds`

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

#### Build Product
<!--/source-->

`buildProduct`

<!--source:api-specifications-->
Build a deployable artifact for a product. The artifact must be provided via a URL. A callback will be sent to the URL specified in `callback_url` property.

#### `Build Hash`

The builder generates a unique hash value for each build. This value is available in build metadata which can be accessed using the product information endpoint. Also, this value passes by a Deployer if the AWS CloudFormation parameter definition exists in product `serverless.yml`. This parameter can be referenced as an environment variable as follows.

Show the rest Product serverless.yml:

```
provider: 
 environment: 
 BUILD_HASH: 
 Ref: BuildHash
...
resources: 
 Parameters: 
 BuildHash: 
 Type: String 
 Description: This info will be generated by the Builder and passed by Deployer. It contains a product build hash. 
 Default: "null"
```

#### `architecture`

By default, X86_64 architecture is used to build dependencies. Switch to ARM64 using the 64-bit ARM architecture for the AWS Graviton2 processor. It is possible to use only one architecture per build.

#### `node_version`

You can configure Node version to use to package your dependencies. Please note, that `node_version` = 14 works only with `architecture` = X86_64 and `compute_instance_size` = SMALL. `node_version` 18 and 20 works only with `architecture` = ARM64 and `compute_instance_size` = SMALL.

#### `compute_instance_size`

You can configure how much memory and disk space your build can take up. `compute_instance_size` is dependent on `architecture`. The following table describes mapping of allowed architectures to compute instance sizes.

| Architecture | Compute instance size | Memory | Disk space | vCPUs |
| --- | --- | --- | --- | --- |
| ARM64 | SMALL | 4 GB | 50 GB | 2 |
| ARM64 | LARGE | 16 GB | 50 GB | 8 |
| X86_64 | SMALL | 3 GB | 64 GB | 2 |

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "source_url": "https://code-manager-dev-root.s3.amazonaws.com/service-builder-api/2f867413-2f16-4c73-86ec-3086c0d4a33c/source.zip"
}
```

<!--/source-->

##### Response

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

<!--source:api-specifications-->
application/json Copy Build created

```
{
 "build_id": "13bd5b51-1a41-4510-9baa-d7f7e24c89a3"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

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

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

| Field | Type | Description |
| --- | --- | --- |
| `bundle_id` | `string (uuid)` | <!--source:api-specifications-->Usually a hash of the commit but can be any UUID.<!--/source--> |
| `source_url`required | `string (uri)` | <!--source:api-specifications-->Presigned URL to source code.<!--/source--> |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->Callback URL where are you waiting for build status<!--/source--> |
| `serverless_version` | `string` | <!--source:api-specifications-->Serverless version, that is used in build process to update serverless framework version.<!--/source-->`2.x``3.x`Example `3.x` |
| `log_level` | `string` | <!--source:api-specifications-->Log level, that is used in build process. Can be used with \"DEBUG\" value for Build product debugging.<!--/source-->`DEBUG``INFO`Example `INFO` |
| `architecture` | `string` | <!--source:api-specifications-->Architecture used to build your bundle dependencies.<!--/source-->`ARM64``X86_64`Example `X86_64` |
| `node_version` | `string` | <!--source:api-specifications-->Node version used to package your dependencies. 14 version works only with X86_64, small instance.<!--/source-->`12``14``18``20`Example `12` |
| `compute_instance_size` | `string` | <!--source:api-specifications-->Compute instance size defines the computational instance used during the build.<!--/source-->`LARGE``SMALL`Example `SMALL` |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Build created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build_id which can be used for tracking build status. Usually it is a UUID.<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

`GET` `/builds/{build_id}`

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

#### Retrieve Product Build Status
<!--/source-->

`getBuildStatus`

<!--source:api-specifications-->
Retrieve Service Build Status retrieves metadata generated by the build.

- Metadata is available only for builds that succeed (status==SUCCEEDED).
- The artifact_url key in the response body contains the URL to the artifact that was built. 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.
- Regardless of status response contains build execution logs

<!--/source-->

##### Response

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

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

```
{
 "build_id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "status": "SUCCEEDED",
 "metadata": {
 "service-assessor": {
 "id": "devops-code-assessor:e5dcb19e-b025-4255-a42f-7f501456703c",
 "timestamp": 1623399920.05132,
 "version": "1.0.0",
 "issuer": "https://build.staircaseapi.com/code-assessor",
 "status": "SUCCEEDED"
 },
 "service-code": {
 "id": "0da65dfd-9753-4bb4-8853-06e608979e73",
 "timestamp": 1623399796.747468,
 "version": "1.1",
 "status": "SUCCEEDED",
 "commit_hash": "c366156be0d8a39ce9a7bf85a5f5d5fc1a59ba4c",
 "issuer": "https://build.staircaseapi.com/code"
 },
 "service-builder": {
 "id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "timestamp": 1623400025.2152104,
 "version": "1.1",
 "status": "SUCCEEDED",
 "bundle_type": "SERVICE",
 "issuer": "https://build.staircaseapi.com/infra-builder"
 }
 },
 "artifacts_url": "https://builder-api-dev-codebuilddevbucket-kkwqngshvjap.s3.amazonaws.com/build-main/build/7ac245b7-2f93-485-8e8-abfdfd3b0a76/build.zip?AWSAccessKeyId=<redacted>&Signature=<redacted>&x-amz-security-token=<redacted>&Expires=1623405346",
 "logs": [
 "[Container] 2021/06/11 08:26:14 Waiting for agent ping\n",
 "[Container] 2021/06/11 08:26:17 Waiting for DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 Phase is DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 CODEBUILD_SRC_DIR=/codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 YAML location is /codebuild/readonly/buildspec.yml\n",
 "[Container] 2021/06/11 08:26:17 No commands found for phase name: post_build\n",
 "[Container] 2021/06/11 08:26:17 Processing environment variables\n",
 "[Container] 2021/06/11 08:26:17 Moving to directory /codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 Registering with agent\n",
 "[Container] 2021/06/11 08:26:17 Phases found in YAML: 2\n",
 "[Container] 2021/06/11 08:26:17 BUILD: 1 commands\n",
 "[Container] 2021/06/11 08:26:17 POST_BUILD: 0 commands\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase INSTALL\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: INSTALL State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase PRE_BUILD\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: PRE_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase BUILD\n",
 "[Container] 2021/06/11 08:26:17 Running command python3.8 /opt/build.py --env $STAIRCASE_ENV --source $SOURCE_URL --id $BUNDLE_ID --host $HOST --api_key $X_API_KEY --bundle_type $BUNDLE_TYPE\n",
 "npm WARN builder-api@1.0.0 No repository field.",
 "Serverless: Excluding development dependencies...",
 "Serverless: Injecting required Python packages to package...",
 "Serverless: Updated AWS resource tags..",
 "Health response code 403. Body b'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<Error><Code>AccessDenied</Code><Message>Invalid date (should be seconds since epoch): 1623403526code-health-checker/metric/7ac245b7-2f93-485-8e8-abfdfd3b0a76</Message><RequestId>P9ZDFS9GZNB3NYDJ</RequestId><HostId>ol1TYDYI/NgoC5uaxDld7Cii9sbSO4e+d+FK7G+FZJ2NwpZ40JgylLT60DiuSAwdQUQLbkNA1pc=</HostId></Error>'",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Entering phase POST_BUILD\n",
 "[Container] 2021/06/11 08:27:06 Running command if [ $CALLBACK_URL != \"null\" ]; then",
 " if [ \"$CODEBUILD_BUILD_SUCCEEDING\" = \"1\" ]; then",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"SUCCEEDED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " else\n",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"FAILED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " fi\n",
 "fi",
 "\n",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: POST_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Expanding base directory path: .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding .\n",
 "[Container] 2021/06/11 08:27:06 Expanding file paths for base directory .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding /output.json\n",
 "[Container] 2021/06/11 08:27:06 Found 1 file(s)\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `build_id` required | `string` path | `7ac245b7-2f93-485-8e8-abfdfd3b0a76` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Build status (IN_PROGRESS, FAILED, SUCCEEDED)<!--/source--> |
| `artifacts_url` | `string (url)` | <!--source:api-specifications-->Artifact URL if build was successfully completed<!--/source--> |
| `logs` | `string[]` | <!--source:api-specifications-->Build Logs which can be used for build problem investigation<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata generated by build<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message which contains information about requested entity<!--/source--> |

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

### Chat Bundle
<!--/source-->

`POST` `/chat`

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

#### Build Chat Bundle
<!--/source-->

`buildChatBundle`

<!--source:api-specifications-->
Build Frontend Bundle
<!--/source-->

<!--source:api-specifications-->
Build a deployable artifact for a chat bundle. The artifact must be provided via a URL. A callback will be sent to the URL specified in `callback_url` property.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "source_url": "https://code-manager-dev-root.s3.amazonaws.com/service-builder-api/2f867413-2f16-4c73-86ec-3086c0d4a33c/source.zip"
}
```

<!--/source-->

##### Response

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

<!--source:api-specifications-->
application/json Copy Build created

```
{
 "build_id": "13bd5b51-1a41-4510-9baa-d7f7e24c89a3"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

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

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

| Field | Type | Description |
| --- | --- | --- |
| `bundle_id` | `string (uuid)` | <!--source:api-specifications-->Usually a hash of the commit but can be any UUID.<!--/source--> |
| `source_url`required | `string (uri)` | <!--source:api-specifications-->Presigned URL to source code.<!--/source--> |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->Callback URL where are you waiting for build status<!--/source--> |
| `env_variables` | `string` | <!--source:api-specifications-->Env variables, that is used in build process.<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Build created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build_id which can be used for tracking build status. Usually it is a UUID.<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

`GET` `/chat/{build_id}`

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

#### Retrieve Chat Bundle Build Status
<!--/source-->

`getChatBundleStatus`

<!--source:api-specifications-->
Get build status for Chat bundles retrieves metadata generated by the build.

- Metadata is available only for builds that succeed (status==SUCCEEDED).
- The artifact_url key in the response body contains the URL to the artifact that was built. 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.
- Regardless of status response contains build execution logs

<!--/source-->

##### Response

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

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

```
{
 "build_id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "status": "SUCCEEDED",
 "metadata": {
 "service-assessor": {
 "id": "devops-code-assessor:e5dcb19e-b025-4255-a42f-7f501456703c",
 "timestamp": 1623399920.05132,
 "version": "1.0.0",
 "issuer": "https://build.staircaseapi.com/code-assessor",
 "status": "SUCCEEDED"
 },
 "service-code": {
 "id": "0da65dfd-9753-4bb4-8853-06e608979e73",
 "timestamp": 1623399796.747468,
 "version": "1.1",
 "status": "SUCCEEDED",
 "commit_hash": "c366156be0d8a39ce9a7bf85a5f5d5fc1a59ba4c",
 "issuer": "https://build.staircaseapi.com/code"
 },
 "service-builder": {
 "id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "timestamp": 1623400025.2152104,
 "version": "1.1",
 "status": "SUCCEEDED",
 "bundle_type": "SERVICE",
 "issuer": "https://build.staircaseapi.com/infra-builder"
 }
 },
 "artifacts_url": "https://builder-api-dev-codebuilddevbucket-kkwqngshvjap.s3.amazonaws.com/build-main/build/7ac245b7-2f93-485-8e8-abfdfd3b0a76/build.zip?AWSAccessKeyId=<redacted>&Signature=<redacted>&x-amz-security-token=<redacted>&Expires=1623405346",
 "logs": [
 "[Container] 2021/06/11 08:26:14 Waiting for agent ping\n",
 "[Container] 2021/06/11 08:26:17 Waiting for DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 Phase is DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 CODEBUILD_SRC_DIR=/codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 YAML location is /codebuild/readonly/buildspec.yml\n",
 "[Container] 2021/06/11 08:26:17 No commands found for phase name: post_build\n",
 "[Container] 2021/06/11 08:26:17 Processing environment variables\n",
 "[Container] 2021/06/11 08:26:17 Moving to directory /codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 Registering with agent\n",
 "[Container] 2021/06/11 08:26:17 Phases found in YAML: 2\n",
 "[Container] 2021/06/11 08:26:17 BUILD: 1 commands\n",
 "[Container] 2021/06/11 08:26:17 POST_BUILD: 0 commands\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase INSTALL\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: INSTALL State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase PRE_BUILD\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: PRE_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase BUILD\n",
 "[Container] 2021/06/11 08:26:17 Running command python3.8 /opt/build.py --env $STAIRCASE_ENV --source $SOURCE_URL --id $BUNDLE_ID --host $HOST --api_key $X_API_KEY --bundle_type $BUNDLE_TYPE\n",
 "npm WARN builder-api@1.0.0 No repository field.",
 "Serverless: Excluding development dependencies...",
 "Serverless: Injecting required Python packages to package...",
 "Serverless: Updated AWS resource tags..",
 "Health response code 403. Body b'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<Error><Code>AccessDenied</Code><Message>Invalid date (should be seconds since epoch): 1623403526code-health-checker/metric/7ac245b7-2f93-485-8e8-abfdfd3b0a76</Message><RequestId>P9ZDFS9GZNB3NYDJ</RequestId><HostId>ol1TYDYI/NgoC5uaxDld7Cii9sbSO4e+d+FK7G+FZJ2NwpZ40JgylLT60DiuSAwdQUQLbkNA1pc=</HostId></Error>'",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Entering phase POST_BUILD\n",
 "[Container] 2021/06/11 08:27:06 Running command if [ $CALLBACK_URL != \"null\" ]; then",
 " if [ \"$CODEBUILD_BUILD_SUCCEEDING\" = \"1\" ]; then",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"SUCCEEDED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " else\n",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"FAILED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " fi\n",
 "fi",
 "\n",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: POST_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Expanding base directory path: .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding .\n",
 "[Container] 2021/06/11 08:27:06 Expanding file paths for base directory .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding /output.json\n",
 "[Container] 2021/06/11 08:27:06 Found 1 file(s)\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `build_id` required | `string` path | `7ac245b7-2f93-485-8e8-abfdfd3b0a76` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Build status (IN_PROGRESS, FAILED, SUCCEEDED)<!--/source--> |
| `artifacts_url` | `string (url)` | <!--source:api-specifications-->Artifact URL if build was successfully completed<!--/source--> |
| `logs` | `string[]` | <!--source:api-specifications-->Build Logs which can be used for build problem investigation<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata generated by build<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message which contains information about requested entity<!--/source--> |

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

### Data Bundle
<!--/source-->

`POST` `/data`

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

#### Build Data Bundle
<!--/source-->

`buildDataBundle`

<!--source:api-specifications-->
Build a deployable artifact for a data bundle. The artifact must be provided via a URL. A callback will be sent to the URL specified in `callback_url` property. Build allows data bundle handlers to invoke IAM authorized endpoints by adding API execution policy.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "source_url": "https://code-manager-dev-root.s3.amazonaws.com/service-builder-api/2f867413-2f16-4c73-86ec-3086c0d4a33c/source.zip"
}
```

<!--/source-->

##### Response

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

<!--source:api-specifications-->
application/json Copy Build created

```
{
 "build_id": "13bd5b51-1a41-4510-9baa-d7f7e24c89a3"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

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

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

| Field | Type | Description |
| --- | --- | --- |
| `bundle_id` | `string (uuid)` | <!--source:api-specifications-->Usually a hash of the commit but can be any UUID.<!--/source--> |
| `source_url`required | `string (uri)` | <!--source:api-specifications-->Presigned URL to source code.<!--/source--> |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->Callback URL where are you waiting for build status<!--/source--> |
| `custom_parameters` | `string` | <!--source:api-specifications-->Custom parameters, that is used in deployment process. Passed parameter is available in data bundler handler event object with key name 'CUSTOM_PARAMETERS'. Custom parameters have 4 KB size limit.<!--/source--> |
| `serverless_version` | `string` | <!--source:api-specifications-->Serverless version, that is used in build process to update serverless framework version.<!--/source-->`2.x``3.x`Example `3.x` |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Build created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build_id which can be used for tracking build status. Usually it is a UUID.<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

`GET` `/data/{build_id}`

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

#### Retrieve Data Bundle Build Status
<!--/source-->

`getDataBundleStatus`

<!--source:api-specifications-->
Get build status for data bundles retrieves metadata generated by the build.

- Metadata is available only for builds that succeed (status==SUCCEEDED).
- The artifact_url key in the response body contains the URL to the artifact that was built. 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.
- Regardless of status response contains build execution logs

<!--/source-->

##### Response

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

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

```
{
 "build_id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "status": "SUCCEEDED",
 "metadata": {
 "service-assessor": {
 "id": "devops-code-assessor:e5dcb19e-b025-4255-a42f-7f501456703c",
 "timestamp": 1623399920.05132,
 "version": "1.0.0",
 "issuer": "https://build.staircaseapi.com/code-assessor",
 "status": "SUCCEEDED"
 },
 "service-code": {
 "id": "0da65dfd-9753-4bb4-8853-06e608979e73",
 "timestamp": 1623399796.747468,
 "version": "1.1",
 "status": "SUCCEEDED",
 "commit_hash": "c366156be0d8a39ce9a7bf85a5f5d5fc1a59ba4c",
 "issuer": "https://build.staircaseapi.com/code"
 },
 "service-builder": {
 "id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "timestamp": 1623400025.2152104,
 "version": "1.1",
 "status": "SUCCEEDED",
 "bundle_type": "SERVICE",
 "issuer": "https://build.staircaseapi.com/infra-builder"
 }
 },
 "artifacts_url": "https://builder-api-dev-codebuilddevbucket-kkwqngshvjap.s3.amazonaws.com/build-main/build/7ac245b7-2f93-485-8e8-abfdfd3b0a76/build.zip?AWSAccessKeyId=<redacted>&Signature=<redacted>&x-amz-security-token=<redacted>&Expires=1623405346",
 "logs": [
 "[Container] 2021/06/11 08:26:14 Waiting for agent ping\n",
 "[Container] 2021/06/11 08:26:17 Waiting for DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 Phase is DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 CODEBUILD_SRC_DIR=/codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 YAML location is /codebuild/readonly/buildspec.yml\n",
 "[Container] 2021/06/11 08:26:17 No commands found for phase name: post_build\n",
 "[Container] 2021/06/11 08:26:17 Processing environment variables\n",
 "[Container] 2021/06/11 08:26:17 Moving to directory /codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 Registering with agent\n",
 "[Container] 2021/06/11 08:26:17 Phases found in YAML: 2\n",
 "[Container] 2021/06/11 08:26:17 BUILD: 1 commands\n",
 "[Container] 2021/06/11 08:26:17 POST_BUILD: 0 commands\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase INSTALL\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: INSTALL State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase PRE_BUILD\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: PRE_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase BUILD\n",
 "[Container] 2021/06/11 08:26:17 Running command python3.8 /opt/build.py --env $STAIRCASE_ENV --source $SOURCE_URL --id $BUNDLE_ID --host $HOST --api_key $X_API_KEY --bundle_type $BUNDLE_TYPE\n",
 "npm WARN builder-api@1.0.0 No repository field.",
 "Serverless: Excluding development dependencies...",
 "Serverless: Injecting required Python packages to package...",
 "Serverless: Updated AWS resource tags..",
 "Health response code 403. Body b'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<Error><Code>AccessDenied</Code><Message>Invalid date (should be seconds since epoch): 1623403526code-health-checker/metric/7ac245b7-2f93-485-8e8-abfdfd3b0a76</Message><RequestId>P9ZDFS9GZNB3NYDJ</RequestId><HostId>ol1TYDYI/NgoC5uaxDld7Cii9sbSO4e+d+FK7G+FZJ2NwpZ40JgylLT60DiuSAwdQUQLbkNA1pc=</HostId></Error>'",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Entering phase POST_BUILD\n",
 "[Container] 2021/06/11 08:27:06 Running command if [ $CALLBACK_URL != \"null\" ]; then",
 " if [ \"$CODEBUILD_BUILD_SUCCEEDING\" = \"1\" ]; then",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"SUCCEEDED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " else\n",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"FAILED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " fi\n",
 "fi",
 "\n",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: POST_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Expanding base directory path: .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding .\n",
 "[Container] 2021/06/11 08:27:06 Expanding file paths for base directory .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding /output.json\n",
 "[Container] 2021/06/11 08:27:06 Found 1 file(s)\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `build_id` required | `string` path | `7ac245b7-2f93-485-8e8-abfdfd3b0a76` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Build status (IN_PROGRESS, FAILED, SUCCEEDED)<!--/source--> |
| `artifacts_url` | `string (url)` | <!--source:api-specifications-->Artifact URL if build was successfully completed<!--/source--> |
| `logs` | `string[]` | <!--source:api-specifications-->Build Logs which can be used for build problem investigation<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata generated by build<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message which contains information about requested entity<!--/source--> |

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

### Frontend Bundle
<!--/source-->

`POST` `/frontend`

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

#### Build Frontend Bundle
<!--/source-->

`buildFrontendBundle`

<!--source:api-specifications-->
Build a deployable artifact for a frontend bundle. The artifact must be provided via a URL. A callback will be sent to the URL specified in `callback_url` property.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "source_url": "https://code-manager-dev-root.s3.amazonaws.com/service-builder-api/2f867413-2f16-4c73-86ec-3086c0d4a33c/source.zip"
}
```

<!--/source-->

##### Response

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

<!--source:api-specifications-->
application/json Copy Build created

```
{
 "build_id": "13bd5b51-1a41-4510-9baa-d7f7e24c89a3"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

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

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

| Field | Type | Description |
| --- | --- | --- |
| `bundle_id` | `string (uuid)` | <!--source:api-specifications-->Usually a hash of the commit but can be any UUID.<!--/source--> |
| `source_url`required | `string (uri)` | <!--source:api-specifications-->Presigned URL to source code.<!--/source--> |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->Callback URL where are you waiting for build status<!--/source--> |
| `env_variables` | `string` | <!--source:api-specifications-->Env variables, that is used in build process.<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Build created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build_id which can be used for tracking build status. Usually it is a UUID.<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

`GET` `/frontend/{build_id}`

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

#### Retrieve Frontend Bundle Build Status
<!--/source-->

`getFrontendBundleStatus`

<!--source:api-specifications-->
Get build status for fronend bundles retrieves metadata generated by the build.

- Metadata is available only for builds that succeed (status==SUCCEEDED).
- The artifact_url key in the response body contains the URL to the artifact that was built. 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.
- Regardless of status response contains build execution logs

<!--/source-->

##### Response

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

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

```
{
 "build_id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "status": "SUCCEEDED",
 "metadata": {
 "service-assessor": {
 "id": "devops-code-assessor:e5dcb19e-b025-4255-a42f-7f501456703c",
 "timestamp": 1623399920.05132,
 "version": "1.0.0",
 "issuer": "https://build.staircaseapi.com/code-assessor",
 "status": "SUCCEEDED"
 },
 "service-code": {
 "id": "0da65dfd-9753-4bb4-8853-06e608979e73",
 "timestamp": 1623399796.747468,
 "version": "1.1",
 "status": "SUCCEEDED",
 "commit_hash": "c366156be0d8a39ce9a7bf85a5f5d5fc1a59ba4c",
 "issuer": "https://build.staircaseapi.com/code"
 },
 "service-builder": {
 "id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "timestamp": 1623400025.2152104,
 "version": "1.1",
 "status": "SUCCEEDED",
 "bundle_type": "SERVICE",
 "issuer": "https://build.staircaseapi.com/infra-builder"
 }
 },
 "artifacts_url": "https://builder-api-dev-codebuilddevbucket-kkwqngshvjap.s3.amazonaws.com/build-main/build/7ac245b7-2f93-485-8e8-abfdfd3b0a76/build.zip?AWSAccessKeyId=<redacted>&Signature=<redacted>&x-amz-security-token=<redacted>&Expires=1623405346",
 "logs": [
 "[Container] 2021/06/11 08:26:14 Waiting for agent ping\n",
 "[Container] 2021/06/11 08:26:17 Waiting for DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 Phase is DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 CODEBUILD_SRC_DIR=/codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 YAML location is /codebuild/readonly/buildspec.yml\n",
 "[Container] 2021/06/11 08:26:17 No commands found for phase name: post_build\n",
 "[Container] 2021/06/11 08:26:17 Processing environment variables\n",
 "[Container] 2021/06/11 08:26:17 Moving to directory /codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 Registering with agent\n",
 "[Container] 2021/06/11 08:26:17 Phases found in YAML: 2\n",
 "[Container] 2021/06/11 08:26:17 BUILD: 1 commands\n",
 "[Container] 2021/06/11 08:26:17 POST_BUILD: 0 commands\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase INSTALL\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: INSTALL State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase PRE_BUILD\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: PRE_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase BUILD\n",
 "[Container] 2021/06/11 08:26:17 Running command python3.8 /opt/build.py --env $STAIRCASE_ENV --source $SOURCE_URL --id $BUNDLE_ID --host $HOST --api_key $X_API_KEY --bundle_type $BUNDLE_TYPE\n",
 "npm WARN builder-api@1.0.0 No repository field.",
 "Serverless: Excluding development dependencies...",
 "Serverless: Injecting required Python packages to package...",
 "Serverless: Updated AWS resource tags..",
 "Health response code 403. Body b'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<Error><Code>AccessDenied</Code><Message>Invalid date (should be seconds since epoch): 1623403526code-health-checker/metric/7ac245b7-2f93-485-8e8-abfdfd3b0a76</Message><RequestId>P9ZDFS9GZNB3NYDJ</RequestId><HostId>ol1TYDYI/NgoC5uaxDld7Cii9sbSO4e+d+FK7G+FZJ2NwpZ40JgylLT60DiuSAwdQUQLbkNA1pc=</HostId></Error>'",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Entering phase POST_BUILD\n",
 "[Container] 2021/06/11 08:27:06 Running command if [ $CALLBACK_URL != \"null\" ]; then",
 " if [ \"$CODEBUILD_BUILD_SUCCEEDING\" = \"1\" ]; then",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"SUCCEEDED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " else\n",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"FAILED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " fi\n",
 "fi",
 "\n",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: POST_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Expanding base directory path: .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding .\n",
 "[Container] 2021/06/11 08:27:06 Expanding file paths for base directory .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding /output.json\n",
 "[Container] 2021/06/11 08:27:06 Found 1 file(s)\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `build_id` required | `string` path | `7ac245b7-2f93-485-8e8-abfdfd3b0a76` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Build status (IN_PROGRESS, FAILED, SUCCEEDED)<!--/source--> |
| `artifacts_url` | `string (url)` | <!--source:api-specifications-->Artifact URL if build was successfully completed<!--/source--> |
| `logs` | `string[]` | <!--source:api-specifications-->Build Logs which can be used for build problem investigation<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata generated by build<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message which contains information about requested entity<!--/source--> |

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

### Frontend Config Bundle
<!--/source-->

`POST` `/frontend-config`

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

#### Build Frontend Config Bundle
<!--/source-->

`buildFrontendConfigBundle`

<!--source:api-specifications-->
Build a deployable artifact for a frontend config bundle. The artifact must be provided via a URL. A callback will be sent to the URL specified in `callback_url` property.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "source_url": "https://code-manager-dev-root.s3.amazonaws.com/service-builder-api/2f867413-2f16-4c73-86ec-3086c0d4a33c/source.zip"
}
```

<!--/source-->

##### Response

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

<!--source:api-specifications-->
application/json Copy Build created

```
{
 "build_id": "13bd5b51-1a41-4510-9baa-d7f7e24c89a3"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

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

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

| Field | Type | Description |
| --- | --- | --- |
| `bundle_id` | `string (uuid)` | <!--source:api-specifications-->Usually a hash of the commit but can be any UUID.<!--/source--> |
| `source_url`required | `string (uri)` | <!--source:api-specifications-->Presigned URL to source code.<!--/source--> |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->Callback URL where are you waiting for build status<!--/source--> |
| `env_variables` | `string` | <!--source:api-specifications-->Env variables, that is used in build process.<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Build created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build_id which can be used for tracking build status. Usually it is a UUID.<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

`GET` `/frontend-config/{build_id}`

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

#### Retrieve Frontend Config Bundle Build Status
<!--/source-->

`getFrontendConfigBundleStatus`

<!--source:api-specifications-->
Get build status for Frontend Config bundles retrieves metadata generated by the build.

- Metadata is available only for builds that succeed (status==SUCCEEDED).
- The artifact_url key in the response body contains the URL to the artifact that was built. 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.
- Regardless of status response contains build execution logs

<!--/source-->

##### Response

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

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

```
{
 "build_id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "status": "SUCCEEDED",
 "metadata": {
 "service-assessor": {
 "id": "devops-code-assessor:e5dcb19e-b025-4255-a42f-7f501456703c",
 "timestamp": 1623399920.05132,
 "version": "1.0.0",
 "issuer": "https://build.staircaseapi.com/code-assessor",
 "status": "SUCCEEDED"
 },
 "service-code": {
 "id": "0da65dfd-9753-4bb4-8853-06e608979e73",
 "timestamp": 1623399796.747468,
 "version": "1.1",
 "status": "SUCCEEDED",
 "commit_hash": "c366156be0d8a39ce9a7bf85a5f5d5fc1a59ba4c",
 "issuer": "https://build.staircaseapi.com/code"
 },
 "service-builder": {
 "id": "7ac245b7-2f93-485-8e8-abfdfd3b0a76",
 "timestamp": 1623400025.2152104,
 "version": "1.1",
 "status": "SUCCEEDED",
 "bundle_type": "SERVICE",
 "issuer": "https://build.staircaseapi.com/infra-builder"
 }
 },
 "artifacts_url": "https://builder-api-dev-codebuilddevbucket-kkwqngshvjap.s3.amazonaws.com/build-main/build/7ac245b7-2f93-485-8e8-abfdfd3b0a76/build.zip?AWSAccessKeyId=<redacted>&Signature=<redacted>&x-amz-security-token=<redacted>&Expires=1623405346",
 "logs": [
 "[Container] 2021/06/11 08:26:14 Waiting for agent ping\n",
 "[Container] 2021/06/11 08:26:17 Waiting for DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 Phase is DOWNLOAD_SOURCE\n",
 "[Container] 2021/06/11 08:26:17 CODEBUILD_SRC_DIR=/codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 YAML location is /codebuild/readonly/buildspec.yml\n",
 "[Container] 2021/06/11 08:26:17 No commands found for phase name: post_build\n",
 "[Container] 2021/06/11 08:26:17 Processing environment variables\n",
 "[Container] 2021/06/11 08:26:17 Moving to directory /codebuild/output/src212027353/src\n",
 "[Container] 2021/06/11 08:26:17 Registering with agent\n",
 "[Container] 2021/06/11 08:26:17 Phases found in YAML: 2\n",
 "[Container] 2021/06/11 08:26:17 BUILD: 1 commands\n",
 "[Container] 2021/06/11 08:26:17 POST_BUILD: 0 commands\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase INSTALL\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: INSTALL State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase PRE_BUILD\n",
 "[Container] 2021/06/11 08:26:17 Phase complete: PRE_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:26:17 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:26:17 Entering phase BUILD\n",
 "[Container] 2021/06/11 08:26:17 Running command python3.8 /opt/build.py --env $STAIRCASE_ENV --source $SOURCE_URL --id $BUNDLE_ID --host $HOST --api_key $X_API_KEY --bundle_type $BUNDLE_TYPE\n",
 "npm WARN builder-api@1.0.0 No repository field.",
 "Serverless: Excluding development dependencies...",
 "Serverless: Injecting required Python packages to package...",
 "Serverless: Updated AWS resource tags..",
 "Health response code 403. Body b'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<Error><Code>AccessDenied</Code><Message>Invalid date (should be seconds since epoch): 1623403526code-health-checker/metric/7ac245b7-2f93-485-8e8-abfdfd3b0a76</Message><RequestId>P9ZDFS9GZNB3NYDJ</RequestId><HostId>ol1TYDYI/NgoC5uaxDld7Cii9sbSO4e+d+FK7G+FZJ2NwpZ40JgylLT60DiuSAwdQUQLbkNA1pc=</HostId></Error>'",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Entering phase POST_BUILD\n",
 "[Container] 2021/06/11 08:27:06 Running command if [ $CALLBACK_URL != \"null\" ]; then",
 " if [ \"$CODEBUILD_BUILD_SUCCEEDING\" = \"1\" ]; then",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"SUCCEEDED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " else\n",
 " curl --request POST $CALLBACK_URL --header 'Content-Type: application/json' --data '{\"status\": \"FAILED\",\"bundle_id\": \"'$BUNDLE_ID'\"}'",
 " fi\n",
 "fi",
 "\n",
 "\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: POST_BUILD State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n",
 "[Container] 2021/06/11 08:27:06 Expanding base directory path: .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding .\n",
 "[Container] 2021/06/11 08:27:06 Expanding file paths for base directory .\n",
 "[Container] 2021/06/11 08:27:06 Assembling file list\n",
 "[Container] 2021/06/11 08:27:06 Expanding /output.json\n",
 "[Container] 2021/06/11 08:27:06 Found 1 file(s)\n",
 "[Container] 2021/06/11 08:27:06 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED\n",
 "[Container] 2021/06/11 08:27:06 Phase context status code: Message: \n"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Parameters

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

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `build_id` required | `string` path | `7ac245b7-2f93-485-8e8-abfdfd3b0a76` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `build_id` | `string (uuid)` | <!--source:api-specifications-->Unique build ID which was returned when build was started<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Build status (IN_PROGRESS, FAILED, SUCCEEDED)<!--/source--> |
| `artifacts_url` | `string (url)` | <!--source:api-specifications-->Artifact URL if build was successfully completed<!--/source--> |
| `logs` | `string[]` | <!--source:api-specifications-->Build Logs which can be used for build problem investigation<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata generated by build<!--/source--> |

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

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Error message in string or object format<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message in string format<!--/source--> |
| `url` | `string (url)` | <!--source:api-specifications-->URL with link to page with information how this issue can be resolved<!--/source--> |

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

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

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message which contains information about requested entity<!--/source--> |

## Errors

`400``403``404`

## More in Shipping

- Previous product: Assess
- Next product: Code
