interface BuildEnvironment
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodeBuild.BuildEnvironment |
Java | software.amazon.awscdk.services.codebuild.BuildEnvironment |
Python | aws_cdk.aws_codebuild.BuildEnvironment |
TypeScript (source) | @aws-cdk/aws-codebuild » BuildEnvironment |
Example
declare const vpc: ec2.Vpc;
declare const mySecurityGroup: ec2.SecurityGroup;
new pipelines.CodePipeline(this, 'Pipeline', {
// Standard CodePipeline properties
synth: new pipelines.ShellStep('Synth', {
input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', {
connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });',
}),
commands: [
'npm ci',
'npm run build',
'npx cdk synth',
],
}),
// Defaults for all CodeBuild projects
codeBuildDefaults: {
// Prepend commands and configuration to all projects
partialBuildSpec: codebuild.BuildSpec.fromObject({
version: '0.2',
// ...
}),
// Control the build environment
buildEnvironment: {
computeType: codebuild.ComputeType.LARGE,
},
// Control Elastic Network Interface creation
vpc: vpc,
subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT },
securityGroups: [mySecurityGroup],
// Additional policy statements for the execution role
rolePolicy: [
new iam.PolicyStatement({ /* ... */ }),
],
},
synthCodeBuildDefaults: { /* ... */ },
assetPublishingCodeBuildDefaults: { /* ... */ },
selfMutationCodeBuildDefaults: { /* ... */ },
});
Properties
Name | Type | Description |
---|---|---|
build | IBuild | The image used for the builds. |
certificate? | Build | The location of the PEM-encoded certificate for the build project. |
compute | Compute | The type of compute to use for this build. |
environment | { [string]: Build } | The environment variables that your builds can use. |
privileged? | boolean | Indicates how the project builds Docker images. |
buildImage?
Type:
IBuild
(optional, default: LinuxBuildImage.STANDARD_1_0)
The image used for the builds.
certificate?
Type:
Build
(optional, default: No external certificate is added to the project)
The location of the PEM-encoded certificate for the build project.
computeType?
Type:
Compute
(optional, default: taken from {@link #buildImage#defaultComputeType})
The type of compute to use for this build.
See the {@link ComputeType} enum for the possible values.
environmentVariables?
Type:
{ [string]:
Build
}
(optional)
The environment variables that your builds can use.
privileged?
Type:
boolean
(optional, default: false)
Indicates how the project builds Docker images.
Specify true to enable running the Docker daemon inside a Docker container. This value must be set to true only if this build project will be used to build Docker images, and the specified build environment image is not one provided by AWS CodeBuild with Docker support. Otherwise, all associated builds that attempt to interact with the Docker daemon will fail.