Last active
April 18, 2022 16:55
-
-
Save caffeinetiger/9f4c0e7566697381557a5de758b2dce5 to your computer and use it in GitHub Desktop.
For use in a Jenkins freestyle job in an Execute shell Build Action. Will run tests in a docker conatainer, check if there is a failed test and exit, and produce a .trx results file for Jenkins. Something to note is that the .trx
file has to be cho
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
TEST_OUTPUT=`docker run --rm -v $WORKSPACE:/src/ mcr.microsoft.com/dotnet/sdk:3.1 bash -c "cd /src/; dotnet test --logger 'trx;logfilename=testResults.trx';"` | |
sudo chown -R jenkins:jenkins . | |
FAIL_STR="Failed:" | |
ls -al | |
if [[ "$TEST_OUTPUT" == *"$FAIL_STR"* ]]; then | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment