jenkins git:pull tag,re-tag和push

1rhkuytd  于 9个月前  发布在  Jenkins
关注(0)|答案(1)|浏览(120)

在一个jenkins管道中,我试图从一个dev分支中拉取,标记为't_int_dev'。稍后我想拉取标记't_int_dev'并重新标记为't_int_qa'并推送它。
第一部分工作正常:

checkout scmGit( branches: [[name: 'b_dev']], userRemoteConfigs: [[credentialsId: creds, url: repo ]])   

sh("""git pull origin b_dev && 
      git tag -f t_int_dev && 
      git push -f origin t_int_dev""")

字符串
但是后来,当我想拉取dev标签并重新标记为qa时,我在这一行得到一个错误:

checkout scmGit( branches: [[name: 't_int_dev']], userRemoteConfigs: [[credentialsId: creds, url: repo ]])


Jenkins错误:
第一个月
为什么会发生这种情况?

mm5n2pyu

mm5n2pyu1#

尝试使用目标标记的完整ref名称:

branches: [[name: 'refs/tags/t_int_dev']]

字符串
如果你收到一条消息,说这是一个未知的修订版,那么也可以尝试设置一个refspec,它会指示git下载这个标签:

branches: [[name: 'refs/tags/t_int_dev']],
userRemoteConfigs: [
  [credentialsId: creds, url: repo],
  [refspec: '+refs/tags/t_int_dev:refs/tags/t_int_dev']
]


上面的refspec指示只下载特定的t_int_dev标签,你可以使用一个更通用的refspec:

# download all tags:
refspec: '+refs/tags/*:refs/tags/*'

# download all branches and tags:
refspec: '+refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*'

相关问题