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