简体   繁体   English

詹金斯(Jenkins)多分支管道的建立神秘地将本地回购的起源

[英]Jenkins multibranch pipeline build mysteriously setting origin to local repo

I'm using Jenkins to perform a multi-branch pipeline build using a github repo, this my checkout stage, contains a single line: checkout scm 我正在使用Jenkins使用github存储库执行多分支管道构建,这是我的checkout阶段,其中包含一行:checkout scm

However, when I instigate builds on any of the branches other than master, I get the following: 但是,当我在master以外的任何分支上构建时,都会得到以下信息:

[Pipeline] {
[Pipeline] stage
[Pipeline] { (git checkout)
[Pipeline] git
 > git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url file:///C:/Projects/Demo 
# timeout=10
Fetching upstream changes from file:///C:/Projects/Demo

Its almost as if my repo on GitHub things that its origin is on my laptop, can someone advise as to what is awry here ? 这几乎就像我在GitHub上的仓库中的东西一样,它的起源在我的笔记本电脑上,有人可以建议这里有什么问题吗?

I eventually figured this out, the answer is in two parts, firstly the "Critical section" that is wrapped by the lock command needs to be present in the Jenkinsfile associated with each branch: 我最终弄清楚了,答案分为两部分,首先,与每个分支相关联的Jenkinsfile中必须存在由lock命令包装的“关键部分”:

stage('start container') {
        steps {
            RemoveContainer()
            timeout(time: 20, unit: 'SECONDS') {
                lock ('create SQL Server container') {
                    StartContainer()
                }
            }
        }
    }

and secondly, the commands to get the next available port and spin-up the container need to be in the same method that is wrapped by lock. 其次,获取下一个可用端口并旋转容器的命令必须采用与锁包装相同的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM