我用詹金斯创建了一个名为NetLab的管道项目。 我有多个分支,并且在扫描远程GitHub存储库后,我发现Jenkins为它们创建了不同的目录:
vagrant@vagrant:~$ ll /var/lib/jenkins/workspace/
total 36
drwxr-xr-x 8 jenkins jenkins 4096 Dec 11 18:44 ./
drwxr-xr-x 21 jenkins jenkins 4096 Dec 14 11:56 ../
drwxr-xr-x 8 jenkins jenkins 4096 Dec 11 19:14 NetLab_jenkinsbranch/
drwxr-xr-x 2 jenkins jenkins 4096 Dec 14 10:59 'NetLab_jenkinsbranch@tmp'/
drwxr-xr-x 8 jenkins jenkins 4096 Dec 11 18:50 NetLab_master/
drwxr-xr-x 2 jenkins jenkins 4096 Dec 11 18:30 'NetLab_master@tmp'/
-rw-r--r-- 1 jenkins jenkins 70 Dec 11 18:43 workspaces.txt
我有多个阶段,我想执行以下操作:
由于在Jenkins工作空间下存在用于主分支和非主分支的单独文件夹,所以我陷入了Step3的困境,我不能只切换到master分支并将我的分支合并到master。我该怎么办?
vagrant@vagrant:~$ ll /var/lib/jenkins/workspace/
total 36
drwxr-xr-x 8 jenkins jenkins 4096 Dec 11 18:44 ./
drwxr-xr-x 21 jenkins jenkins 4096 Dec 14 11:56 ../
drwxr-xr-x 8 jenkins jenkins 4096 Dec 11 19:14 NetLab_jenkinsbranch/
drwxr-xr-x 2 jenkins jenkins 4096 Dec 14 10:59 'NetLab_jenkinsbranch@tmp'/
drwxr-xr-x 8 jenkins jenkins 4096 Dec 11 18:50 NetLab_master/
drwxr-xr-x 2 jenkins jenkins 4096 Dec 11 18:30 'NetLab_master@tmp'/
-rw-r--r-- 1 jenkins jenkins 70 Dec 11 18:43 workspaces.txt
vagrant@vagrant:/var/lib/jenkins/workspace$ git status
fatal: not a git repository (or any of the parent directories): .git
vagrant@vagrant:/var/lib/jenkins/workspace$ cd NetLab_jenkinsbranch
vagrant@vagrant:/var/lib/jenkins/workspace/NetLab_jenkinsbranch$ git status
HEAD detached at 82b6b0b
vagrant@vagrant:/var/lib/jenkins/workspace/NetLab_jenkinsbranch$ git branch
* (HEAD detached at 82b6b0b)
vagrant@vagrant:/var/lib/jenkins/workspace/NetLab_jenkinsbranch$ cd ../NetLab_master
NetLab_master/ NetLab_master@tmp/
vagrant@vagrant:/var/lib/jenkins/workspace/NetLab_jenkinsbranch$ cd ../NetLab_master
vagrant@vagrant:/var/lib/jenkins/workspace/NetLab_master$ git status
HEAD detached at afb5310
nothing to commit, working tree clean
vagrant@vagrant:/var/lib/jenkins/workspace/NetLab_master$ git merge NetLab_jenkinsbranch
merge: NetLab_jenkinsbranch - not something we can merge