Skip to content

Instantly share code, notes, and snippets.

@majorsilence
Created February 13, 2022 22:22
Show Gist options
  • Select an option

  • Save majorsilence/911583d86c90d88bef9135750531a12d to your computer and use it in GitHub Desktop.

Select an option

Save majorsilence/911583d86c90d88bef9135750531a12d to your computer and use it in GitHub Desktop.
Dotnet Jenkins Pipeline
pipeline {
agent none
environment {
DOTNET_CLI_HOME = "/tmp/DOTNET_CLI_HOME"
}
stages {
stage('build and test') {
agent {
docker {
image 'mcr.microsoft.com/dotnet/sdk:6.0'
}
}
steps {
echo "building"
sh """
dotnet restore [YourSolution].sln
dotnet build [YourSolution].sln --no-restore
dotnet vstest [YourSolution].sln --logger:"nunit;LogFileName=build/nunit-results.xml"
"""
}
post{
always {
nunit testResultsPattern: 'build/nunit-results.xml'
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment