Interface CodeBuildActionProps
- All Superinterfaces:
CommonActionProps
,CommonAwsActionProps
,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CodeBuildActionProps.Jsii$Proxy
CodeBuild build CodePipeline action
.
Example:
// Create a Cloudfront Web Distribution import software.amazon.awscdk.services.cloudfront.*; Distribution distribution; // Create the build project that will invalidate the cache PipelineProject invalidateBuildProject = PipelineProject.Builder.create(this, "InvalidateProject") .buildSpec(BuildSpec.fromObject(Map.of( "version", "0.2", "phases", Map.of( "build", Map.of( "commands", List.of("aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths \"/*\"")))))) .environmentVariables(Map.of( "CLOUDFRONT_ID", BuildEnvironmentVariable.builder().value(distribution.getDistributionId()).build())) .build(); // Add Cloudfront invalidation permissions to the project String distributionArn = String.format("arn:aws:cloudfront::%s:distribution/%s", this.account, distribution.getDistributionId()); invalidateBuildProject.addToRolePolicy(PolicyStatement.Builder.create() .resources(List.of(distributionArn)) .actions(List.of("cloudfront:CreateInvalidation")) .build()); // Create the pipeline (here only the S3 deploy and Invalidate cache build) Bucket deployBucket = new Bucket(this, "DeployBucket"); Artifact deployInput = new Artifact(); Pipeline.Builder.create(this, "Pipeline") .stages(List.of(StageProps.builder() .stageName("Deploy") .actions(List.of( S3DeployAction.Builder.create() .actionName("S3Deploy") .bucket(deployBucket) .input(deployInput) .runOrder(1) .build(), CodeBuildAction.Builder.create() .actionName("InvalidateCache") .project(invalidateBuildProject) .input(deployInput) .runOrder(2) .build())) .build())) .build();
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A builder forCodeBuildActionProps
static final class
An implementation forCodeBuildActionProps
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodeBuildActionProps.Builder
builder()
default Boolean
Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT.default Boolean
Combine the build artifacts for a batch builds.default Map<String,
BuildEnvironmentVariable> The environment variables to pass to the CodeBuild project when this action executes.default Boolean
Trigger a batch build.The list of additional input Artifacts for this action.getInput()
The source to use as input for this action.The list of output Artifacts for this action.The action's Project.default CodeBuildActionType
getType()
The type of the action that determines its CodePipeline Category - Build, or Test.Methods inherited from interface software.amazon.awscdk.services.codepipeline.CommonActionProps
getActionName, getRunOrder, getVariablesNamespace
Methods inherited from interface software.amazon.awscdk.services.codepipeline.CommonAwsActionProps
getRole
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getInput
The source to use as input for this action. -
getProject
The action's Project. -
getCheckSecretsInPlainTextEnvVariables
Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT. Since using a secret for the value of that kind of variable would result in it being displayed in plain text in the AWS Console, the construct will throw an exception if it detects a secret was passed there. Pass this property as false if you want to skip this validation, and keep using a secret in a plain text environment variable.Default: true
-
getCombineBatchBuildArtifacts
Combine the build artifacts for a batch builds.Enabling this will combine the build artifacts into the same location for batch builds. If
executeBatchBuild
is not set totrue
, this property is ignored.Default: false
-
getEnvironmentVariables
The environment variables to pass to the CodeBuild project when this action executes.If a variable with the same name was set both on the project level, and here, this value will take precedence.
Default: - No additional environment variables are specified.
-
getExecuteBatchBuild
Trigger a batch build.Enabling this will enable batch builds on the CodeBuild project.
Default: false
-
getExtraInputs
The list of additional input Artifacts for this action.The directories the additional inputs will be available at are available during the project's build in the CODEBUILD_SRC_DIR_<artifact-name> environment variables. The project's build always starts in the directory with the primary input artifact checked out, the one pointed to by the
input
property. For more information, see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html . -
getOutputs
The list of output Artifacts for this action.Note: if you specify more than one output Artifact here, you cannot use the primary 'artifacts' section of the buildspec; you have to use the 'secondary-artifacts' section instead. See https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html for details.
Default: the action will not have any outputs
-
getType
The type of the action that determines its CodePipeline Category - Build, or Test.Default: CodeBuildActionType.BUILD
-
builder
- Returns:
- a
CodeBuildActionProps.Builder
ofCodeBuildActionProps
-