用git做持续集成

先mark一下,准备研究这个。慢慢写。。。。。


一般使用git做CI的基本的work flow是这样的:

1)有可供CI Server使用的repo;

2) 开发push特定的branch到report,通常是master

3)CI Server自动检测到changes然后执行build

4)执行对应的单元测试

5) CI Server给reporsitory打tag并release



github 和git的关系:

git是版本控制系统,和CVS等是一个概念,而github是基于git的网站,用于给用户提供git 服务

关于git和github之间的区别:

   1.What is the difference between Git and GitHub?

      Git is a version control system; think of it as a series of snapshots (commits) of your code. You see a path of these snapshots, in which order they where created. You can make branches to experiment and come back to snapshots you took.
      GitHub, is a web-page on which you can publish your Git repositories and collaborate with other people.
   2.  Is Git saving every repository locally (in the user's machine) and in GitHub?
      No, it's only local. You can decide to push (publish) some branches on GitHub.
   3. Can you use Git without GitHub? If yes, what would be the benefit for using GitHub?

      Yes, Git runs local if you don't use GitHub. An alternative to using GitHub could be running Git on files hosted on Dropbox, but GitHub is a more streamlined service as it was made especially for Git.
   4
          How does Git compare to a backup system such as Time Machine?

      It's a different thing, Git lets you track changes and your development process. If you use Git with GitHub, it becomes effectively a backup. However usually you would not push all the time to GitHub, at which point you do not have a full backup if things go wrong. I use git in a folder that is synchronized with Dropbox.
   5Is this a manual process, in other words if you don't commit you won't have a new version of the changes made?

      Yes, committing and pushing are both manual.

下面讲述安装:

github的安装:

windows环境下载github for windows:

https://windows.github.com/

安装比较简单,一路next之后需要一个github的账号,完成注册即可,注册在网站https://github.com/

你可以选择安装git和也可以选择不安装git,直接用github的GUI

安装完成之后可以创建一个repository然后publish到github上去。

比如我自己创建了一个,在github网站上的链接图片是这样的

安装完成之后还需要安装git

2) 安装Jenkins for windows:

直接在jenkins的官网上下载http://jenkins-ci.org/。 可以下载war包或者下载

Or native package
一路next安装完成

更多使用jenkins的信息可以参考:https://wiki.jenkins-ci.org/display/JENKINS/Use+Jenkins


3)安装git plugin, 通常情况下git plugin可以直接在jenkins的management plugin可以直接安装,但是由于我这边环境有防火墙看不到plugin的东西

所以只能直接在jenkins的官网上下载plugin安装

需要一并安装的plugin包括:

https://wiki.jenkins-ci.org/display/JENKINS/SCM+API+Plugin

https://wiki.jenkins-ci.org/display/JENKINS/Git+Client+Plugin

https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Plugin


安装方法很简单:

Manage Plugins-->advanced-->upload hpi 即可。 建议如果没有防火墙的话可以直接安装 这样可以解决dependency的问题,不然还得自己一个下载

Preparation 
scm-api Success
Preparation 
ssh-credentials ssh-credentials plugin is already installed. Jenkins needs to be restarted for the update to take effect
Preparation 
credentials credentials plugin is already installed. Jenkins needs to be restarted for the update to take effect
Preparation 
git-client Success
Preparation 
git Success

4)安装github plugin,安装方法同上,以及相关依赖。

https://wiki.jenkins-ci.org/display/JENKINS/Multiple+SCMs+Plugin

https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Plugin

https://wiki.jenkins-ci.org/display/JENKINS/GitHub+API+Plugin


5)配置jenkins:配置jenkins的系统设置的git以及jdk的环境。


7)建立build的project并进行相关设置。

主要需要设置scm的git的reporsoty路径以及build的triiger





8)checkin 一个文件到github并同步,然后你能看到最新的变化






  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

惹不起的程咬金

来都来了,不赏点银子么

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值