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. |
BuildSpec()
topublic toBuildSpec(): string
Returns
string
Render the represented BuildSpec.
Object(value)
static frompublic static fromObject(value: { [string]: any }): BuildSpec
Parameters
- value
{ [string]: any }
Returns
ObjectToYaml(value)
static frompublic 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.
SourceFilename(filename)
static frompublic 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'`