Interface CodeBuildActionProps

All Superinterfaces:
CommonActionProps, CommonAwsActionProps, software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CodeBuildActionProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:14.375Z") @Stability(Stable) public interface CodeBuildActionProps extends software.amazon.jsii.JsiiSerializable, CommonAwsActionProps
Construction properties of the CodeBuildAction 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();
 
  • Method Details

    • getInput

      @Stability(Stable) @NotNull Artifact getInput()
      The source to use as input for this action.
    • getProject

      @Stability(Stable) @NotNull IProject getProject()
      The action's Project.
    • getCheckSecretsInPlainTextEnvVariables

      @Stability(Stable) @Nullable default Boolean 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

      @Stability(Stable) @Nullable default Boolean 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 to true, this property is ignored.

      Default: false

    • getEnvironmentVariables

      @Stability(Stable) @Nullable default Map<String,BuildEnvironmentVariable> 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

      @Stability(Stable) @Nullable default Boolean getExecuteBatchBuild()
      Trigger a batch build.

      Enabling this will enable batch builds on the CodeBuild project.

      Default: false

    • getExtraInputs

      @Stability(Stable) @Nullable default List<Artifact> 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_invalid input: '<'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

      @Stability(Stable) @Nullable default List<Artifact> 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

      @Stability(Stable) @Nullable default CodeBuildActionType getType()
      The type of the action that determines its CodePipeline Category - Build, or Test.

      Default: CodeBuildActionType.BUILD

    • builder

      @Stability(Stable) static CodeBuildActionProps.Builder builder()
      Returns:
      a CodeBuildActionProps.Builder of CodeBuildActionProps