pipeline { agent any parameters { gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH' } stages { stage('git') { steps { echo "${params.BRANCH}" git branch: "${params.BRANCH}", url: 'http://ip:port/r/Net.Core.Test.git' } } stage('sonarqube') { steps { echo 'SonarQube Code' } } stage('build') { steps { echo 'dotnet restore' echo 'dotnet build' echo 'dotnet publish' echo 'dotnet publish' } } stage('nexus') { steps { echo "dotnet nexus ${params.BRANCH}" } } } }
以上代码 也可以放到 Jenkinsfile 里面