interface CodeBuildStepProps
Language | Type name |
---|---|
.NET | Amazon.CDK.Pipelines.CodeBuildStepProps |
Java | software.amazon.awscdk.pipelines.CodeBuildStepProps |
Python | aws_cdk.pipelines.CodeBuildStepProps |
TypeScript (source) | @aws-cdk/pipelines » CodeBuildStepProps |
Construction props for a CodeBuildStep.
Example
new pipelines.CodePipeline(this, 'Pipeline', {
synth: new pipelines.CodeBuildStep('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: [
// Commands to load cdk.context.json from somewhere here
'...',
'npm ci',
'npm run build',
'npx cdk synth',
// Commands to store cdk.context.json back here
'...',
],
rolePolicyStatements: [
new iam.PolicyStatement({
actions: ['sts:AssumeRole'],
resources: ['*'],
conditions: {
StringEquals: {
'iam:ResourceTag/aws-cdk:bootstrap-role': 'lookup',
},
},
}),
],
}),
});
Properties
Name | Type | Description |
---|---|---|
commands | string[] | Commands to run. |
action | IRole | Custom execution role to be used for the Code Build Action. |
additional | { [string]: IFile } | Additional FileSets to put in other directories. |
build | Build | Changes to environment. |
env? | { [string]: string } | Environment variables to set. |
env | { [string]: Cfn } | Set environment variables based on Stack Outputs. |
input? | IFile | FileSet to run these scripts on. |
install | string[] | Installation commands to run before the regular commands. |
partial | Build | Additional configuration that can only be configured via BuildSpec. |
primary | string | The directory that will contain the primary output fileset. |
project | string | Name for the generated CodeBuild project. |
role? | IRole | Custom execution role to be used for the CodeBuild project. |
role | Policy [] | Policy statements to add to role used during the synth. |
security | ISecurity [] | Which security group to associate with the script's project network interfaces. |
subnet | Subnet | Which subnets to use. |
timeout? | Duration | The number of minutes after which AWS CodeBuild stops the build if it's not complete. |
vpc? | IVpc | The VPC where to execute the SimpleSynth. |
commands
Type:
string[]
Commands to run.
actionRole?
Type:
IRole
(optional, default: A role is automatically created)
Custom execution role to be used for the Code Build Action.
additionalInputs?
Type:
{ [string]:
IFile
}
(optional, default: No additional inputs)
Additional FileSets to put in other directories.
Specifies a mapping from directory name to FileSets. During the script execution, the FileSets will be available in the directories indicated.
The directory names may be relative. For example, you can put the main input and an additional input side-by-side with the following configuration:
const script = new pipelines.ShellStep('MainScript', {
commands: ['npm ci','npm run build','npx cdk synth'],
input: pipelines.CodePipelineSource.gitHub('org/source1', 'main'),
additionalInputs: {
'../siblingdir': pipelines.CodePipelineSource.gitHub('org/source2', 'main'),
}
});
buildEnvironment?
Type:
Build
(optional, default: Use the pipeline's default build environment)
Changes to environment.
This environment will be combined with the pipeline's default environment.
env?
Type:
{ [string]: string }
(optional, default: No environment variables)
Environment variables to set.
envFromCfnOutputs?
Type:
{ [string]:
Cfn
}
(optional, default: No environment variables created from stack outputs)
Set environment variables based on Stack Outputs.
ShellStep
s following stack or stage deployments may
access the CfnOutput
s of those stacks to get access to
--for example--automatically generated resource names or
endpoint URLs.
input?
Type:
IFile
(optional, default: No input specified)
FileSet to run these scripts on.
The files in the FileSet will be placed in the working directory when
the script is executed. Use additionalInputs
to download file sets
to other directories as well.
installCommands?
Type:
string[]
(optional, default: No installation commands)
Installation commands to run before the regular commands.
For deployment engines that support it, install commands will be classified
differently in the job history from the regular commands
.
partialBuildSpec?
Type:
Build
(optional, default: BuildSpec completely derived from other properties)
Additional configuration that can only be configured via BuildSpec.
You should not use this to specify output artifacts; those should be supplied via the other properties of this class, otherwise CDK Pipelines won't be able to inspect the artifacts.
Set the commands
to an empty array if you want to fully specify
the BuildSpec using this field.
The BuildSpec must be available inline--it cannot reference a file on disk.
primaryOutputDirectory?
Type:
string
(optional, default: No primary output)
The directory that will contain the primary output fileset.
After running the script, the contents of the given directory will be treated as the primary output of this Step.
projectName?
Type:
string
(optional, default: Automatically generated)
Name for the generated CodeBuild project.
role?
Type:
IRole
(optional, default: A role is automatically created)
Custom execution role to be used for the CodeBuild project.
rolePolicyStatements?
Type:
Policy
[]
(optional, default: No policy statements added to CodeBuild Project Role)
Policy statements to add to role used during the synth.
Can be used to add acces to a CodeArtifact repository etc.
securityGroups?
Type:
ISecurity
[]
(optional, default: Security group will be automatically created.)
Which security group to associate with the script's project network interfaces.
If no security group is identified, one will be created automatically.
Only used if 'vpc' is supplied.
subnetSelection?
Type:
Subnet
(optional, default: All private subnets.)
Which subnets to use.
Only used if 'vpc' is supplied.
timeout?
Type:
Duration
(optional, default: Duration.hours(1))
The number of minutes after which AWS CodeBuild stops the build if it's not complete.
For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide.
vpc?
Type:
IVpc
(optional, default: No VPC)
The VPC where to execute the SimpleSynth.