New_octopusartifact claims it's picking up file but doesn't

I have a custom step running a bash script that runs some tests and tries to create an artifact of the trx file of the results of the tests. I have verified that the file is created and exists where I expect it to be. I can even cat the contents of the file to the output log. But when I call new_octopusartifact it claims to pick up the file, doesn’t, and fails the step and deployment.

Here is the script in the step that’s being run:

#!/usr/bin/env bash
CONTID='SMOKE_TEST_CONT'

docker pull harbor/app/smoke-test:latest
docker run harbor/app/smoke-test:latest
 
resultsFileName="./TestResults.trx"
docker cp "$CONTID:/var/test-results/SmokeTests.trx" $resultsFileName

if [ ! -f $resultsFileName ]; then
    echo "$resultsFileName not found!"
fi
if [ -f $resultsFileName ]; then
cat $resultsFileName
fi
new_octopusartifact $resultsFileName

exitState=$(docker inspect --format='{{.State.ExitCode}}' $CONTID)
errorMessage=$(docker inspect --format='{{.State.Error}}' $CONTID)
docker rm $CONTID

if [[ $exitState -ne 0 ]]
then
	echo "Test container had a non-zero exit code: $exitState; Error message:$errorMessage; Please see attached trx file for more details."
	exit 1
fi
latest: Pulling from app/smoke-test March 12th 2019 11:46:53 Info
Digest: sha256:da25c38a5d231502fe78676e370e3088df6eb0ec876ce92754484ec4e0cfcde2  March 12th 2019 11:46:53 Info
Status: Image is up to date for harbor.io/app/smoke-test:latest March 12th 2019 11:46:53 Info
Executing curl --write-out %{http_code} --silent --output /dev/null https://uri/to/app March 12th 2019 11:46:53 Info
responseCode: 200  March 12th 2019 11:46:54 Info
Test run for /app/SmokeTest.Tests/out/SmokeTest.Tests.dll(.NETCoreApp,Version=v2.1)  March 12th 2019 11:46:54 Info
Microsoft (R) Test Execution Command Line Tool Version 15.8.0  March 12th 2019 11:46:54 Info
Copyright (c) Microsoft Corporation.  All rights reserved. March 12th 2019 11:46:55 Info
Starting test execution, please wait... March 12th 2019 11:48:09 Info
Results File: /var/test-results/SmokeTests.trx  March 12th 2019 11:48:10 Info
Total tests: 55. Passed: 55. Failed: 0. Skipped: 0. March 12th 2019 11:48:10 Info
Test Run Successful. March 12th 2019 11:48:10 Info
Test execution time: 1.2501 Minutes  March 12th 2019 11:48:10 Info
<?xml version="1.0" encoding="utf-8"?><TestRun id="0985e757-38b2-4977-b9df-5ea660483f52" name="@ae73fb9e4a73 2019-03-12 15:47:04" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
...cat of tfx file contents...
Collecting ./TestResults.trx as an artifact... March 12th 2019 11:48:10 Info
The action Run Smoke Tests on rdv-003754 failed The action Run Smoke Tests on <MachineName> failed March 12th 2019 11:48:11

Hi there @afuerst

Welcome to our Octopus community, thanks for reaching out! Sorry to see the new artifact creation/ collection feature apparently isn’t working in this case.

I think I’ve replicated this using a CentOS target using our latest server version (2019.2.3) and Calamari version 4.14.5. If I show the ‘verbose’ log level in the task log view, I can see the following stack trace:

Could you confirm that you see a similar stack trace, and could you let me know which versions of Server / Calamari you are using?

A workaround that worked for me was to use an absolute path, looks like this occurs with relative paths, could you confirm if this works for you?

I’ve raised a Github issue here for you to track as we address this.

Kind regards,

@Jim.Burger yes, I have that same stacktrace on my deployment

Octopus Server version: 2019.1.5+Branch.tags-2019.1.5.Sha.12c68ba2416e470eac8efaf1b6f49f5e726e6087
Using Calamari 4.13.1

The step runs on a Ubuntu box, connected via SSH, and calamari is running via locally installed Mono

Hi @afuerst,

Thanks for confirming that stack trace for me, we’ll work towards a permanent fix here.

Just to be certain of the workaround in case others encounter the same issue, could you let me know if that worked for you?

Kindest regards,
Jim

@Jim.Burger prefacing my file name with $PWD, giving it the full file path , made the file get picked up now.

Thanks for the assistance!

No problem @afuerst

Happy deployments!