[英]Trigger jenkins build on stash pull request
我一直在努力按照常规指南在PR上进行构建。 但是我遇到了一些问题。
这是我添加到先前存在的配置@ Jenkins项目中的内容:
Source Code Management:
Multiple SCMs
- Repository URL: ssh://git@git.company.pt/projectCode/RepName.git
- Credentials with ssh key working
- Batches to build: */${sourceBranch}
- Repository browser: auto
- Additional Behaviours: none
Build triggers:
- Poll SCM
以及之前的工作构建和构建后操作
在存储方面,没有太多要配置的内容。 这是现有配置及其测试结果的ss @ Settings-> Hooks-> Stash WebHook到Jenkins:
如您在屏幕快照中所见,此配置的测试有效,并且能够正确地向Jenkins发送消息。 Jenkins收到以下日志消息:
Started on Apr 29, 2015 8:01:23 AM
Polling SCM changes on master
Using strategy: Default
using GIT_SSH to set credentials
> git --version # timeout=10
> git -c core.askpass=true ls-remote -h ssh://git@git.fraunhofer.pt/glp/golivephone.git # timeout=10
Done. Took 0.18 sec
No changes
是的,我什么都没改变! 问题是当我转到实际分支并单击“触发器生成”时。 Git轮询日志保持不变,并且没有消息发送到Jenkins。 我是否缺少某些配置步骤@隐藏或在分支创建中? 我不认为这与jenkins构建有关,因为当我触发构建时,我什至没有收到Pooling日志消息。 即使是调试想法也很容易发现问题所在。
编辑:
触发构建时触发的网络活动:请求
Remote Address:10.211.8.19:443
URL:https://stash.fraunhofer.pt/rest/jenkins/latest/projects/projectCode/repos/repName/triggerJenkins?branch=bugfix/GLP-702-about-screen-doesn-t-update-on-subscription&sha1=cd49ac1be47e89ecc4f02c1d3867d54e2b2ff78a
Request Method:POST
Status Code:204 No Content
---PAYLOAD---
none
---Query String parameter---
branch:bugfix/GLP-702-about-screen-doesn-t-update-on-subscription
sha1:cd49ac1be47e89ecc4f02c1d3867d54e2b2ff78a
与测试一相比:
Remote Address:10.211.8.19:443
Request URL:https://stash.fraunhofer.pt/rest/jenkins/latest/projects/projectCode/repos/repName/test
Request Method:POST
Status Code:200 OK
---PAYLOAD---
{jenkinsBase: ["http://i-255.cloud.fraunhofer.pt:8080/"],…}
gitRepoUrl: ["ssh://git@git.fraunhofer.pt/glp/golivephone.git"]
0: "ssh://git@git.fraunhofer.pt/glp/golivephone.git"
ignoreCerts: ["TRUE"]
0: "TRUE"
jenkinsBase: ["http://i-255.cloud.fraunhofer.pt:8080/"]
0: "http://i-255.cloud.fraunhofer.pt:8080/"
omitHashCode: ["TRUE"]
0: "TRUE"
---Query String parameter---
none
您可以看看https://christiangalsterer.wordpress.com/2015/04/23/continuous-integration-for-pull-requests-with-jenkins-and-stash/ ,其中我描述了如何设置Jenkins的详细步骤和Stash在创建或更新拉取请求时自动触发正确的Jenkins构建。
它使用Jenkins Git插件和用于存储的附加请求通知程序加载项,并使用Jenkins Git插件的通知功能选择正确的构建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.