Examples of artifacts
The following examples show how to output, input, and reference artifacts in the Amazon CodeCatalyst workflow definition file.
Topics
- Example: Outputting an artifact
- Example: Inputting an artifact generated by another action
- Example: Referencing files in multiple artifacts
- Example: Referencing a file in a single artifact
- Example: Referencing a file in an artifact when a WorkflowSource is present
- Example: Referencing a file in an artifact when an action group is present
Example: Outputting an artifact
The following example shows how to output an artifact that includes two .jar files.
Actions:
Build:
Identifier: aws/build@v1
Outputs:
Artifacts:
- Name: ARTIFACT1
Files:
- build-output/file1.jar
- build-output/file2.jar
Example: Inputting an artifact generated by another action
The following example shows you how to output an artifact called
ARTIFACT4
in BuildActionA
, and input it into
BuildActionB
.
Actions:
BuildActionA:
Identifier: aws/build@v1
Outputs:
Artifacts:
- Name: ARTIFACT4
Files:
- build-output/file1.jar
- build-output/file2.jar
BuildActionB:
Identifier: aws/build@v1
Inputs:
Artifacts:
- ARTIFACT4
Configuration:
Example: Referencing files in multiple artifacts
The following example shows you how to output two artifacts named
ART5
and ART6
in BuildActionC
, and then
reference two files named file5.txt
(in artifact
ART5
) and file6.txt
(in artifact ART6
) in
BuildActionD
(under Steps
).
Note
For more information on referencing files, see Referencing files in an artifact.
Note
Although the example shows the $CATALYST_SOURCE_DIR_ART5
prefix
being used, you could omit it. This is because ART5
is the
primary input. To learn more about the primary input,
see Referencing files in an
artifact.
Actions:
BuildActionC:
Identifier: aws/build@v1
Outputs:
Artifacts:
- Name: ART5
Files:
- build-output/file5.txt
- Name: ART6
Files:
- build-output/file6.txt
BuildActionD:
Identifier: aws/build@v1
Inputs:
Artifacts:
- ART5
- ART6
Configuration:
Steps:
- run: cd $CATALYST_SOURCE_DIR_ART5/build-output && cat file5.txt
- run: cd $CATALYST_SOURCE_DIR_ART6/build-output && cat file6.txt
Example: Referencing a file in a single artifact
The following example shows you how to output one artifact named ART7
in BuildActionE
, and then reference file7.txt
(in
artifact ART7
) in BuildActionF
(under
Steps
).
Notice how the reference does not require the
$CATALYST_SOURCE_DIR_
artifact-name
prefix in front of the build-output
directory as it did in
Example: Referencing files
in multiple artifacts. This is because there
is only one item specified under Inputs
.
Note
For more information on referencing files, see Referencing files in an artifact.
Actions:
BuildActionE:
Identifier: aws/build@v1
Outputs:
Artifacts:
- Name: ART7
Files:
- build-output/file7.txt
BuildActionF:
Identifier: aws/build@v1
Inputs:
Artifacts:
- ART7
Configuration:
Steps:
- run: cd build-output && cat file7.txt
Example: Referencing a file in an artifact when a WorkflowSource is present
The following example shows you how to output one artifact named ART8
in BuildActionG
, and then reference file8.txt
(in
artifact ART8
) in BuildActionH
(under
Steps
).
Notice how the reference requires the
$CATALYST_SOURCE_DIR_
artifact-name
prefix, as it did in Example: Referencing files
in multiple artifacts. This is because there
are multiple items specified under Inputs
(a source and an artifact),
so you need the prefix to indicate where to look for the file.
Note
For more information on referencing files, see Referencing files in an artifact.
Actions:
BuildActionG:
Identifier: aws/build@v1
Outputs:
Artifacts:
- Name: ART8
Files:
- build-output/file8.txt
BuildActionH:
Identifier: aws/build@v1
Inputs:
Sources:
- WorkflowSource
Artifacts:
- ART8
Configuration:
Steps:
- run: cd $CATALYST_SOURCE_DIR_ART8/build-output && cat file8.txt
Example: Referencing a file in an artifact when an action group is present
The following example shows you how to output an artifact named ART9
in ActionGroup1
, ActionI
, and then reference
file9.txt
(in artifact ART9
) in
ActionJ
.
For more information on referencing files, see Referencing files in an artifact.
Actions:
ActionGroup1:
Actions:
ActionI:
Identifier: aws/build@v1
Outputs:
Artifacts:
- Name: ART9
Files:
- build-output/file9.yml
ActionJ:
Identifier: aws/cfn-deploy@v1
Inputs:
Sources:
- WorkflowSource
Artifacts:
- ART9
Configuration:
template: /artifacts/ActionGroup1@ActionJ/ART9/build-output/file9.yml