Skip to end of metadata
Go to start of metadata


  • NEVER embed jar, war, tar, gz, gzip, zip in Gerrit


Gerrit is an Open Source web-based collaborative Code Review tool that integrates with Git.
For all ONAP projects, Gerrit is available at and documentation at 
Gerrit offers an extensive search capability by using a query syntax documented at 
To get started, you can watch this 14 minutes video that was done for OPNFV project.

To understand deeper Gerrit UI, this is a good source of info 
Log into Gerrit using your Linux Foundation ID (LFID).

Anyone who has a valid Linux Foundation ID can submit code as a contributor. You simply need to login into Gerrit using your Linux Foundation ID.
The committer role requires specific permissions per project setup by Linux Foundation. Do not contact directly Linux Foundation's Help Desk to ask for Committer privileges but rather work with the Release Manager who will make it happen through the TSC.

Project committers group are setup in the form of onap-gerrit-${PROJECT}-committers. Connect to to see which group you are part of.
Committers are nominated according to Configuring Gerrit.


Whatever OS your are using (Mac, Linux, PC) the following tools must be installed and configured:

  1. git client : to perform all the Git task (clone, pull, branch, checkout,...) 
  2. git-review : to submit your code into Gerrit
  3. SSH client : to connect securely to Gerrit server


Most users use SSH to authenticate with remote servers. To perform such authentication with Gerrit, your have to provide your SSH Public key to Gerrit (User Account->Settings->SSH Public keys).
In case you can't use SSH (because network do not allow SSH on port 29418), you can use HTTPS.

HTTP Workaround for Gerrit inside a Corporate firewall/proxy blocking SSH

A couple of other things specific to Gerrit

  • Gerrit does not allow you push directly to your branch. If you're not using the git-review plugin then to push a change against your branch it will be as follows:
Pushing Code into Gerrit
git push origin HEAD:refs/for/$BRANCH

in this case $BRANCH == master
  • Your change will go to Gerrit to be reviewed. It will not be merged onto the branch until someone with committer rights gives it a Code-Review +2. Normally there are verification jobs setup in Jenkins that would vote on the Verified field, but as your project(s) don't just yet (oparent being the exception as they pushed a verify job this afternoon) a committer will also have to flag Verified +1. Once both fields are at max value, then a committer will have the ability to Submit the code. It will not be merged until the final Submit has occurred.

Once the code is submitted, Gerrit moves the code from the Open tab to the Merged tabs

  • Your code import cannot be a historical import. That is, you can't be bringing history from an external SCM tool into a Gerrit repo under Linux Foundation control. This is a policy Linux Foundation had in place for a very long time and is non-negotiable. This means your import will be a squash commit of any code coming in.

HTTP Sequence of events

In this case you need to have Gerrit generating a password for you (User Account->Settings->HTTPS Password->Generate Password).

--[cut using https syntax]--
export REPO=common-services-external-system-registration
git clone https://${LFID}${REPO}.git
cd ${REPO}
# acquire the commit hook
curl -Lo ./.git/hooks/commit-msg
chmod +x ./.git/hooks/commit-msg
# create your code commit
cp ${codeblob} ./
git add .
git commit -asm 'Initial code import'
git push origin HEAD:refs/for/master
--[/cut using https syntax]--

A couple of things to note here:

The URL will be /r/a/${REPO}.git (the .git is optional) /r == the web url that Gerrit lives on. 
/a == authenticated https. 
Without /a it will try to do an anonymous http connection and it will fail for pushes, at least when we open the repos to public access.

The commit has a -s which gives you the 'Signed-off-by: Name <email>' footer in your commit message. Your 'Name <email>' portion must match what Gerrit has registered. And it's case sensitive.

If you do not have the Gerrit commit hook installed you'll get an error when you push telling you how to get it. Once you've obtained it you'll want to run the following operation before trying to push again:

git commit --amend

Just resave your commit message. After you do that if you do a 'git log' you should notice that a 'Change-Id:' line was added above your 'Signed-off-by' footer. This Change-Id is required by Gerrit.

SSH Sequence of events

--[cut using ssh syntax]--
export REPO=common-services-external-system-registration
git clone ssh://${LFID}${REPO}.git
cd ${REPO}
# acquire the commit hook
curl -Lo .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg
# creat your code commit
cp ${codeblob} ./
git add .
git commit -asm 'Initial code import'
git push origin HEAD:refs/for/master
--[/cut using ssh syntax]--

You'll note that this is essentially the same. The primary difference is that you won't be getting prompted for a password as it only operates with SSH keys.

Speaking of passwords. The HTTPS method does not use your LFID password, you need to have Gerrit generate one for you: Login -> select your name in the right corner -> Settings -> HTTP Password -> Generate Password


In order to avoid delay into merging the code, it is expected that committer do review the code within the next 36 business hours after the contributor has submitted his code.
There are 2 ways for a Committer to be notified by email on the code to review:

  1. the contributor specifically enter the committer name in the submission form.
  2. the contributor updates his Gerrit's settings to Watch his projects.

Things to keep in your radar

Merge Conflict

It may happen that you cannot merge into the upper branch. Gerrit will render this behavior by indicating in the Status column the message Merge Conflict.
You can also run the following query to display all the submissions in status Merge Conflict.

To address the Merge Conflict issue 3 solution scenarios are possible:

  1. A change that has already been merged is in conflict with the current change, try to rebase the change. If that doesn't resolve the issue then try the next solution.
  2. A simple rebase can't fix the problem because it is fundamentally unsolvable without making actual changes to the submission. The solution to this sort of error is to try to do the merge locally and find out what the actual problem is and then re-submit an update.
  3. Abandoning and bringing in a new patch. This is of a last resort because you can't figure out what the real problem is.

Jenkins Intermittent Failure

For some yet unknown reason it may happen that Jenkins have intermittent failure and thus impact your build.
Look for typical message:

[ssh-agent] FATAL: Could not find a suitable ssh-agent provider
[ssh-agent] Diagnostic report
[ssh-agent]  Java/JNR ssh-agent
[ssh-agent] hudson.remoting.RequestAbortedException: Unexpected termination of the channel
FATAL: [ssh-agent] Unable to start agent
hudson.util.IOException2: [ssh-agent] Unable to start agent
Finished: FAILURE

To address the issue just hit the reply button in Gerrit add keyword 'recheck' or 'reverify' (do not enter the ') to the submission that failed. This will automatically retrigger the verify job.
If the job was a merge job, then use the 'remerge' keyword. It will automatically retrigger the merge job.

Submitting a draft feature

As part of the Development Best Practices, it is suggested to commit code multiple times a day. One may argue on the value of submitting code multiple a day if the code you are submitting does not bring value (working functionality) to the community. Developing a complete feature may takes days or weeks and until it is complete it does not bring value. Consider submitting unfinished code is an opportunity to show work in progress and get early feedback. However, as we do not want to break the CI paradigm of "Don't break the Build" by submitting unfinished work, Gerrit has a way to show work in progress by using the "Draft Feature" capability.

We are making the assumption that developers are working in a feature branch (named story-1 for the sake of the example)

To submit draft code in Gerrit, from a feature local branch, enter from your terminal the following:

git review -D

The name of the local branch (story-1) is used by Gerrit to set the topic.

You can perform the above command as often as you need until the developer has not completed his work. The CI build system is automatically triggered.

These commits CAN'T be +2 and merge in Master.

Once a developer has finished developing the functionality and need all these commits to be merged into Master, the developer will need to use the Gerrit UI and click for each commit the "Publish" button. The committers will then have 36 business hours to complete the review and merge the code into Master branch.

This Gerrit screenshoot illustrates 2 "Draft Feature" of topic: story-1 

Branch Topic


  1. The http syntax example has an incorrect path.  Refers to "./git/..." rather than ".git/...".

  2. This sentence:

    "In such case you need to have Gerrit generating a password for you (User Account->Settings->HTTPS Password->Generate Password)."

    needs to be in the section labeled "HTTP Sequence of Events" instead of an aside under the "SSH" section.

    And, the URL to set that passwd is:  

  3. Thanks Dominic Lunanuova for your suggestions. I have made the changes.

    One thing you may not know is that the wiki is public, meaning you can edit and make changes by yourself for the benefit of whole community.

  4. Please explain the exact sequence of steps to download a branch that's in review, add a change, and continue the review process in Gerrit.  I believe this begins with "git review -d NNN" where NNN is the change number shown in Gerrit.  That first step works fine, yielding a branch named for the original submitter, but have not figured out the next steps, all my attempts are rejected by Gerrit; e.g., "you are not allowed to upload merges". Thanks in advance.

  5. What is the gerrit process for a group of developers to collaborate on a feature without destabilizing the master branch?

    Does ONAP gerrit have a processes for this?

    As a team we want to share our code with each other as we developer our feature.  Normally we would do this by creating a feature branch; however my understanding is that we are not allowed to create feature branch. 

    1. We got something working using “git review –D –topic JIRA-STORY-ID”

      For the first submission in a repo 

      git commit -sam "blah blah blah"
      git review –D –topic JIRA-STORY-ID

      Any developer can check out the changes,  amends the tip change, then pushes back to gerrit

      git fetch refs/changes/67/chang-id/6 && git checkout FETCH_HEAD
      git add .
      git commit --amend
      git review –D –topic JIRA-STORY-ID

      The fetch URL can be constructed on the draft review website. There you will find  Download tab on the right side.  Click on it and it will show you the checkout command for the review.    

      Ideally the git review –d JIRA-STORY-ID should work instead of get fetch; however I get 404 

      Other developers can find the review by searching for the topic.  Just place "topic:JIRA-STORY-ID"  in the gerrit website search box.  

  6. What happens when two people both try to amend the same commit and push to git review at about the same time?