Class CodeBuildOptions
Options for customizing a single CodeBuild project.
Inheritance
Implements
Namespace: Amazon.CDK.Pipelines
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CodeBuildOptions : Object, ICodeBuildOptions
Syntax (vb)
Public Class CodeBuildOptions
Inherits Object
Implements ICodeBuildOptions
Remarks
ExampleMetadata: infused
Examples
IFileSetProducer source; // the repository source
string[] synthCommands; // Commands to synthesize your app
string[] installCommands;
// Commands to install your toolchain
var pipeline = new CodePipeline(this, "Pipeline", new CodePipelineProps {
// Standard CodePipeline properties...
Synth = new ShellStep("Synth", new ShellStepProps {
Input = source,
Commands = synthCommands
}),
// Configure CodeBuild to use a drop-in Docker replacement.
CodeBuildDefaults = new CodeBuildOptions {
PartialBuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "phases", new Dictionary<string, IDictionary<string, string[]>> {
{ "install", new Struct {
// Add the shell commands to install your drop-in Docker
// replacement to the CodeBuild enviromment.
Commands = installCommands
} }
} }
}),
BuildEnvironment = new BuildEnvironment {
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
// Instruct the AWS CDK to use `drop-in-replacement` instead of
// `docker` when building / publishing docker images.
// e.g., `drop-in-replacement build . -f path/to/Dockerfile`
{ "CDK_DOCKER", new BuildEnvironmentVariable { Value = "drop-in-replacement" } }
}
}
}
});
Synopsis
Constructors
CodeBuildOptions() |
Properties
BuildEnvironment | Partial build environment, will be combined with other build environments that apply. |
Cache | Caching strategy to use. |
FileSystemLocations | ProjectFileSystemLocation objects for CodeBuild build projects. |
Logging | Information about logs for CodeBuild projects. |
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_7_0
Cache
Caching strategy to use.
public Cache Cache { get; set; }
Property Value
Remarks
Default: - No cache
FileSystemLocations
ProjectFileSystemLocation objects for CodeBuild build projects.
public IFileSystemLocation[] FileSystemLocations { get; set; }
Property Value
Remarks
A ProjectFileSystemLocation object specifies the identifier, location, mountOptions, mountPoint, and type of a file system created using Amazon Elastic File System. Requires a vpc to be set and privileged to be set to true.
Default: - no file system locations
Logging
Information about logs for CodeBuild projects.
public ILoggingOptions Logging { get; set; }
Property Value
Remarks
A CodeBuild project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both.
Default: - no log configuration is set
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