Class CodeBuildStep.Builder

java.lang.Object
software.amazon.awscdk.pipelines.CodeBuildStep.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<CodeBuildStep>
Enclosing class:
CodeBuildStep

@Stability(Stable) public static final class CodeBuildStep.Builder extends Object implements software.amazon.jsii.Builder<CodeBuildStep>
A fluent builder for CodeBuildStep.
  • Method Details

    • create

      @Stability(Stable) public static CodeBuildStep.Builder create(String id)
      Parameters:
      id - This parameter is required.
      Returns:
      a new instance of CodeBuildStep.Builder.
    • commands

      @Stability(Stable) public CodeBuildStep.Builder commands(List<String> commands)
      Commands to run.

      Parameters:
      commands - Commands to run. This parameter is required.
      Returns:
      this
    • additionalInputs

      @Stability(Stable) public CodeBuildStep.Builder additionalInputs(Map<String,? extends IFileSetProducer> additionalInputs)
      Additional FileSets to put in other directories.

      Specifies a mapping from directory name to FileSets. During the script execution, the FileSets will be available in the directories indicated.

      The directory names may be relative. For example, you can put the main input and an additional input side-by-side with the following configuration:

       ShellStep script = ShellStep.Builder.create("MainScript")
               .commands(List.of("npm ci", "npm run build", "npx cdk synth"))
               .input(CodePipelineSource.gitHub("org/source1", "main"))
               .additionalInputs(Map.of(
                       "../siblingdir", CodePipelineSource.gitHub("org/source2", "main")))
               .build();
       

      Default: - No additional inputs

      Parameters:
      additionalInputs - Additional FileSets to put in other directories. This parameter is required.
      Returns:
      this
    • env

      @Stability(Stable) public CodeBuildStep.Builder env(Map<String,String> env)
      Environment variables to set.

      Default: - No environment variables

      Parameters:
      env - Environment variables to set. This parameter is required.
      Returns:
      this
    • envFromCfnOutputs

      @Stability(Stable) public CodeBuildStep.Builder envFromCfnOutputs(Map<String,? extends CfnOutput> envFromCfnOutputs)
      Set environment variables based on Stack Outputs.

      ShellSteps following stack or stage deployments may access the CfnOutputs of those stacks to get access to --for example--automatically generated resource names or endpoint URLs.

      Default: - No environment variables created from stack outputs

      Parameters:
      envFromCfnOutputs - Set environment variables based on Stack Outputs. This parameter is required.
      Returns:
      this
    • input

      @Stability(Stable) public CodeBuildStep.Builder input(IFileSetProducer input)
      FileSet to run these scripts on.

      The files in the FileSet will be placed in the working directory when the script is executed. Use additionalInputs to download file sets to other directories as well.

      Default: - No input specified

      Parameters:
      input - FileSet to run these scripts on. This parameter is required.
      Returns:
      this
    • installCommands

      @Stability(Stable) public CodeBuildStep.Builder installCommands(List<String> installCommands)
      Installation commands to run before the regular commands.

      For deployment engines that support it, install commands will be classified differently in the job history from the regular commands.

      Default: - No installation commands

      Parameters:
      installCommands - Installation commands to run before the regular commands. This parameter is required.
      Returns:
      this
    • primaryOutputDirectory

      @Stability(Stable) public CodeBuildStep.Builder primaryOutputDirectory(String primaryOutputDirectory)
      The directory that will contain the primary output fileset.

      After running the script, the contents of the given directory will be treated as the primary output of this Step.

      Default: - No primary output

      Parameters:
      primaryOutputDirectory - The directory that will contain the primary output fileset. This parameter is required.
      Returns:
      this
    • actionRole

      @Stability(Stable) public CodeBuildStep.Builder actionRole(IRole actionRole)
      Custom execution role to be used for the Code Build Action.

      Default: - A role is automatically created

      Parameters:
      actionRole - Custom execution role to be used for the Code Build Action. This parameter is required.
      Returns:
      this
    • buildEnvironment

      @Stability(Stable) public CodeBuildStep.Builder buildEnvironment(BuildEnvironment buildEnvironment)
      Changes to environment.

      This environment will be combined with the pipeline's default environment.

      Default: - Use the pipeline's default build environment

      Parameters:
      buildEnvironment - Changes to environment. This parameter is required.
      Returns:
      this
    • partialBuildSpec

      @Stability(Stable) public CodeBuildStep.Builder partialBuildSpec(BuildSpec partialBuildSpec)
      Additional configuration that can only be configured via BuildSpec.

      You should not use this to specify output artifacts; those should be supplied via the other properties of this class, otherwise CDK Pipelines won't be able to inspect the artifacts.

      Set the commands to an empty array if you want to fully specify the BuildSpec using this field.

      The BuildSpec must be available inline--it cannot reference a file on disk.

      Default: - BuildSpec completely derived from other properties

      Parameters:
      partialBuildSpec - Additional configuration that can only be configured via BuildSpec. This parameter is required.
      Returns:
      this
    • projectName

      @Stability(Stable) public CodeBuildStep.Builder projectName(String projectName)
      Name for the generated CodeBuild project.

      Default: - Automatically generated

      Parameters:
      projectName - Name for the generated CodeBuild project. This parameter is required.
      Returns:
      this
    • role

      @Stability(Stable) public CodeBuildStep.Builder role(IRole role)
      Custom execution role to be used for the CodeBuild project.

      Default: - A role is automatically created

      Parameters:
      role - Custom execution role to be used for the CodeBuild project. This parameter is required.
      Returns:
      this
    • rolePolicyStatements

      @Stability(Stable) public CodeBuildStep.Builder rolePolicyStatements(List<? extends PolicyStatement> rolePolicyStatements)
      Policy statements to add to role used during the synth.

      Can be used to add acces to a CodeArtifact repository etc.

      Default: - No policy statements added to CodeBuild Project Role

      Parameters:
      rolePolicyStatements - Policy statements to add to role used during the synth. This parameter is required.
      Returns:
      this
    • securityGroups

      @Stability(Stable) public CodeBuildStep.Builder securityGroups(List<? extends ISecurityGroup> securityGroups)
      Which security group to associate with the script's project network interfaces.

      If no security group is identified, one will be created automatically.

      Only used if 'vpc' is supplied.

      Default: - Security group will be automatically created.

      Parameters:
      securityGroups - Which security group to associate with the script's project network interfaces. This parameter is required.
      Returns:
      this
    • subnetSelection

      @Stability(Stable) public CodeBuildStep.Builder subnetSelection(SubnetSelection subnetSelection)
      Which subnets to use.

      Only used if 'vpc' is supplied.

      Default: - All private subnets.

      Parameters:
      subnetSelection - Which subnets to use. This parameter is required.
      Returns:
      this
    • timeout

      @Stability(Stable) public CodeBuildStep.Builder timeout(Duration timeout)
      The number of minutes after which AWS CodeBuild stops the build if it's not complete.

      For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide.

      Default: Duration.hours(1)

      Parameters:
      timeout - The number of minutes after which AWS CodeBuild stops the build if it's not complete. This parameter is required.
      Returns:
      this
    • vpc

      @Stability(Stable) public CodeBuildStep.Builder vpc(IVpc vpc)
      The VPC where to execute the SimpleSynth.

      Default: - No VPC

      Parameters:
      vpc - The VPC where to execute the SimpleSynth. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public CodeBuildStep build()
      Specified by:
      build in interface software.amazon.jsii.Builder<CodeBuildStep>
      Returns:
      a newly built instance of CodeBuildStep.