Skip to content
v2.275.0

Artifact Class ​

An output artifact of an action.

Artifacts can be used as input by some actions.

Example ​

ts
declare const pipeline: codepipeline.Pipeline;

const sourceOutput = new codepipeline.Artifact();
const sourceAction = new codepipeline_actions.CodeStarConnectionsSourceAction({
  actionName: 'CodeStarConnectionsSourceAction',
  output: sourceOutput,
  connectionArn: 'your-connection-arn',
  owner: 'your-owner',
  repo: 'your-repo',
});

const scanOutput = new codepipeline.Artifact();
const scanAction = new codepipeline_actions.InspectorSourceCodeScanAction({
  actionName: 'InspectorSourceCodeScanAction',
  input: sourceOutput,
  output: scanOutput,
});

pipeline.addStage({
  stageName: 'Source',
  actions: [sourceAction],
});
pipeline.addStage({
  stageName: 'Scan',
  actions: [scanAction],
});
python
# pipeline: codepipeline.Pipeline


source_output = codepipeline.Artifact()
source_action = codepipeline_actions.CodeStarConnectionsSourceAction(
    action_name="CodeStarConnectionsSourceAction",
    output=source_output,
    connection_arn="your-connection-arn",
    owner="your-owner",
    repo="your-repo"
)

scan_output = codepipeline.Artifact()
scan_action = codepipeline_actions.InspectorSourceCodeScanAction(
    action_name="InspectorSourceCodeScanAction",
    input=source_output,
    output=scan_output
)

pipeline.add_stage(
    stage_name="Source",
    actions=[source_action]
)
pipeline.add_stage(
    stage_name="Scan",
    actions=[scan_action]
)
java
Pipeline pipeline;


Artifact sourceOutput = new Artifact();
CodeStarConnectionsSourceAction sourceAction = CodeStarConnectionsSourceAction.Builder.create()
        .actionName("CodeStarConnectionsSourceAction")
        .output(sourceOutput)
        .connectionArn("your-connection-arn")
        .owner("your-owner")
        .repo("your-repo")
        .build();

Artifact scanOutput = new Artifact();
InspectorSourceCodeScanAction scanAction = InspectorSourceCodeScanAction.Builder.create()
        .actionName("InspectorSourceCodeScanAction")
        .input(sourceOutput)
        .output(scanOutput)
        .build();

pipeline.addStage(StageOptions.builder()
        .stageName("Source")
        .actions(List.of(sourceAction))
        .build());
pipeline.addStage(StageOptions.builder()
        .stageName("Scan")
        .actions(List.of(scanAction))
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Pipeline pipeline;


var sourceOutput = new Artifact();
var sourceAction = new CodeStarConnectionsSourceAction(new CodeStarConnectionsSourceActionProps {
    ActionName = "CodeStarConnectionsSourceAction",
    Output = sourceOutput,
    ConnectionArn = "your-connection-arn",
    Owner = "your-owner",
    Repo = "your-repo"
});

var scanOutput = new Artifact();
var scanAction = new InspectorSourceCodeScanAction(new InspectorSourceCodeScanActionProps {
    ActionName = "InspectorSourceCodeScanAction",
    Input = sourceOutput,
    Output = scanOutput
});

pipeline.AddStage(new StageOptions {
    StageName = "Source",
    Actions = new [] { sourceAction }
});
pipeline.AddStage(new StageOptions {
    StageName = "Scan",
    Actions = new [] { scanAction }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var pipeline Pipeline


sourceOutput := codepipeline.NewArtifact()
sourceAction := codepipeline_actions.NewCodeStarConnectionsSourceAction(&CodeStarConnectionsSourceActionProps{
	ActionName: jsii.String("CodeStarConnectionsSourceAction"),
	Output: sourceOutput,
	ConnectionArn: jsii.String("your-connection-arn"),
	Owner: jsii.String("your-owner"),
	Repo: jsii.String("your-repo"),
})

scanOutput := codepipeline.NewArtifact()
scanAction := codepipeline_actions.NewInspectorSourceCodeScanAction(&InspectorSourceCodeScanActionProps{
	ActionName: jsii.String("InspectorSourceCodeScanAction"),
	Input: sourceOutput,
	Output: scanOutput,
})

pipeline.AddStage(&StageOptions{
	StageName: jsii.String("Source"),
	Actions: []IAction{
		sourceAction,
	},
})
pipeline.AddStage(&StageOptions{
	StageName: jsii.String("Scan"),
	Actions: []IAction{
		scanAction,
	},
})

Initializer ​

ts
new Artifact(artifactName?: string, artifactFiles?: string[])
python
Artifact(artifact_name: typing.Optional[str] = None, artifact_files: typing.Optional[typing.List[str]] = None)
java
new Artifact(String artifactName, List<String> artifactFiles)
csharp
new Artifact(string? artifactName = null, string[]? artifactFiles = null)
go
NewArtifact(ArtifactName *string, ArtifactFiles *[]*string)

Properties ​

artifactFilesmay be undefinedstring[]artifact_filesmay be undefinedtyping.List[str]artifactFilesmay be undefinedList<String>ArtifactFilesmay be undefinedstring[]ArtifactFilesmay be undefined*[]*string#
The file paths that you want to export as the output artifact for the action.

This property can only be used in artifacts for CommandsAction.

artifactNamemay be undefinedstringartifact_namemay be undefinedstrartifactNamemay be undefinedStringArtifactNamemay be undefinedstringArtifactNamemay be undefined*string#
bucketNamestringbucket_namestrbucketNameStringBucketNamestringBucketName*string#
The artifact attribute for the name of the S3 bucket where the artifact is stored.
objectKeystringobject_keystrobjectKeyStringObjectKeystringObjectKey*string#
The artifact attribute for The name of the .zip file that contains the artifact that is generated by AWS CodePipeline, such as 1ABCyZZ.zip.
s3LocationLocations3_locationLocations3LocationLocationS3LocationLocationS3LocationLocation#
Returns the location of the .zip file in S3 that this Artifact represents. Used by Lambda's `CfnParametersCode` when being deployed in a CodePipeline.
urlstringurlstrurlStringUrlstringUrl*string#
The artifact attribute of the Amazon Simple Storage Service (Amazon S3) URL of the artifact, such as https://s3-us-west-2.amazonaws.com/artifactstorebucket-yivczw8jma0c/test/TemplateSo/1ABCyZZ.zip.

Methods ​

artifact(name: string, files?: string[]): Artifact // chainable@staticmethod def artifact(name: str, files: typing.Optional[typing.List[str]] = None) -> Artifactpublic static Artifact artifact(String name, List<String> files)public static Artifact Artifact(string name, string[]? files = null)func Artifact(Name *string, Files *[]*string) Artifactstatic#
A static factory method used to create instances of the Artifact class.

Mainly meant to be used from decdk.

2 parameters

Parameters

  • namenamenamenameName — the (required) name of the Artifact.
  • filesfilesfilesfilesFiles — file paths that you want to export as the output artifact for the action.
atPath(fileName: string): ArtifactPathdef at_path(self, file_name: str) -> ArtifactPathpublic ArtifactPath atPath(String fileName)public ArtifactPath AtPath(string fileName)func AtPath(FileName *string) ArtifactPath#
Returns an ArtifactPath for a file within this artifact.

CfnOutput is in the form "<artifact-name>::<file-name>"

1 parameter

Parameters

  • fileNamefile_namefileNamefileNameFileName — The name of the file.
getMetadata(key: string): anydef get_metadata(self, key: str) -> Anypublic Object getMetadata(String key)public object GetMetadata(string key)func GetMetadata(Key *string) interface{}#
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.

getParam(jsonFile: string, keyName: string): stringdef get_param(self, json_file: str, key_name: str) -> strpublic String getParam(String jsonFile, String keyName)public string GetParam(string jsonFile, string keyName)func GetParam(JsonFile *string, KeyName *string) *string#
Returns a token for a value inside a JSON file within this artifact.
2 parameters

Parameters

  • jsonFilejson_filejsonFilejsonFileJsonFile — The JSON file name.
  • keyNamekey_namekeyNamekeyNameKeyName — The hash key.
setMetadata(key: string, value: any): voiddef set_metadata(self, key: str, value: Any) -> Nonepublic void setMetadata(String key, Object value)public void SetMetadata(string key, object value)func SetMetadata(Key *string, Value interface{})#
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.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#