class BuildSpec
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodeBuild.BuildSpec |
Java | software.amazon.awscdk.services.codebuild.BuildSpec |
Python | aws_cdk.aws_codebuild.BuildSpec |
TypeScript (source) | @aws-cdk/aws-codebuild » BuildSpec |
Obtainable from
Linux
.runScriptBuildspec()
, Linux
.runScriptBuildspec()
, Linux
.runScriptBuildspec()
, Windows
.runScriptBuildspec()
BuildSpec for CodeBuild projects.
Example
const sourceOutput = new codepipeline.Artifact();
const buildAction = new codepipeline_actions.CodeBuildAction({
actionName: 'Build1',
input: sourceOutput,
project: new codebuild.PipelineProject(this, 'Project', {
buildSpec: codebuild.BuildSpec.fromObject({
version: '0.2',
env: {
'exported-variables': [
'MY_VAR',
],
},
phases: {
build: {
commands: 'export MY_VAR="some value"',
},
},
}),
}),
variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you
});
// later:
declare const project: codebuild.PipelineProject;
new codepipeline_actions.CodeBuildAction({
actionName: 'CodeBuild',
project,
input: sourceOutput,
environmentVariables: {
MyVar: {
value: buildAction.variable('MY_VAR'),
},
},
});
Initializer
new BuildSpec()
Properties
Name | Type | Description |
---|---|---|
is | boolean | Whether the buildspec is directly available or deferred until build-time. |
isImmediate
Type:
boolean
Whether the buildspec is directly available or deferred until build-time.
Methods
Name | Description |
---|---|
to | Render the represented BuildSpec. |
static from | |
static from | Create a buildspec from an object that will be rendered as YAML in the resulting CloudFormation template. |
static from | Use a file from the source as buildspec. |
toBuildSpec()
public toBuildSpec(): string
Returns
string
Render the represented BuildSpec.
static fromObject(value)
public static fromObject(value: { [string]: any }): BuildSpec
Parameters
- value
{ [string]: any }
Returns
static fromObjectToYaml(value)
public static fromObjectToYaml(value: { [string]: any }): BuildSpec
Parameters
- value
{ [string]: any }
— the object containing the buildspec that will be rendered as YAML.
Returns
Create a buildspec from an object that will be rendered as YAML in the resulting CloudFormation template.
static fromSourceFilename(filename)
public static fromSourceFilename(filename: string): BuildSpec
Parameters
- filename
string
Returns
Use a file from the source as buildspec.
Use this if you want to use a file different from 'buildspec.yml'`