Class LinuxBuildImage
A CodeBuild image running x86-64 Linux.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LinuxBuildImage : DeputyBase, IBuildImage
Syntax (vb)
Public Class LinuxBuildImage
Inherits DeputyBase
Implements IBuildImage
Remarks
This class has a bunch of public constants that represent the most popular images.
You can also specify a custom image using one of the static methods:
See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
ExampleMetadata: infused
Examples
var pipeline = new CodePipeline(this, "Pipeline", new CodePipelineProps {
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" }
}),
// Turn this on because the pipeline uses Docker image assets
DockerEnabledForSelfMutation = true
});
pipeline.AddWave("MyWave", new WaveOptions {
Post = new [] {
new CodeBuildStep("RunApproval", new CodeBuildStepProps {
Commands = new [] { "command-from-image" },
BuildEnvironment = new BuildEnvironment {
// The user of a Docker image asset in the pipeline requires turning on
// 'dockerEnabledForSelfMutation'.
BuildImage = LinuxBuildImage.FromAsset(this, "Image", new DockerImageAssetProps {
Directory = "./docker-image"
})
}
}) }
});
Synopsis
Constructors
LinuxBuildImage(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
LinuxBuildImage(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
AMAZON_LINUX_2 | |
AMAZON_LINUX_2_2 | |
AMAZON_LINUX_2_3 | (deprecated) The Amazon Linux 2 x86_64 standard image, version |
AMAZON_LINUX_2_4 | The Amazon Linux 2 x86_64 standard image, version |
AMAZON_LINUX_2_5 | The Amazon Linux 2 x86_64 standard image, version |
AMAZON_LINUX_2_ARM | |
AMAZON_LINUX_2_ARM_2 | The |
AMAZON_LINUX_2_ARM_3 | The |
DefaultComputeType | The default |
ImageId | The Docker image identifier that the build environment uses. |
ImagePullPrincipalType | The type of principal that CodeBuild will use to pull this build Docker image. |
Repository | An optional ECR repository that the image is hosted in. |
SecretsManagerCredentials | The secretsManagerCredentials for access to a private registry. |
STANDARD_1_0 | |
STANDARD_2_0 | |
STANDARD_3_0 | |
STANDARD_4_0 | (deprecated) The |
STANDARD_5_0 | The |
STANDARD_6_0 | The |
STANDARD_7_0 | The |
Type | The type of build environment. |
Methods
FromAsset(Construct, String, IDockerImageAssetProps) | Uses an Docker image asset as a x86-64 Linux build image. |
FromCodeBuildImageId(String) | Uses a Docker image provided by CodeBuild. |
FromDockerRegistry(String, IDockerImageOptions) | |
FromEcrRepository(IRepository, String) | |
RunScriptBuildspec(String) | Make a buildspec to run the indicated script. |
Validate(IBuildEnvironment) | Allows the image a chance to validate whether the passed configuration is correct. |
Constructors
LinuxBuildImage(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected LinuxBuildImage(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
LinuxBuildImage(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected LinuxBuildImage(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
AMAZON_LINUX_2
public static IBuildImage AMAZON_LINUX_2 { get; }
Property Value
Remarks
Stability: Deprecated
AMAZON_LINUX_2_2
public static IBuildImage AMAZON_LINUX_2_2 { get; }
Property Value
Remarks
Stability: Deprecated
AMAZON_LINUX_2_3
(deprecated) The Amazon Linux 2 x86_64 standard image, version 3.0
.
public static IBuildImage AMAZON_LINUX_2_3 { get; }
Property Value
Remarks
Stability: Deprecated
AMAZON_LINUX_2_4
The Amazon Linux 2 x86_64 standard image, version 4.0
.
public static IBuildImage AMAZON_LINUX_2_4 { get; }
Property Value
AMAZON_LINUX_2_5
The Amazon Linux 2 x86_64 standard image, version 5.0
.
public static IBuildImage AMAZON_LINUX_2_5 { get; }
Property Value
AMAZON_LINUX_2_ARM
public static IBuildImage AMAZON_LINUX_2_ARM { get; }
Property Value
Remarks
Stability: Deprecated
AMAZON_LINUX_2_ARM_2
The aws/codebuild/amazonlinux2-aarch64-standard:2.0
build image.
public static IBuildImage AMAZON_LINUX_2_ARM_2 { get; }
Property Value
AMAZON_LINUX_2_ARM_3
The aws/codebuild/amazonlinux2-aarch64-standard:3.0
build image.
public static IBuildImage AMAZON_LINUX_2_ARM_3 { get; }
Property Value
DefaultComputeType
The default ComputeType
to use with this image, if one was not specified in BuildEnvironment#computeType
explicitly.
public virtual ComputeType DefaultComputeType { get; }
Property Value
ImageId
The Docker image identifier that the build environment uses.
public virtual string ImageId { get; }
Property Value
System.String
ImagePullPrincipalType
The type of principal that CodeBuild will use to pull this build Docker image.
public virtual Nullable<ImagePullPrincipalType> ImagePullPrincipalType { get; }
Property Value
System.Nullable<ImagePullPrincipalType>
Repository
An optional ECR repository that the image is hosted in.
public virtual IRepository Repository { get; }
Property Value
SecretsManagerCredentials
The secretsManagerCredentials for access to a private registry.
public virtual ISecret SecretsManagerCredentials { get; }
Property Value
STANDARD_1_0
public static IBuildImage STANDARD_1_0 { get; }
Property Value
Remarks
Stability: Deprecated
STANDARD_2_0
public static IBuildImage STANDARD_2_0 { get; }
Property Value
Remarks
Stability: Deprecated
STANDARD_3_0
public static IBuildImage STANDARD_3_0 { get; }
Property Value
Remarks
Stability: Deprecated
STANDARD_4_0
(deprecated) The aws/codebuild/standard:4.0
build image.
public static IBuildImage STANDARD_4_0 { get; }
Property Value
Remarks
Stability: Deprecated
STANDARD_5_0
The aws/codebuild/standard:5.0
build image.
public static IBuildImage STANDARD_5_0 { get; }
Property Value
STANDARD_6_0
The aws/codebuild/standard:6.0
build image.
public static IBuildImage STANDARD_6_0 { get; }
Property Value
STANDARD_7_0
The aws/codebuild/standard:7.0
build image.
public static IBuildImage STANDARD_7_0 { get; }
Property Value
Type
The type of build environment.
public virtual string Type { get; }
Property Value
System.String
Methods
FromAsset(Construct, String, IDockerImageAssetProps)
Uses an Docker image asset as a x86-64 Linux build image.
public static IBuildImage FromAsset(Construct scope, string id, IDockerImageAssetProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IDockerImageAssetProps
Returns
FromCodeBuildImageId(String)
Uses a Docker image provided by CodeBuild.
public static IBuildImage FromCodeBuildImageId(string id)
Parameters
- id System.String
The image identifier.
Returns
A Docker image provided by CodeBuild.
Remarks
Examples
"aws/codebuild/standard:4.0";
FromDockerRegistry(String, IDockerImageOptions)
public static IBuildImage FromDockerRegistry(string name, IDockerImageOptions options = null)
Parameters
- name System.String
- options IDockerImageOptions
Returns
a x86-64 Linux build image from a Docker Hub image.
FromEcrRepository(IRepository, String)
public static IBuildImage FromEcrRepository(IRepository repository, string tagOrDigest = null)
Parameters
- repository IRepository
The ECR repository.
- tagOrDigest System.String
Image tag or digest (default "latest", digests must start with
sha256:
).
Returns
A x86-64 Linux build image from an ECR repository.
NOTE: if the repository is external (i.e. imported), then we won't be able to add a resource policy statement for it so CodeBuild can pull the image.
Remarks
RunScriptBuildspec(String)
Make a buildspec to run the indicated script.
public virtual BuildSpec RunScriptBuildspec(string entrypoint)
Parameters
- entrypoint System.String
Returns
Validate(IBuildEnvironment)
Allows the image a chance to validate whether the passed configuration is correct.
public virtual string[] Validate(IBuildEnvironment env)
Parameters
Returns
System.String[]