Git Jenkins-如何在脚本管道声明式中跳过git fetch标签?

时间:2018-10-03 21:12:54

标签: git jenkins

我在Jenkins的管道中遇到问题,当我的代码从Bitbucket克隆时,执行此行需要很多时间:

  

git fetch --tags --progress git@bitbucket.org:team / empresas.git + refs / heads / :refs / remotes / origin /

我的管道执行此阶段:

stage('checkout git') {
    steps {
        git branch: branch, credentialsId: 'develop214', url: scmUrl
    }
}

詹金斯在执行我的舞台时执行所有这些任务:

 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@bitbucket.org:fisateam/empresas.git # timeout=10
Fetching upstream changes from git@bitbucket.org:team/empresas.git
 > git --version # timeout=10
 > git fetch --tags --progress git@bitbucket.org:team/empresas.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/develop^{commit} # timeout=10
Checking out Revision f87a5d7586308093e4ab22fbace8c9f817316c29 (refs/remotes/origin/develop)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f f87a5d7586308093e4ab22fbace8c9f817316c29
 > git branch -a -v --no-abbrev # timeout=10
 > git branch -D develop # timeout=10
 > git checkout -b develop f87a5d7586308093e4ab22fbace8c9f817316c29
Commit message: "Merge remote-tracking branch 'origin/develop' into develop"
 > git rev-list --no-walk f87a5d7586308093e4ab22fbace8c9f817316c29 # timeout=10

有什么配置可以避免在管道脚本中以编程方式执行“ git fetch --tags”吗?

1 个答案:

答案 0 :(得分:1)

最后,我们发现了Jenkins执行流水线极慢的问题,这是由于我们在防火墙中进行了一些更改而触发的,它激起了与bitbucket的连接,仅在服务器这一段会太慢。