基于Jenkins Workflow插件中的Tag的Checkout存储库

时间:2015-12-23 13:44:37

标签: jenkins jenkins-workflow

使用Jenkins Workflow Plugin,我可以根据分支检出存储库。但是,我想基于标签检查存储库。

这是我检查主分支的当前配置

switch

现在我想查看标签3.6.1。我试图将分支更改为标记,但这不会起作用。文档中没有关于签出标签的内容。

目前有可能吗?我在监督什么吗?

的引用;

https://github.com/jenkinsci/workflow-plugin

https://github.com/jenkinsci/workflow-plugin/blob/master/scm-step/README.md

https://github.com/jenkinsci/workflow-plugin/blob/master/scm-step/src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GitStep/config.jelly

https://github.com/jenkinsci/workflow-plugin/blob/master/scm-step/src/main/java/org/jenkinsci/plugins/workflow/steps/scm/GitStep.java

3 个答案:

答案 0 :(得分:19)

通过浏览问题列表,我自己找到了答案。似乎他们不会改变它; https://issues.jenkins-ci.org/browse/JENKINS-27018

这是建议的解决方案;

checkout scm: [$class: 'GitSCM', userRemoteConfigs: [[url: src]], branches: [[name: 'refs/tags/3.6.1']]], poll: false

答案 1 :(得分:5)

这有效:

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

答案 2 :(得分:0)

noTags: false可以解决问题。

checkout([$class: 'GitSCM', branches: [[name: githash ]],
     doGenerateSubmoduleConfigurations: false, 
     extensions: [[$class: 'CloneOption', 
     depth: 0, 
     noTags: false,