BuildSpec

class aws_cdk.aws_codebuild.BuildSpec

Bases: object

BuildSpec for CodeBuild projects.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_codebuild as codebuild


codebuild_project = codebuild.Project(self, "Project",
    project_name="MyTestProject",
    build_spec=codebuild.BuildSpec.from_object({
        "version": "0.2",
        "phases": {
            "build": {
                "commands": ["echo "Hello, CodeBuild!""
                ]
            }
        }
    })
)

task = tasks.CodeBuildStartBuild(self, "Task",
    project=codebuild_project,
    integration_pattern=sfn.IntegrationPattern.RUN_JOB,
    environment_variables_override={
        "ZONE": codebuild.BuildEnvironmentVariable(
            type=codebuild.BuildEnvironmentVariableType.PLAINTEXT,
            value=sfn.JsonPath.string_at("$.envVariables.zone")
        )
    }
)

Methods

abstract to_build_spec(scope=None)

Render the represented BuildSpec.

Parameters:

scope (Optional[Construct]) –

Return type:

str

Attributes

is_immediate

Whether the buildspec is directly available or deferred until build-time.

Static Methods

classmethod from_asset(path)

Use the contents of a local file as the build spec string.

Use this if you have a local .yml or .json file that you want to use as the buildspec

Parameters:

path (str) –

Return type:

BuildSpec

classmethod from_object(value)
Parameters:

value (Mapping[str, Any]) –

Return type:

BuildSpec

classmethod from_object_to_yaml(value)

Create a buildspec from an object that will be rendered as YAML in the resulting CloudFormation template.

Parameters:

value (Mapping[str, Any]) – the object containing the buildspec that will be rendered as YAML.

Return type:

BuildSpec

classmethod from_source_filename(filename)

Use a file from the source as buildspec.

Use this if you want to use a file different from ‘buildspec.yml’`

Parameters:

filename (str) –

Return type:

BuildSpec