Downloading workflow attachments¶
You can download generated attachments before they automatically expire.
By default, the OpenTestFactory orchestrator stores build logs and attachments for 1 hour, and you can customize this retention period. For more information, see “Configuring the retention policy.”
The OpenTestFactory CLI will download each attachment into separate directories based on the job and attachment name. If only a single attachment is specified, it will be extracted into the current directory.
Listing the attachments generated by a workflow¶
To list all attachments generated by a workflow, use the opentf-ctl get attachments <workflow_id>
command
opentf-ctl get attachments 396e99ec-0fe4-4f35-8b9e-69a550a0e474
opentf-ctl get attachments 396
JOB_NAME STEP UUID FILENAME TESTCASE
robot-execute-test 4 8bb0a81d-f20b-491d-bf0c-dd84a8454a4e RobotFramework_reports.tar test_statuses.robot
robot-execute-test 4 49dda176-25b5-4ac9-bbe6-1b64ba1c5da7 output.xml test_statuses.robot
<none> <none> 68f8f5cc-36ba-439d-b15b-2c6c5e94a595_e executionlog.txt <none>
For more information, see “Attachments commands.”
Downloading attachments¶
To download all attachments generated by a workflow run, use the opentf-ctl cp <workflow_id>:* <destination_directory>
command. Replace
<workflow_id>
with the ID of the run that you want to download attachments from. If you specify
a partial ID, the CLI will complete it if it is not ambiguous, and will list the matching IDs
otherwise. Replace <destination_directory>
with the directory you want to download the
attachments to.
opentf-ctl cp be:*.xml /home/user/attachments
Attachment output.xml (5475bbf6-b588-4248-ac08-7e31b1d07049) is downloaded as /home/user/attachments/robotframework-job/1_test_backslashes_reporter.robot/output.xml.
Attachment output.xml (705a53d1-1fd5-4618-a5bc-c3101cd0d52f) is downloaded as /home/user/attachments/robotframework-job/2_test_special_chars.robot/output.xml.
Attachment calculator-report.xml (c33e4613-8063-45b8-a937-7359d66bc65b) is downloaded as /home/user/attachments/cypress-job/1_calculator.mult.ko.spec.js/calculator-report.xml.
Attachment calculator-report.xml (728a1268-c525-45d2-a7c8-e1bf3f5c9080) is downloaded as /home/user/attachments/cypress-job/2_calculator.add.ok.spec.js/calculator-report.xml.
tree /home/users/attachments
.
├── cypress-job
│ ├── 1_calculator.mult.ko.spec.js
│ │ └── calculator-report.xml
│ └── 2_calculator.add.ok.spec.js
│ └── calculator-report.xml
└── robotframework-job
├── 1_test_backslashes_reporter.robot
│ └── output.xml
└── 2_test_special_chars.robot
└── output.xml
To download a specific attachment from a run, use the opentf-ctl cp <workflow_id>:<attachment_id> <destination>
command.
Replace <workflow_id>
with the ID of the run that you want to download attachments from, and <attachment_id>
with the ID
of the attachment that you want to download. Replace <destination>
with the file or directory you want to download the attachment to.
opentf-ctl cp be:ab1b22b3-2cae-4f7f-8029-0afcc53da1bf /path/to/19700101_report.html
Attachment report.html (ab1b22b3-2cae-4f7f-8029-0afcc53da1bf) is downloaded as /path/to/19700101_report.html.
For more information, see “Using the opentf-ctl cp
command.”