Call AWS CodeBuild with Step Functions
Step Functions can control certain AWS services directly from the Amazon States Language. For more information about working with AWS Step Functions and its integrations, see the following:
How the Optimized CodeBuild integration is different than the CodeBuild AWS SDK integration
-
The Run a Job (.sync) integration pattern is supported.
-
After you call
StopBuild
orStopBuildBatch
, 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 useBatchDeleteBuilds
orDeleteBuildBatch
during this period, the build or build batch may not be deleted. The optimized service integrations forBatchDeleteBuilds
andDeleteBuildBatch
include an internal retry to simplify the use case of deleting immediately after stopping.
The AWS Step Functions service integration with AWS 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.
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 | ✓ |
Note
Parameters in Step Functions are expressed in PascalCase
, even when the native service API
is camelCase
.
Supported CodeBuild APIs and syntax:
-
-
Supported parameters:
-
-
Supported parameters:
-
-
Supported parameters:
-
-
Supported parameters:
-
-
Supported parameters:
-
-
Supported parameters:
-
-
Supported parameters:
-
-
Supported parameters:
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 on how to configure IAM when using Step Functions with other AWS services, see IAM Policies for integrated services.