2017-04-03 106 views
0

我是Jenkin的新手,我在Bitbucket中有4个回购说A,B,C,D。 我必须取A,B & C回购,使用gradle build构建它们,这会产生战争。 现在我必须在D \ warsFolder中复制这些战争 我已经创建了Multibranch管道并生成了管道语法,它从git获取A,B & C并构建它们。看起来这Jenkins:从Multibranch管道中复制文物

node { 
    checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'A']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'id', url: 'http://.../A.git']]]) 
    dir('A') { 
     bat 'gradle build -i --info --stacktrace --debug' 
    } 
    checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'B']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'id', url: 'http://.../B.git']]]) 
    dir('B') { 
     bat 'gradle build -i --info --stacktrace --debug' 
    } 
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'C']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'id', url: 'http://.../C.git']]]) 
    dir('C') { 
     bat 'gradle build -i --info --stacktrace --debug' 
    } 

    } 

一些东西加入Jenkinsfile上面的脚本,我放在回购。

现在我已经创建了一个多枝管道Fetch_all和分支的源代码 - >单库&分支 - >库URL我已经加入http://.../A.git(其中有Jenkinsfile)。 高兴在这里一切工作正常我能够获取资源并构建它们。

我已经创建了Freestyle的新工作,在源代码管理 - > Git - > Repository URL将是http://.../D.git。 我试图复制在Fetch_all管道中生成的战争,但在生成 - >从另一个项目复制工件时,项目名称不接受Multibranch管道。它抛出错误,如

ERROR: Unable to find project for artifact copy: 
This may be due to incorrect project name or permission settings; see help for project name in job configuration. 

任何帮助表示赞赏。

回答

1

终于明白了,当我给了pipeline_name/branchname即Fetch_all /%00它工作正常。