Class CodeBuildStepProps
Construction props for a CodeBuildStep.
Inheritance
Namespace: Amazon.CDK.Pipelines
Assembly: Amazon.CDK.Pipelines.dll
Syntax (csharp)
public class CodeBuildStepProps : Object, ICodeBuildStepProps, IShellStepProps
Syntax (vb)
Public Class CodeBuildStepProps
Inherits Object
Implements ICodeBuildStepProps, IShellStepProps
Remarks
ExampleMetadata: infused
Examples
new CodePipeline(this, "Pipeline", new CodePipelineProps {
Synth = new CodeBuildStep("Synth", new CodeBuildStepProps {
Input = CodePipelineSource.Connection("my-org/my-app", "main", new ConnectionSourceOptions {
ConnectionArn = "arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"
}),
Commands = new [] { "...", "npm ci", "npm run build", "npx cdk synth", "..." },
RolePolicyStatements = new [] {
new PolicyStatement(new PolicyStatementProps {
Actions = new [] { "sts:AssumeRole" },
Resources = new [] { "*" },
Conditions = new Dictionary<string, object> {
{ "StringEquals", new Dictionary<string, string> {
{ "iam:ResourceTag/aws-cdk:bootstrap-role", "lookup" }
} }
}
}) }
})
});
Synopsis
Constructors
CodeBuildStepProps() |
Properties
ActionRole | Custom execution role to be used for the Code Build Action. |
AdditionalInputs | Additional FileSets to put in other directories. |
BuildEnvironment | Changes to environment. |
Commands | Commands to run. |
Env | Environment variables to set. |
EnvFromCfnOutputs | Set environment variables based on Stack Outputs. |
Input | FileSet to run these scripts on. |
InstallCommands | Installation commands to run before the regular commands. |
PartialBuildSpec | Additional configuration that can only be configured via BuildSpec. |
PrimaryOutputDirectory | The directory that will contain the primary output fileset. |
ProjectName | Name for the generated CodeBuild project. |
Role | Custom execution role to be used for the CodeBuild project. |
RolePolicyStatements | Policy statements to add to role used during the synth. |
SecurityGroups | Which security group to associate with the script's project network interfaces. |
SubnetSelection | Which subnets to use. |
Timeout | The number of minutes after which AWS CodeBuild stops the build if it's not complete. |
Vpc | The VPC where to execute the SimpleSynth. |
Constructors
CodeBuildStepProps()
public CodeBuildStepProps()
Properties
ActionRole
Custom execution role to be used for the Code Build Action.
public IRole ActionRole { get; set; }
Property Value
Remarks
Default: - A role is automatically created
AdditionalInputs
Additional FileSets to put in other directories.
public IDictionary<string, IFileSetProducer> AdditionalInputs { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, IFileSetProducer>
Remarks
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:
var script = new ShellStep("MainScript", new ShellStepProps {
Commands = new [] { "npm ci", "npm run build", "npx cdk synth" },
Input = CodePipelineSource.GitHub("org/source1", "main"),
AdditionalInputs = new Dictionary<string, IFileSetProducer> {
{ "../siblingdir", CodePipelineSource.GitHub("org/source2", "main") }
}
});
Default: - No additional inputs
BuildEnvironment
Changes to environment.
public IBuildEnvironment BuildEnvironment { get; set; }
Property Value
Remarks
This environment will be combined with the pipeline's default environment.
Default: - Use the pipeline's default build environment
Commands
Commands to run.
public string[] Commands { get; set; }
Property Value
System.String[]
Env
Environment variables to set.
public IDictionary<string, string> Env { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
Default: - No environment variables
EnvFromCfnOutputs
Set environment variables based on Stack Outputs.
public IDictionary<string, CfnOutput> EnvFromCfnOutputs { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, CfnOutput>
Remarks
ShellStep
s following stack or stage deployments may
access the CfnOutput
s of those stacks to get access to
--for example--automatically generated resource names or
endpoint URLs.
Default: - No environment variables created from stack outputs
Input
FileSet to run these scripts on.
public IFileSetProducer Input { get; set; }
Property Value
Remarks
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
InstallCommands
Installation commands to run before the regular commands.
public string[] InstallCommands { get; set; }
Property Value
System.String[]
Remarks
For deployment engines that support it, install commands will be classified
differently in the job history from the regular commands
.
Default: - No installation commands
PartialBuildSpec
Additional configuration that can only be configured via BuildSpec.
public BuildSpec PartialBuildSpec { get; set; }
Property Value
Remarks
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
PrimaryOutputDirectory
The directory that will contain the primary output fileset.
public string PrimaryOutputDirectory { get; set; }
Property Value
System.String
Remarks
After running the script, the contents of the given directory will be treated as the primary output of this Step.
Default: - No primary output
ProjectName
Name for the generated CodeBuild project.
public string ProjectName { get; set; }
Property Value
System.String
Remarks
Default: - Automatically generated
Role
Custom execution role to be used for the CodeBuild project.
public IRole Role { get; set; }
Property Value
Remarks
Default: - A role is automatically created
RolePolicyStatements
Policy statements to add to role used during the synth.
public PolicyStatement[] RolePolicyStatements { get; set; }
Property Value
Remarks
Can be used to add acces to a CodeArtifact repository etc.
Default: - No policy statements added to CodeBuild Project Role
SecurityGroups
Which security group to associate with the script's project network interfaces.
public ISecurityGroup[] SecurityGroups { get; set; }
Property Value
Remarks
If no security group is identified, one will be created automatically.
Only used if 'vpc' is supplied.
Default: - Security group will be automatically created.
SubnetSelection
Which subnets to use.
public ISubnetSelection SubnetSelection { get; set; }
Property Value
Remarks
Only used if 'vpc' is supplied.
Default: - All private subnets.
Timeout
The number of minutes after which AWS CodeBuild stops the build if it's not complete.
public Duration Timeout { get; set; }
Property Value
Remarks
For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide.
Default: Duration.hours(1)
Vpc
The VPC where to execute the SimpleSynth.
public IVpc Vpc { get; set; }
Property Value
Remarks
Default: - No VPC