Class CodeBuildOptions
Options for customizing a single CodeBuild project.
Inheritance
Implements
Namespace: Amazon.CDK.Pipelines
Assembly: Amazon.CDK.Pipelines.dll
Syntax (csharp)
public class CodeBuildOptions : Object, ICodeBuildOptions
Syntax (vb)
Public Class CodeBuildOptions
Inherits Object
Implements ICodeBuildOptions
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
SecurityGroup mySecurityGroup;
new CodePipeline(this, "Pipeline", new CodePipelineProps {
// Standard CodePipeline properties
Synth = new ShellStep("Synth", new ShellStepProps {
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" }
}),
// Defaults for all CodeBuild projects
CodeBuildDefaults = new CodeBuildOptions {
// Prepend commands and configuration to all projects
PartialBuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" }
}),
// Control the build environment
BuildEnvironment = new BuildEnvironment {
ComputeType = ComputeType.LARGE
},
// Control Elastic Network Interface creation
Vpc = vpc,
SubnetSelection = new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_NAT },
SecurityGroups = new [] { mySecurityGroup },
// Additional policy statements for the execution role
RolePolicy = new [] {
new PolicyStatement(new PolicyStatementProps { }) }
},
SynthCodeBuildDefaults = new CodeBuildOptions { },
AssetPublishingCodeBuildDefaults = new CodeBuildOptions { },
SelfMutationCodeBuildDefaults = new CodeBuildOptions { }
});
Synopsis
Constructors
CodeBuildOptions() |
Properties
BuildEnvironment | Partial build environment, will be combined with other build environments that apply. |
PartialBuildSpec | Partial buildspec, will be combined with other buildspecs that apply. |
RolePolicy | Policy statements to add to role. |
SecurityGroups | Which security group(s) to associate with the 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 create the CodeBuild network interfaces in. |
Constructors
CodeBuildOptions()
public CodeBuildOptions()
Properties
BuildEnvironment
Partial build environment, will be combined with other build environments that apply.
public IBuildEnvironment BuildEnvironment { get; set; }
Property Value
Remarks
Default: - Non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_5_0
PartialBuildSpec
Partial buildspec, will be combined with other buildspecs that apply.
public BuildSpec PartialBuildSpec { get; set; }
Property Value
Remarks
The BuildSpec must be available inline--it cannot reference a file on disk.
Default: - No initial BuildSpec
RolePolicy
Policy statements to add to role.
public PolicyStatement[] RolePolicy { get; set; }
Property Value
Remarks
Default: - No policy statements added to CodeBuild Project Role
SecurityGroups
Which security group(s) to associate with the project network interfaces.
public ISecurityGroup[] SecurityGroups { get; set; }
Property Value
Remarks
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 create the CodeBuild network interfaces in.
public IVpc Vpc { get; set; }
Property Value
Remarks
Default: - No VPC