class Artifact
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CodePipeline.Artifact |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscodepipeline#Artifact |
![]() | software.amazon.awscdk.services.codepipeline.Artifact |
![]() | aws_cdk.aws_codepipeline.Artifact |
![]() | aws-cdk-lib » aws_codepipeline » Artifact |
An output artifact of an action.
Artifacts can be used as input by some actions.
Example
const lambdaInvokeAction = new codepipeline_actions.LambdaInvokeAction({
actionName: 'Lambda',
lambda: new lambda.Function(this, 'Func', {
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromInline(`
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",
},
});
}
`),
}),
variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you
});
// later:
declare const project: codebuild.PipelineProject;
const sourceOutput = new codepipeline.Artifact();
new codepipeline_actions.CodeBuildAction({
actionName: 'CodeBuild',
project,
input: sourceOutput,
environmentVariables: {
MyVar: {
value: lambdaInvokeAction.variable('MY_VAR'),
},
},
});
Initializer
new Artifact(artifactName?: string, artifactFiles?: string[])
Parameters
- artifactName
string
— the (required) name of the Artifact. - artifactFiles
string[]
— file paths that you want to export as the output artifact for the action.
An output artifact of an action.
Artifacts can be used as input by some actions.
Properties
Name | Type | Description |
---|---|---|
bucket | string | The artifact attribute for the name of the S3 bucket where the artifact is stored. |
object | 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. |
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 | 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. |
artifact | string[] | The file paths that you want to export as the output artifact for the action. |
artifact | string |
bucketName
Type:
string
The artifact attribute for the name of the S3 bucket where the artifact is stored.
objectKey
Type:
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.
s3Location
Type:
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
Type:
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.
artifactFiles?
Type:
string[]
(optional)
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
.
artifactName?
Type:
string
(optional)
Methods
Name | Description |
---|---|
at | Returns an ArtifactPath for a file within this artifact. |
get | Retrieve the metadata stored in this artifact under the given key. |
get | Returns a token for a value inside a JSON file within this artifact. |
set | Add arbitrary extra payload to the artifact under a given key. |
to | |
static artifact(name, files?) | A static factory method used to create instances of the Artifact class. |
atPath(fileName)
public atPath(fileName: string): ArtifactPath
Parameters
- fileName
string
— The name of the file.
Returns
Returns an ArtifactPath for a file within this artifact.
CfnOutput is in the form "<artifact-name>::<file-name>"
getMetadata(key)
public getMetadata(key: string): any
Parameters
- key
string
Returns
any
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, keyName)
public getParam(jsonFile: string, keyName: string): string
Parameters
- jsonFile
string
— The JSON file name. - keyName
string
— The hash key.
Returns
string
Returns a token for a value inside a JSON file within this artifact.
setMetadata(key, value)
public setMetadata(key: string, value: any): void
Parameters
- key
string
- value
any
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()
public toString(): string
Returns
string
static artifact(name, files?)
public static artifact(name: string, files?: string[]): Artifact
Parameters
- name
string
— the (required) name of the Artifact. - files
string[]
— file paths that you want to export as the output artifact for the action.
Returns
A static factory method used to create instances of the Artifact class.
Mainly meant to be used from decdk
.