使用PR Process为相同/不同回购的分支概括Jenkins管道脚本

时间:2017-09-04 14:56:27

标签: github jenkins jenkins-pipeline

使用Pull Request Notifier为管道作业的位桶插件处理PR过程。感谢here

的精彩报道

它是SCM中提供的常见管道脚本“JenkinsFile”。利用相同的脚本并尝试进一步增强

reshape2

如果Source和Target分支属于相同的Project Key和repo名称,则上述脚本工作正常。即任何功能/错误修复/自定义分支都在同一个URL中。 来自node { stage('Checkout') { def description = "<a href='$PULL_REQUEST_URL'>PR #$PULL_REQUEST_ID</a>" currentBuild.setDescription(description) checkout changelog: true, poll: true, scm: [ $class: 'GitSCM', branches: [ [name: PULL_REQUEST_FROM_HASH ] ], doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'PreBuildMerge', options: [ mergeStrategy: 'MergeCommand.Strategy', fastForwardMode: 'NO_FF', mergeRemote: 'origin', mergeTarget: PULL_REQUEST_TO_BRANCH ] ]], userRemoteConfigs: [[ credentialsId: '232272334-4f2a-47f8-8387-401fc2c5500a', url: 'ssh://git@remoteUrl/develop/entity-web.git' ]] ] } // ... multiple stages of build }

现在,如果PR可以来自不同的项目。即来自Source分支"develop/entity-web(entity-featureName, branch cut from master)" to develop/entity-web(master)。上面的脚本失败了

现在面临的问题是

1)在"develop/entity-web(master)" to "release/entity-web(master)"

中提交

2)从"develop/entity-web(master)"创建公关。

3)PR从Bit桶触发,Jenkins Job通过使用“http://localhost:8080/job/JobName/buildWithParameters?token=TOKEN&cause=PULL_REQUEST&PULL_REQUEST_URL=http://localhost:7990/projects/release/entity-web/pull-requests/1&PULL_REQUEST_ID=1&PULL_REQUEST_TO_BRANCH=master&PULL_REQUEST_FROM_HASH=6d1a252fa28c765846ba5dfc1f819bb0769ce4d9”等参数进行构建触发

4)上面的脚本试图在"develop/entity-web(master)" to "release/entity-web(master)"中找到提交哈希"6d1a252fa28c765846ba5dfc1f819bb0769ce4d9"。但提交在release/entity-web。 所以GIT结账失败了。

  

git rev-parse 6d1a252fa28c765846ba5dfc1f819bb0769ce4d9 ^ {commit} #timetime = 10   git rev-parse origin / 6d1a252fa28c765846ba5dfc1f819bb0769ce4d9 ^ {commit} #timetime = 10   git rev-parse 6d1a252fa28c765846ba5dfc1f819bb0769ce4d9 ^ {commit} #timetime = 10.

与Fork分支掌握相似的问题。

广义脚本中的任何帮助,其中源和目标可以来自相同/不同的repos ??

0 个答案:

没有答案
相关问题