Artifact

class aws_cdk.aws_codepipeline.Artifact(artifact_name=None)

Bases: object

An output artifact of an action.

Artifacts can be used as input by some actions.

ExampleMetadata:

infused

Example:

# later:
# project: codebuild.PipelineProject
lambda_invoke_action = codepipeline_actions.LambdaInvokeAction(
    action_name="Lambda",
    lambda_=lambda_.Function(self, "Func",
        runtime=lambda_.Runtime.NODEJS_LATEST,
        handler="index.handler",
        code=lambda_.Code.from_inline("""
                    const { CodePipeline } = require('@aws-sdk/client-codepipeline');

                    exports.handler = async function(event, context) {
                        const codepipeline = new AWS.CodePipeline();
                        await codepipeline.putJobSuccessResult({
                            jobId: event['CodePipeline.job'].id,
                            outputVariables: {
                                MY_VAR: "some value",
                            },
                        });
                    }
                """)
    ),
    variables_namespace="MyNamespace"
)
source_output = codepipeline.Artifact()
codepipeline_actions.CodeBuildAction(
    action_name="CodeBuild",
    project=project,
    input=source_output,
    environment_variables={
        "MyVar": codebuild.BuildEnvironmentVariable(
            value=lambda_invoke_action.variable("MY_VAR")
        )
    }
)
Parameters:

artifact_name (Optional[str]) –

Methods

at_path(file_name)

Returns an ArtifactPath for a file within this artifact.

CfnOutput is in the form “::”

Parameters:

file_name (str) – The name of the file.

Return type:

ArtifactPath

get_metadata(key)

Retrieve the metadata stored in this artifact under the given key.

If there is no metadata stored under the given key, null will be returned.

Parameters:

key (str) –

Return type:

Any

get_param(json_file, key_name)

Returns a token for a value inside a JSON file within this artifact.

Parameters:
  • json_file (str) – The JSON file name.

  • key_name (str) – The hash key.

Return type:

str

set_metadata(key, value)

Add arbitrary extra payload to the artifact under a given key.

This can be used by CodePipeline actions to communicate data between themselves. If metadata was already present under the given key, it will be overwritten with the new value.

Parameters:
  • key (str) –

  • value (Any) –

Return type:

None

to_string()
Return type:

Optional[str]

Attributes

artifact_name
bucket_name

The artifact attribute for the name of the S3 bucket where the artifact is stored.

object_key

The artifact attribute for The name of the .zip file that contains the artifact that is generated by AWS CodePipeline, such as 1ABCyZZ.zip.

s3_location

Returns the location of the .zip file in S3 that this Artifact represents. Used by Lambda’s CfnParametersCode when being deployed in a CodePipeline.

url

//s3-us-west-2.amazonaws.com/artifactstorebucket-yivczw8jma0c/test/TemplateSo/1ABCyZZ.zip.

Type:

The artifact attribute of the Amazon Simple Storage Service (Amazon S3) URL of the artifact, such as https

Static Methods

classmethod artifact(name)

A static factory method used to create instances of the Artifact class.

Mainly meant to be used from decdk.

Parameters:

name (str) – the (required) name of the Artifact.

Return type:

Artifact