Manage Amazon CodeBuild builds with Step Functions - Amazon Step Functions
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Manage Amazon CodeBuild builds with Step Functions

You can integrate Step Functions with Amazon CodeBuild to start, stop, and manage builds. This page lists the supported CodeBuild APIs you can use with Step Functions.

Step Functions can control certain Amazon services directly from Using Amazon States Language to define Step Functions workflows (ASL). To learn more, see Integrating other services and Passing parameters to a service API in Step Functions.

The Amazon Step Functions service integration with Amazon CodeBuild enables you to use Step Functions to trigger, stop, and manage builds, and to share build reports. Using Step Functions, you can design and run continuous integration pipelines for validating your software changes for applications.

How the Optimized CodeBuild integration is different than the CodeBuild Amazon SDK integration
  • The Run a Job (.sync) integration pattern is supported.

  • After you call StopBuild or StopBuildBatch, the build or build batch is not immediately deletable until some internal work is completed within CodeBuild to finalize the state of the build or builds. If you attempt to use BatchDeleteBuilds or DeleteBuildBatch during this period, the build or build batch may not be deleted. The optimized service integrations for BatchDeleteBuilds and DeleteBuildBatch include an internal retry to simplify the use case of deleting immediately after stopping.

Not all APIs support all integration patterns, as shown in the following table.

API Request Response Run a Job (.sync)
StartBuild
StopBuild
BatchDeleteBuilds
BatchGetReports
StartBuildBatch
StopBuildBatch
RetryBuildBatch
DeleteBuildBatch
Parameters in Step Functions are expressed in PascalCase

Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn.

Supported CodeBuild APIs and syntax:

Note

You can use the JSONPath recursive descent (..) operator for BatchDeleteBuilds. This returns an array, and enables you to turn the Arn field from StartBuild into a plural Ids parameter, as shown in the following example.

"BatchDeleteBuilds": { "Type": "Task", "Resource": "arn:aws:states:::codebuild:batchDeleteBuilds", "Parameters": { "Ids.$": "$.Build..Arn" }, "Next": "MyNextState" },

For information about how to configure IAM permissions when using Step Functions with other Amazon services, see How Step Functions generates IAM policies for integrated services.