Closed capalmeida closed 2 years ago
With echo 'export PATH="$PATH:/root/.dotnet/tools"' >> "$BASH_ENV"
you append the $PATH
, but the shell doesn't get informed by that update automatically. So you have a few options:
. ~/.bashrc
(but I'm not entirely sure, as I don't know the bash environment of CircleCI))as each run
in CircleCI starts a new shell-environment, the sourcing isn't needed and the "stored" settings from previous run
s are taken over, so change the yml to
# ...
- run:
name: "Run Application Tests"
command: dotnet test --no-build --logger "trx" --results-directory tests/output
- run:
name: "Install trx2junit"
command: |
dotnet tool install -g trx2junit
echo 'export PATH="$PATH:/root/.dotnet/tools"' >> "$BASH_ENV"
- run:
name: "Collect Test Results"
command: trx2junit tests/output/*.trx --output tests/TestResults
maybe also this may work (would need to try it):
# ...
- run:
name: "Run Application Tests"
command: dotnet test --no-build --logger "trx" --results-directory tests/output
- run:
name: "Collect Test Results"
command: |
dotnet tool install -g trx2junit
export PATH="$PATH:/root/.dotnet/tools"
trx2junit tests/output/*.trx --output tests/TestResults
Can you give one option a try and see if it works? Unfortunately this problem isn't (directly) related to trx2junit, as there was no change in that area. So it's either CircleCI or .NET SDK -- but I believe it just worked before by accident, as that behavior is documented at CircleCI and conforms POSIX behavior.
Unfortunately I've tried already both suggestions, first by starting the new shell-environment, and the second removing the echo command, Both failed. But re-tried again to make sure of the results:
The first suggestion yields the same error:
trx2junit : The term 'trx2junit' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:
And the second generates a different error:
At line:2 char:14
+ export PATH="$PATH:/root/.dotnet/tools"
+ ~~~~~~
Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to
delimit the name
Regarding the second one, although it is the recommended code in CircleCI documentation (https://circleci.com/docs/2.0/collect-test-data/#dot-net) it fails. Maybe that's why the trx2junit readme was updated with the info:
Check also the documentation of your CI-system on how to persist the PATH between steps, etc.
E.g. in CircleCI you need to run
echo 'export PATH="$PATH:/root/.dotnet/tools"' >> "$BASH_ENV"
Can you SSH into the CircleCI build (via their app, re-run workflow with SSH) and see what's going on?
Sorry that I can't help more here, as I don't use CircleCI (anymore) and that problem is caused either by an update from CircleCIs shell, the .NET docker image or something else.
But with SSHing into the build (one of the 👍🏻 of CircleCI) you can inspect the environment, fix it there and port that change back the the config.yml
.
I hope that you'll be able to find a solution.
Closing as not actionable here -- it's an external issue.
If the issue is indeed related to trx2junit, please feel free to leave a comment / re-open.
I'm trying to setup the trx2junit in circleci but can't get it to work, so far my relevant code is:
Error from circleci:
Any ideas on how I can overcome this? Also this started as we're setting up .NET 6 in our build pipelines, until then the following code worked without a problem: