在Jenkins管道中签出一个标签

ras*_*cmb 3 git jenkins jenkins-pipeline

尝试使用

checkout scm: [$class: 'GitSCM', 
  userRemoteConfigs: [[url: '${repoURL}']], 
  branches: [[name: 'refs/tags/${tag-version}']]],poll: false
Run Code Online (Sandbox Code Playgroud)

这会因身份验证错误而失败.除了使用之外还有什么办法吗?

withCredentials

在Jenkinsfile中签出标记

ras*_*cmb 9

花了几个小时后到了这里

在声明性管道中使用GitSCM的正确方法是

checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: repoURL, credentialsId: credential]], branches: [[name: tag-version]]],poll: false

不像我在网络的大多数地方找到的那样

checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: repoURL], [credentialsId: credential]], branches: [[name: tag-version]]],poll: false