jenkins使用Git为源码管理(windows master && linux slave)

来源:互联网 发布:js onclick 参数 this 编辑:程序博客网 时间:2024/05/23 13:20

作为一个不太经常总结的人,工作以来碰到过太多问题!往往解决之后没有有效记录,导致再次碰到需要重新查资料解决。现在改变下习惯,努力搞的了技术。


公司最近提倡开源(以前啥都机密,即使开源也没改变多少),代码从SVN迁移至Git管理,这样导致原来记录项目日志的wiki持续集成job需要重新配置。之前的设置为:每分钟检查SVN变化,有变化就执行编译发布。改为Git后,碰到坑坑洼洼,一并列在下面。


  1. jenkins的Git插件安装

git plugin,git client plugin,github plugin,往往安装的时候会把关联依赖的一遍进行安装。


2. Windows Master && Linux Slave中Git的配置

windows上安装git,很简单;linux上安装git,“很简单”。但是git problems for windows master and linux slave == 头大!

2.1 

Cannot run program "C:\Program Files (x86)\Git\bin" (in directory "/home/jenkins/workspace/Wiki_Git")

这个问题很初级,在jenkins的系统配置中把Git的配置改为

wKioL1YY4XfjIIpSAADCe4tii10123.jpg

这样方便在windows和linux中通用


2.2 

ERROR: Error fetching remote repo 'origin'hudson.plugins.git.GitException: Failed to fetch from http://source.jd.com/app/im4.1-wiki.gitat hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:763)at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1012)at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)at hudson.scm.SCM.checkout(SCM.java:484)at hudson.model.AbstractProject.checkout(AbstractProject.java:1259)at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:622)at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:528)at hudson.model.Run.execute(Run.java:1759)at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)at hudson.model.ResourceController.execute(ResourceController.java:89)at hudson.model.Executor.run(Executor.java:240)Caused by: hudson.plugins.git.GitException: Command "/usr/libexec/git-core/git config --local credential.username guoweiwei" returned status code 129:stdout: stderr: error: unknown option `local'usage: git config [options]


linux中安装的git版本过低,需要升级版本


2.3

fatal: Unable to find remote helper for 'http'

升级版本之后,原因为编译时,libcurl未安装等,具体步骤如下:

a. 下载需要安装的git版本

b. 解压缩

c. yum install libcurl-devel

d. yum install perl-ExtUtils-MakeMaker package(Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.)

e. yum install tk zlib-devel openssl-devel perl cpio expat-devel gettext-devel(MSGFMT po/de.msg make[1]: *** [po/de.msg] Error 127)  

f. ./configer --with-curl --with-expat

g. make && make install


2.4

Git Polling Log提示“FATAL: hudson.plugins.git.GitException: Error performing command: C:\Windows\TEMP\hudson11232435”,且无法检测到git更新进行自动构建

wKiom1YY5jCxB3dHAAHFOC0btXo179.jpg

0 0
原创粉丝点击