Class ProjectProps
Inherited Members
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ProjectProps : IProjectProps, ICommonProjectProps
Syntax (vb)
Public Class ProjectProps Implements IProjectProps, ICommonProjectProps
Remarks
ExampleMetadata: infused
Examples
Repository ecrRepository;
new Project(this, "Project", new ProjectProps {
Environment = new BuildEnvironment {
BuildImage = WindowsBuildImage.FromEcrRepository(ecrRepository, "v1.0", WindowsImageType.SERVER_2019),
// optional certificate to include in the build image
Certificate = new BuildEnvironmentCertificate {
Bucket = Bucket.FromBucketName(this, "Bucket", "amzn-s3-demo-bucket"),
ObjectKey = "path/to/cert.pem"
}
}
});
Synopsis
Constructors
| ProjectProps() |
Properties
| AllowAllOutbound | Whether to allow the CodeBuild to send all network traffic. |
| Artifacts | Defines where build artifacts will be stored. |
| AutoRetryLimit | CodeBuild will automatically call retry build using the project's service role up to the auto-retry limit. |
| Badge | Indicates whether AWS CodeBuild generates a publicly accessible URL for your project's build badge. |
| BuildSpec | Filename or contents of buildspec in JSON format. |
| Cache | Caching strategy to use. |
| CheckSecretsInPlainTextEnvVariables | Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT. Since using a secret for the value of that kind of variable would result in it being displayed in plain text in the AWS Console, the construct will throw an exception if it detects a secret was passed there. Pass this property as false if you want to skip this validation, and keep using a secret in a plain text environment variable. |
| ConcurrentBuildLimit | Maximum number of concurrent builds. |
| Description | A description of the project. |
| EncryptionKey | Encryption key to use to read and write artifacts. |
| Environment | Build environment to use for the build. |
| EnvironmentVariables | Additional environment variables to add to the build environment. |
| FileSystemLocations | An ProjectFileSystemLocation objects for a CodeBuild build project. |
| GrantReportGroupPermissions | Add permissions to this project's role to create and use test report groups with name starting with the name of this project. |
| Logging | Information about logs for the build project. |
| ProjectName | The physical, human-readable name of the CodeBuild Project. |
| QueuedTimeout | The number of minutes after which AWS CodeBuild stops the build if it's still in queue. |
| Role | Service Role to assume while running the build. |
| SecondaryArtifacts | The secondary artifacts for the Project. |
| SecondarySources | The secondary sources for the Project. |
| SecurityGroups | What security group to associate with the codebuild project's network interfaces. |
| Source | The source of the build. |
| SsmSessionPermissions | Add the permissions necessary for debugging builds with SSM Session Manager. |
| SubnetSelection | Where to place the network interfaces within the VPC. |
| Timeout | The number of minutes after which AWS CodeBuild stops the build if it's not complete. |
| Visibility | Specifies the visibility of the project's builds. |
| Vpc | VPC network to place codebuild network interfaces. |
Constructors
ProjectProps()
public ProjectProps()
Remarks
ExampleMetadata: infused
Examples
Repository ecrRepository;
new Project(this, "Project", new ProjectProps {
Environment = new BuildEnvironment {
BuildImage = WindowsBuildImage.FromEcrRepository(ecrRepository, "v1.0", WindowsImageType.SERVER_2019),
// optional certificate to include in the build image
Certificate = new BuildEnvironmentCertificate {
Bucket = Bucket.FromBucketName(this, "Bucket", "amzn-s3-demo-bucket"),
ObjectKey = "path/to/cert.pem"
}
}
});
Properties
AllowAllOutbound
Whether to allow the CodeBuild to send all network traffic.
public bool? AllowAllOutbound { get; set; }
Property Value
bool?
Remarks
If set to false, you must individually add traffic rules to allow the CodeBuild project to connect to network targets.
Only used if 'vpc' is supplied.
Default: true
Artifacts
Defines where build artifacts will be stored.
public IArtifacts? Artifacts { get; set; }
Property Value
Remarks
Could be: PipelineBuildArtifacts, NoArtifacts and S3Artifacts.
Default: NoArtifacts
AutoRetryLimit
CodeBuild will automatically call retry build using the project's service role up to the auto-retry limit.
public double? AutoRetryLimit { get; set; }
Property Value
Remarks
autoRetryLimit must be between 0 and 10.
Default: - no retry
Badge
Indicates whether AWS CodeBuild generates a publicly accessible URL for your project's build badge.
public bool? Badge { get; set; }
Property Value
bool?
Remarks
For more information, see Build Badges Sample in the AWS CodeBuild User Guide.
Default: false
BuildSpec
Filename or contents of buildspec in JSON format.
public BuildSpec? BuildSpec { get; set; }
Property Value
Remarks
Default: - Empty buildspec.
See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-example
Cache
Caching strategy to use.
public Cache? Cache { get; set; }
Property Value
Remarks
Default: Cache.none
CheckSecretsInPlainTextEnvVariables
Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT. Since using a secret for the value of that kind of variable would result in it being displayed in plain text in the AWS Console, the construct will throw an exception if it detects a secret was passed there. Pass this property as false if you want to skip this validation, and keep using a secret in a plain text environment variable.
public bool? CheckSecretsInPlainTextEnvVariables { get; set; }
Property Value
bool?
Remarks
Default: true
ConcurrentBuildLimit
Maximum number of concurrent builds.
public double? ConcurrentBuildLimit { get; set; }
Property Value
Remarks
Minimum value is 1 and maximum is account build limit.
Default: - no explicit limit is set
Description
A description of the project.
public string? Description { get; set; }
Property Value
Remarks
Use the description to identify the purpose of the project.
Default: - No description.
EncryptionKey
Encryption key to use to read and write artifacts.
public IKey? EncryptionKey { get; set; }
Property Value
Remarks
Default: - The AWS-managed CMK for Amazon Simple Storage Service (Amazon S3) is used.
Environment
Build environment to use for the build.
public IBuildEnvironment? Environment { get; set; }
Property Value
Remarks
Default: BuildEnvironment.LinuxBuildImage.STANDARD_7_0
EnvironmentVariables
Additional environment variables to add to the build environment.
public IDictionary<string, IBuildEnvironmentVariable>? EnvironmentVariables { get; set; }
Property Value
IDictionary<string, IBuildEnvironmentVariable>
Remarks
Default: - No additional environment variables are specified.
FileSystemLocations
An ProjectFileSystemLocation objects for a CodeBuild build project.
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.
Default: - no file system locations
GrantReportGroupPermissions
Add permissions to this project's role to create and use test report groups with name starting with the name of this project.
public bool? GrantReportGroupPermissions { get; set; }
Property Value
bool?
Remarks
That is the standard report group that gets created when a simple name (in contrast to an ARN) is used in the 'reports' section of the buildspec of this project. This is usually harmless, but you can turn these off if you don't plan on using test reports in this project.
Default: true
See: https://docs.aws.amazon.com/codebuild/latest/userguide/test-report-group-naming.html
Logging
Information about logs for the build project.
public ILoggingOptions? Logging { get; set; }
Property Value
Remarks
A project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both.
Default: - no log configuration is set
ProjectName
The physical, human-readable name of the CodeBuild Project.
public string? ProjectName { get; set; }
Property Value
Remarks
Default: - Name is automatically generated.
QueuedTimeout
The number of minutes after which AWS CodeBuild stops the build if it's still in queue.
public Duration? QueuedTimeout { get; set; }
Property Value
Remarks
For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide.
Default: - no queue timeout is set
Role
Service Role to assume while running the build.
public IRole? Role { get; set; }
Property Value
Remarks
Default: - A role will be created.
SecondaryArtifacts
The secondary artifacts for the Project.
public IArtifacts[]? SecondaryArtifacts { get; set; }
Property Value
Remarks
Can also be added after the Project has been created by using the Project#addSecondaryArtifact method.
Default: - No secondary artifacts.
See: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html
SecondarySources
The secondary sources for the Project.
public ISource[]? SecondarySources { get; set; }
Property Value
ISource[]
Remarks
Can be also added after the Project has been created by using the Project#addSecondarySource method.
Default: - No secondary sources.
See: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html
SecurityGroups
What security group to associate with the codebuild project's network interfaces.
public ISecurityGroup[]? SecurityGroups { get; set; }
Property Value
Remarks
If no security group is identified, one will be created automatically.
Only used if 'vpc' is supplied.
Default: - Security group will be automatically created.
Source
The source of the build.
public ISource? Source { get; set; }
Property Value
Remarks
Note: if NoSource is given as the source,
then you need to provide an explicit buildSpec.
Default: - NoSource
SsmSessionPermissions
Add the permissions necessary for debugging builds with SSM Session Manager.
public bool? SsmSessionPermissions { get; set; }
Property Value
bool?
Remarks
If the following prerequisites have been met:
Then the build container can be paused and inspected using Session Manager
by invoking the codebuild-breakpoint command somewhere during the build.
codebuild-breakpoint commands will be ignored if the build is not started
with debugSessionEnabled=true.
Default: false
See: https://docs.aws.amazon.com/codebuild/latest/userguide/session-manager.html
SubnetSelection
Where to place the network interfaces within the VPC.
public ISubnetSelection? SubnetSelection { get; set; }
Property Value
Remarks
To access AWS services, your CodeBuild project needs to be in one of the following types of subnets:
If you don't specify a subnet selection, the default behavior is to use PRIVATE_WITH_EGRESS subnets first if they exist, then PRIVATE_WITHOUT_EGRESS, and finally PUBLIC subnets. If your VPC doesn't have PRIVATE_WITH_EGRESS subnets but you need AWS service access, add VPC Endpoints to your private subnets.
Default: - private subnets if available else public subnets
See: https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html
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)
Visibility
Specifies the visibility of the project's builds.
public ProjectVisibility? Visibility { get; set; }
Property Value
Remarks
Default: - no visibility is set
Vpc
VPC network to place codebuild network interfaces.
public IVpc? Vpc { get; set; }
Property Value
Remarks
Specify this if the codebuild project needs to access resources in a VPC.
Default: - No VPC is specified.