使用jenkins管道脚本标记git repo

用户1993412

我正在尝试使用Jenkins管道脚本标记git repo。我对jenkins管道脚本非常陌生。

是否有类似下面的命令来标记分支,该命令用于签出分支

git branch: 'master',
  credentialsId: '12345-1234-4696-af25-123455',
  url: 'ssh://[email protected]:company/repo.git'
全编

git命令是checkout步骤简写它只能从仓库中克隆。

如果要执行通用git命令,则需要设置连接凭据。如果是SSH,最简单的方法是使用SSH代理插件对于某些操作,您还将需要配置本地git用户属性。

例:

# configure git
sh '''
  git config --global user.email '[email protected]'
  git config --global user.name 'This Is Me'
  git tag this-very-version
'''

# enable remote connection
sshagent (credentials: ['your-credentials-to-bitbucket']) {
  sh 'git push origin this-very-version'
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章