Review process for OpenStack commit code

Source: Internet
Author: User

This article organizes the basic process of submitting code to the OpenStack community, as well as some information about the community. If there is reprint, please indicate the source!

Let's take a picture to illustrate the general flow of OpenStack code review:

The process for submitting code changes to OpenStack is mainly as follows:

    • Configuring Git and Gerrit Environments
    • Clone the code of the target project and make changes on the new branch
    • Commit to a local repo and push it to the remote Gerrit, then the reviewer gives an opinion
    • Update patches According to reviewer's comments

OpenStack uses Gerrit as the Code review system, which uses the Jenkins system to test the code automatically, using the Tox tool to test the same code locally.

Basic premise

    1. Create a Launchpad account (Gerrit use Launchpad for SSO)
    2. Login Gerrit, complete the basic configuration
    3. Join the OpenStack Foundation
    4. Signed Contributor License Agreement
    5. Install Git and git review

  All of this work is done on Ubuntu Server 14.04 LTS

Configure Git

  Start by configuring the GIT command line tool for future operations

' YourName '  ----global gitreview.username YourName

If you need to see the configuration of Git:

$ gir config--list

Installation configuration Git-review

1. The Git-review tool is a set of git subcommands used primarily to interact with OpenStack 's Code review system Gerrit ,Git-review The interaction with Gerrit is a set of git commands that, after each git review command, add the- v option to print all running git commands.

sudo Install Git-review

2. generate an SSH key on the machine where you want to submit the code:

Ssh-keygen –t RSA 

If you set a password when you create the RSA key, the password needs to be kept properly, because the password needs to be validated for each subsequent commit.

3. Review the Public key section and copy it to Git-review:

 less ~/. ssh/id_rsa.pub

Add the contents of the public key part to the Git-review .

Cloning a code base locally

    1. Clone source
$ git clone https://github.com/openstack/yourtargetprojectname.git

    1. Go to the directory after cloning
Yourtargetprojectname

    1. Build a git review environment
$ git review-for for--global--add Gitreview.username yourgerritusername

    1. You can set the Gerrit/launchpad user name in Git,
$ git config--global--add gitreview.username YourName

    1. Check out to the Master Branch, update the remote and pull it to the local master branch
$ git checkout master; git remote update; Git pull Origin Master

6. report A new bug on Launchpad , or find a bug that has not been resolved and then Assign to yourself, change the state of the bug to in progress, and OpenStack uses Launchpad to record blueprints and report bugs.

  7. To fix a bug, you must create a new branch and then modify the source code in this branch, for example:

$ git checkout-b fix-bug-#123456

    1. The above command creates and switches to the new branch "fix-bug-#123456", and all the local work is done in this branch until all fixation are completed and then commit.
$ git commit-a

A commit message is required when committing , anda commit message can have the following fields:

Implements:blueprint Blueprint

Closes-bug: #123456

Partial-bug: #123456

Related-bug: #123456

Use these fields to identify your own work-related bugs or blueprint, and once noted, theCI system will automatically match your commit to the bug with the same ID .

    1. After the above command is submitted to the local repo , the next step is push to Gerrit .
$ git review-v

  gerrit is OpenStack remote git The warehouse of a door, all submissionreview can be mergemaster branch, so the previous work must not be in the master branch, which will produce a Merge Commit,gerrit default is not accept merge Commit

If the submission succeeds,Gerrit will return a URL that shows you the submission, open it to review the commit and reviewer 's comments: http://review.openstack.org/nnnnnn

What if I need to modify a commit ?

You need to find your patch record on HTTP./review.openstack.org , and then note The review number of this patch , which is review.openstack.org The following number of patch pages:https://review.openstack.org/#/c/nnnnnn/

$ cd Ourtargetprojectname     -D nnnnnn        #把patch给check out, then you can edit the

Then re-edit the patch according to reviewer's comments and submit

$ git commit-a--Amend    #在本地commit $ git review

  The last commit was modified, or the commit message did not write the standard, you can resubmit the commit, but be sure to switch to the last commit you committed Branch to execute the above command. If you want to see the full git command stream, you can add the- v option after the git Review command .

 --Geneva- on  A: -:50.927128Running:git Log--color=never--oneline head^1.. HEAD --Geneva- on  A: -:50.930189running:git Remote --Geneva- on  A: -:50.932609Running:git branch-a--color=never --Geneva- on  A: -:50.935309Running:git Rev-parse--show-toplevel--git-dir --Geneva- on  A: -:50.937601running:git Remote Update gerritfetching Gerrit --Geneva- on  A: -:04.406800Running:git rebase-i remotes/gerrit/Master --Geneva- on  A: -:04.507110Running:git Reset--Hard Orig_head --Geneva- on  A: -:04.514952Running:git config--Get Color.ui --Geneva- on  A: -:04.517383Running:git log--color=always--decorate--oneline HEAD--not remotes/gerrit/master-- --Geneva- on  A: -:04.523654Running:git Branch--color=never --Geneva- on  A: -:04.526527Running:git Log head^1.. Headusing Local branch name"fix-bug-123456"  forThe topic of the change submitted --Geneva- on  A: -:04.530764Running:git Push Gerrit head:refs/publish/master/fix-bug-123456remote:processing changes:updated:1, Refs:1, DoneRemote: (W) 81a1233:commit subject> $characters; use shorter first paragraphremote: (W) 81a1233:no files changed, message updatedtoSSH://[Email Protected]:29418/openstack/targetproject.git* [New Branch] HEAD--refs/publish/master/fix-bug-123456 --Geneva- on  A: -:11.126958Running:git Rev-parse--show-toplevel--git-dir

Some troubleshoot,

If you 're having trouble configuring Git or Gerrit ,https://wiki.openstack.org/wiki/Documentation/HowTo/ Firsttimers at the end of the troubleshoot provides a common problem , can be consulted.

OpenStack's commit message style,

Here is a description of the style of commit message for each commit: Https://wiki.openstack.org/wiki/GitCommitMessages

OpenStack's bug diversion,

Here is an introduction to the various degrees of bug diversion by OpenStack: https://wiki.openstack.org/wiki/BugTriage

OpenStack Bug Classification,

Opnestack classification of bugs based on status, importance, etc.: Https://wiki.openstack.org/wiki/Bugs

OpenStack's blueprints,

Wiki Description: Https://wiki.openstack.org/wiki/Blueprints

OpenStack Project on Launchpad home: Https://blueprints.launchpad.net/openstack

The spec for all OpenStack projects,

Specifications records the design specifications for each project, which is the specs:http://specs.openstack.org/of all projects.

The release cycle of OpenStack,

Here are some introductions to the release cycle, https://wiki.openstack.org/wiki/ReleaseCycle

Branch tar package for all OpenStack projects: http://tarballs.openstack.org/

OpenStack Code branching model,

Here is an introduction to the code branching model, Https://wiki.openstack.org/wiki/Branch_Model

Review process for OpenStack commit code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.