Page tree

Have questions? Stuck? Please check our FAQ for some common questions and answers.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The ONOS source code is stored at gerrit.onosproject.org. Setting up git and gerrit will allow you to easily fetch and test any version of ONOS, including releases, development versions, and patches that have been submitted for review. Setting up a gerrit account will also enable you to submit your own patches to ONOS and also to participate in the ONOS code review process.

Getting the ONOS source code with git

Make sure you've installed git, and then create a local clone of the source repository:

$ git clone https://gerrit.onosproject.org/onos

Git remotes

There are two ways to clone the code from Gerrit, https:// or ssh://. Either way is fine for reading the code, but when it comes time to contribute the easiest and most secure way is to access Gerrit over SSH.

To make sure you're using the ssh:// remote, first check the URLs of the remotes in your ONOS repository:

$ cd onos
$ git remote -v
origin  https://gerrit.onosproject.org/onos (fetch)
origin  https://gerrit.onosproject.org/onos (push)

If you see ssh:// URLs, everything is fine and you can move on to the next step (Source code access via git and gerrit). If you see https:// URLs, you should change them to ssh:// before continuing:

$ git remote set-url origin ssh://<username>@gerrit.onosproject.org:29418/onos

Substitute <username> with your Gerrit/Crowd username (the <username> must be specifically provisioned in Gerrit Profile for git)

You can double-check the URL on Gerrit by logging in, going to Projects -> List, then clicking on 'onos', On the grey bar, click 'SSH', then just underneath the grey bar will appear 'git clone ssh://...'. This is the URL you should set your remote to in your local git repository.

Configuring Gerrit

Ensure <username> is configured in Settings->Profile->Username; the Username is not populated for new accounts by default.

Prospective contributors should configure their account to receive notifications about their code submissions. The Settings page is accessed from the user dropdown on the upper right of the page:

To configure contacts by going to Contact Information, and filling out the fields, and hitting Save Changes :

To subscribe to the project, go to Watched Projects and enter onos-next in the Project Name field of the page. Hitting return should add onos-next to a table under the search field:

As shown above, email notifications are also configured from here by checking off the types of notifications to receive. 

Uploading SSH Public Keys

An SSH key should also be uploaded to the ONOS Gerrit server.

  1. Generate a key. Keep the default file name and location. This will generate an id_rsa and id_rsa.pub file in ~/.ssh:

    $ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/onosuser/.ssh/id_rsa): 
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /home/onosuser/.ssh/id_rsa.
    Your public key has been saved in /home/onosuser/.ssh/id_rsa.pub.
    
    ...
    $ ls ~/.ssh
    id_rsa  id_rsa.pub  known_hosts


  2. Upload the SSH public key. After logging into the Gerrit account, go to Settings > SSH Public Keys. Paste the contents of id_rsa.pub into the "Add SSH Public Key" box and hit Add:

 

 

 

 

 

 

 

 

 

 

 

 

 

A key must be uploaded per host if checking code out to multiple hosts with git.

Configuring git

Developers planning to contribute code should configure git with their username and email.

git config --global user.name "firstname lastname"
git config --global user.email "email@domain.com"

To streamline the code review process, it is highly recommended that contributors set up git-review, which integrates code submission with git. Refer to this link for instructions for setting up git-review.

git-review + Mac

If you're using a Mac, you may need to manually upgrade the git-review package dependency. (git-review bug#1337701)

$ sudo pip install --upgrade setuptools
$ sudo pip install --upgrade git-review

  • No labels