Class Cache
Cache options for CodeBuild Project.
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class Cache : DeputyBase
Syntax (vb)
Public MustInherit Class Cache Inherits DeputyBase
Remarks
A cache can store reusable pieces of your build environment and use them across multiple builds.
See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-caching.html
ExampleMetadata: infused
Examples
Vpc vpc;
SecurityGroup mySecurityGroup;
new CodeBuildStep("Synth", new CodeBuildStepProps {
// ...standard ShellStep props...
Commands = new [] { },
Env = new Dictionary<string, object> { },
// If you are using a CodeBuildStep explicitly, set the 'cdk.out' directory
// to be the synth step's output.
PrimaryOutputDirectory = "cdk.out",
// Control the name of the project
ProjectName = "MyProject",
// Control parts of the BuildSpec other than the regular 'build' and 'install' commands
PartialBuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" }
}),
// Control the build environment
BuildEnvironment = new BuildEnvironment {
ComputeType = ComputeType.LARGE,
Privileged = true,
DockerServer = new DockerServerOptions {
ComputeType = DockerServerComputeType.SMALL,
SecurityGroups = new [] { mySecurityGroup }
}
},
Timeout = Duration.Minutes(90),
FileSystemLocations = new [] { FileSystemLocation.Efs(new EfsFileSystemLocationProps {
Identifier = "myidentifier2",
Location = "myclodation.mydnsroot.com:/loc",
MountPoint = "/media",
MountOptions = "opts"
}) },
// Control Elastic Network Interface creation
Vpc = vpc,
SubnetSelection = new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_EGRESS },
SecurityGroups = new [] { mySecurityGroup },
// Control caching
Cache = Cache.Bucket(new Bucket(this, "Cache")),
// Additional policy statements for the execution role
RolePolicyStatements = new [] {
new PolicyStatement(new PolicyStatementProps { }) }
});
Synopsis
Constructors
| Cache() | Cache options for CodeBuild Project. |
Methods
| Bucket(IBucket, IBucketCacheOptions?) | Create an S3 caching strategy. |
| Local(params LocalCacheMode[]) | Create a local caching strategy. |
| None() | Cache options for CodeBuild Project. |
Constructors
Cache()
Cache options for CodeBuild Project.
protected Cache()
Remarks
A cache can store reusable pieces of your build environment and use them across multiple builds.
See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-caching.html
ExampleMetadata: infused
Examples
Vpc vpc;
SecurityGroup mySecurityGroup;
new CodeBuildStep("Synth", new CodeBuildStepProps {
// ...standard ShellStep props...
Commands = new [] { },
Env = new Dictionary<string, object> { },
// If you are using a CodeBuildStep explicitly, set the 'cdk.out' directory
// to be the synth step's output.
PrimaryOutputDirectory = "cdk.out",
// Control the name of the project
ProjectName = "MyProject",
// Control parts of the BuildSpec other than the regular 'build' and 'install' commands
PartialBuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" }
}),
// Control the build environment
BuildEnvironment = new BuildEnvironment {
ComputeType = ComputeType.LARGE,
Privileged = true,
DockerServer = new DockerServerOptions {
ComputeType = DockerServerComputeType.SMALL,
SecurityGroups = new [] { mySecurityGroup }
}
},
Timeout = Duration.Minutes(90),
FileSystemLocations = new [] { FileSystemLocation.Efs(new EfsFileSystemLocationProps {
Identifier = "myidentifier2",
Location = "myclodation.mydnsroot.com:/loc",
MountPoint = "/media",
MountOptions = "opts"
}) },
// Control Elastic Network Interface creation
Vpc = vpc,
SubnetSelection = new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_EGRESS },
SecurityGroups = new [] { mySecurityGroup },
// Control caching
Cache = Cache.Bucket(new Bucket(this, "Cache")),
// Additional policy statements for the execution role
RolePolicyStatements = new [] {
new PolicyStatement(new PolicyStatementProps { }) }
});
Methods
Bucket(IBucket, IBucketCacheOptions?)
Create an S3 caching strategy.
public static Cache Bucket(IBucket bucket, IBucketCacheOptions? options = null)
Parameters
- bucket IBucket
the S3 bucket to use for caching.
- options IBucketCacheOptions
additional options to pass to the S3 caching.
Returns
Remarks
A cache can store reusable pieces of your build environment and use them across multiple builds.
See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-caching.html
ExampleMetadata: infused
Local(params LocalCacheMode[])
Create a local caching strategy.
public static Cache Local(params LocalCacheMode[] modes)
Parameters
- modes LocalCacheMode[]
the mode(s) to enable for local caching.
Returns
Remarks
A cache can store reusable pieces of your build environment and use them across multiple builds.
See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-caching.html
ExampleMetadata: infused
None()
Cache options for CodeBuild Project.
public static Cache None()
Returns
Remarks
A cache can store reusable pieces of your build environment and use them across multiple builds.
See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-caching.html
ExampleMetadata: infused
Examples
Vpc vpc;
SecurityGroup mySecurityGroup;
new CodeBuildStep("Synth", new CodeBuildStepProps {
// ...standard ShellStep props...
Commands = new [] { },
Env = new Dictionary<string, object> { },
// If you are using a CodeBuildStep explicitly, set the 'cdk.out' directory
// to be the synth step's output.
PrimaryOutputDirectory = "cdk.out",
// Control the name of the project
ProjectName = "MyProject",
// Control parts of the BuildSpec other than the regular 'build' and 'install' commands
PartialBuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" }
}),
// Control the build environment
BuildEnvironment = new BuildEnvironment {
ComputeType = ComputeType.LARGE,
Privileged = true,
DockerServer = new DockerServerOptions {
ComputeType = DockerServerComputeType.SMALL,
SecurityGroups = new [] { mySecurityGroup }
}
},
Timeout = Duration.Minutes(90),
FileSystemLocations = new [] { FileSystemLocation.Efs(new EfsFileSystemLocationProps {
Identifier = "myidentifier2",
Location = "myclodation.mydnsroot.com:/loc",
MountPoint = "/media",
MountOptions = "opts"
}) },
// Control Elastic Network Interface creation
Vpc = vpc,
SubnetSelection = new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_EGRESS },
SecurityGroups = new [] { mySecurityGroup },
// Control caching
Cache = Cache.Bucket(new Bucket(this, "Cache")),
// Additional policy statements for the execution role
RolePolicyStatements = new [] {
new PolicyStatement(new PolicyStatementProps { }) }
});