通用技术 Google Release Process Practice (Demo by Git, Gerrit and Jenkins)

andward_xu · 2013年10月31日 · 最后由 JennyHui 回复于 2014年09月24日 · 1638 次阅读
本帖已被设为精华帖!

Google use Git P4, Critique and Rapid to maintain project release. We can also use Git, Gerrit and Jenkins to demo the simlar process.

Preparaion

Setup Gerrit

  • Setup Gerrit site.
  • Create 3 remote branch in Gerrit for your project
    • dev branch
    • qa branch
    • master branch(default)

Setup Git

  • Create&connect corresponding for each branch:'git checkout -b dev origin/dev'
  • Create hotfix branch
  • Create new_feature branch

Setup Jenkins

  • Setup Jenkins as CI tool and set general configration

java -jar jenkins.war --httpPort=1234

  • Create build job for each remote branch

    • dev job:daily build
    • qa job:manually build for release
    • master job:manually build for release(by tag)

Branching strategy

All the branches are local branches, make sure the changes in dev/qa/master branches are correct before pushing to corresponding remote branches.

Remote tracking branches

dev: all points record features imlemetations or bug fixes

owner: anyone
rebase/merge changes from features branches or bug fix branches
need code review by Gerrit
submit to remote dev branch by Gerrit

qa: all points record release cut and bug fixes in qa demo

owner: release eng
merge changes in dev branch
cherry-pick dev commits(bug fixes)
don’t need code review, push to remote qa branch
each Jenkins

master: stable code version, push to prod

owner: release eng
merge changes in qa branch
tag only
don’t need code review, push to remote master branch

Other branches

features

personal maintain feature
create personal local branch
rebase/merge changes to dev branch
coorperate implementation feature
create remote branch in Gerrit
create remote tracking branch
merge changes to dev branch

hotfixes branches

owner: release eng
mater bug fix: changes merge to dev branch
qa bug fix: cherry pick changes in dev branch

Release Demo

Cut release
git checkout qa
git merge dev

Submit change to dev:
update code
git pull origin dev
git add <files>
git commit -m ‘new change’ (get commit id)
git push origin HEAD:refs/for/dev
once patch created, run unit test triggered by Jenkins
nightly build dev demo by Jenkins

Cherrypick to release
git checkcout qa
git cherrypick (commit id of bug fixes)
git push origin qa
once change merged in qa, run automation test triggerred by Jenkins
manually build qa demo by the latest merge/cherry-pick

Push to PROD
git checkout master
git merge qa
git push origin master
git tag -a ‘tag1.0’
git push origin tag1.0
manually build prod by the latest tag

共收到 1 条回复 时间 点赞

算是 git 的一个入门教程。

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册