Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update How to commit code section

...

Project NameProject Descriptionhas code
ccsdk/dashboardOpeations Manager Dashboard(tick)
ccsdk/distributionCCSDK distribution packaging (e.g. docker containers)(minus)
ccsdk/parentParent POMs to be used by CCSDK clients(minus)
ccsdk/platform/blueprintsBlueprints. not in Amesterdam release(minus)
 ccsdk/platform/nbapiNorthbound API(tick)
 ccsdk/platform/pluginsPlatform plugins(tick)
 ccsdk/sli/adaptorsCommon adaptors for use by directed graphs(tick)
ccsdk/sli/coreCore Service Logic Interpreter classes(tick)
 ccsdk/sli/northboundCommon northbound APIS related to service logic interpreter(tick)
 ccsdk/sli/pluginsCommon plugins used by direcged graphs (tick) python
ccsdk/storage/esaasElastic Storage as a Service.  not in Amesterdam release(minus)
ccsdk/storage/pgaasPGAAS (PostgreSQL as a Service)(tick) java, python, bash
ccsdk/utilsUtilities(tick) bash, yaml


Anchor
Get git clone

...

command from ONAP gerrit

...

Get git clone command from ONAP gerrit
Get git clone

...

Command From ONAP gerrit

Use your linux foundation account to login onto ONAP projects.

...

coming soon

How to Commit Code

Install git-review

To commit code to ONAP, you must have git-review installed.

The steps in this section only need to be done one time, except the Tips (smile)

On Linux

run the following command to check if git-review is installed as part of your OS image.

git-review 

If not the following command to install the git-review.

sudo apt install git-review

here's an example:

Info
iconfalse
titleinstall git-review on Linux

ubuntu@beili-ws-01:~/Videos$ git-review

The program 'git-review' is currently not installed. You can install it by typing:

sudo apt install git-review

ubuntu@beili-ws-01:~/Videos$ sudo apt install git-review


On Windows

must have git installed

If you do not have git installed, following Install Git on Windows at atlassian's tutorials for installing git to

  • download the Git for Windows installer
  • start installer and follow Git Setup wizard screen Next until Finish prompts to complete the installation.

must have python installed

If you do not have python installed, following Python & pip Windows installation to

install git-review using pip

Open a git bash terminal by

  • going to the bin directory under your git installed directory (for example, C:\Program Files\Git\bin directory ),
  • run bash.exe

In the git bash terminal, run the following command to install git-review

c:/Python27/Scripts/pip2.7 install git_review --proxy <your proxy>


Set Git Remote Gerrit

Check your git remote setting, use the following command

git remote -v

Here's an example of output:

Info
iconfalse
titlegit remote output

C:\workspace\onap_sdnc\northbound>git remote -v
gerrit http://beiliz@gerrit.onap.org/r/a/sdnc/northbound (fetch)
gerrit http://beiliz@gerrit.onap.org/r/a/sdnc/northbound (push)
origin http://beiliz@gerrit.onap.org/r/a/sdnc/northbound (fetch)
origin http://beiliz@gerrit.onap.org/r/a/sdnc/northbound (push)


If the gerrit does not exist, you need to set it up with the following command:

git remote add gerrit <the link of the origin>

Note: the remote origin is added automatically after git clone of the repo. The gerrit link is the same as the origin's, hence, we just directly use it.

Set Git Config

Use the following command to check your git config:

git config -l

Ensure that you have the following configuraiton set properly:

GIT Config KeyExpected ValueSetting Command
core.eollfgit config --global core.eol lf

core.autocrlf

truegit config --global core.autocrlf true
user.nameyour namegit config --global user.name <your name>
user.emailyour email addressgit config --global user.email <your email address>


Anchor
Create A Review
Create A Review
Create A Review

Checkout the master branch, work on your changes, once you are ready for submission, do the following to create a review.

  1. Ensure your workspace is clean and up-to-date

Use the following command to check all the changes in the master branch

git status

Ensure

      • your branch is up-to-date with the origin/master
        • do a git pull to get the latest master code
      • all the changed files are the ones you wanted to submit.
        • remove any un-wanted files

2. Run the following commands in the listed order to create a review

StepsCommandNotes
1git commit -sam <comment summary>Commit summary should not exceed 50 char. See ONAP Commit Messages for more details.
2git log --shortstat

To ensure change lines are properly done and your commit has the following:

    • Change-Id
    • Signed-off-by

Here's an example:

Info
iconfalse
titlegit log --shortstat

C:\workspace\onap_sdnc\northbound>git log --shortstat
commit 4728eada855f9162030f5b46a2513e3dbffa757c
Author: beili.zhou <beili.zhou@amdocs.com>
Date: Fri Oct 13 19:19:11 2017 -0400

Sonar coverage vnfapi -VNFSDNSvcLogicServiceClient

Add Junit test case for VNFSDNSvcLogicServiceClient
In VNFSDNSvcLogicServiceClient:
- Fix sonarlint issues (remove un-used import and etc)
- Changed tab to 4 spaces as per ONAP Java code style

Issue-Id: SDNC-123
Change-Id: Id176e915f17ef5fabc6805415f92d60b4c8e95b2
Signed-off-by: beili.zhou <beili.zhou@amdocs.com>

2 files changed, 580 insertions(+), 240 deletions(-)


If the Change-Id does not exist, do not proceed. You need to following SDNC - Development Environment Setup to fix it before proceeding further.

3git commit --amend

Use this command to do the following:

    • add more desciption about this commit (refer to Commit Messages for how to organize commit description)
    • insert Issue-Id: <your ONAP issue id> before the Change-Id
4git review

This command will create the review at Gerrit.

Once this command is completed, your newly created review can be found from Outgoing reviews in Gerrit self dashboard .

3. Update the Gerrit Review to get ready

From Gerrit self dashboard, click your newly created review, it will bring up the review details.

Click the Add button in the Reviewers section, to add reviewers (who is going to review your code) and committers (who is going to review your code as well as approve and commit your code).

Image Added

Note:

    • The ONAP Jobbuilder will be added automatically within one or two minutes after the review created, and a verfiy build will also be automatically triggered for your review in ONAP jenkins server.
    • The committer can be found from Software Defined Newtork Controller secion in Resources and Repositories page.


By now, you will just wait and check your email for information of

  • If the verify jenkins build is passed for your review
    • If it is passed, ONAP Jobbuilder will add a +1 to the Verified field in your review.
  • If there's any comments in your review
    • the comments details can be view from the History section by clicking on the description or Expand All button
  • If your review has been merged
    • If your review is merged or in process to be merged, you will see in the Code-Review field, you have a +2 from one of the committer you have added in your Reviewers.


Tips

How to Change the Comments in A Review

Oops, I made a mistake in my review comments. It cannot be changed in the gerrit review. (sad)

Go back to your workspace, and do the following to change the comments of your existing review.

StepsCommandNotes
1git commit --amendupdate the comment as desired
2git log --shortstatvalidate your commit now has the updated comments, as well as the Change-Id as the one in the gerrit review
3git review

push the changed comment to the review again.

Once the command is completed, go to your review, you will see

  • the comments content adjust to your new ones
  • the Patch Sets is now increased by one, such as from (1/1) to (2/2). here's an example:

Image Added


How to Update the Code in A Review

Now, I got comments in my view, and I have made the code adjustment in my workspace and tested.

Follow the steps to push your new code changes to the your existing reiew.

Stepscommandnotes
1git commit -sam "my updated code"To create a new commit with your updated code
2git log --shortstat

you will see the most 2 recent commits are from

  • your commit from step 1
  • your original commit of the existing review
3git rebase -i HEAD~2

To run rebase interactively for the most recent 2 commits

In the interactive mode, it will bring up the text which contains pick for your last 2 commits along with the following content:

Image Added

Do the following:

  • replace the pick in the start line of your commit from step 1 (marked with "my updated code") with s or squash,
  • remove any other text line related to this commit in the line below.
  • save the change by entering :wq


Once this command is completed, 2 commits will be merged into 1 commit.

4git log --shortstat

you will see there's only 1 commit which replaces the 2 commit you have seen in step 2.

validate your commit has the Change-Id as the one in the gerrit review 

5git review

push the changed comment to the review again.

Once the command is completed, go to your review, you will see

  • the comments content adjust to your new ones
  • the Patch Sets is now increased by one, such as from (1/1) to (2/2). here's an example:

Image Added


Anchor
Fix no change-id
Fix no change-id
How to Fix A Commit Does Not Have Change-Id

The would only happen when you are creating your very first review in a repo. It mainly because your workspace might have some mis-config which lead your repo clone was not done properly with the Clone with commit-msg hook option.

Follow the steps below to do the correction.

StepsCommandNotes
1git reset HEAD~1to undo the commit
2

from github helper page, download commit-msg,

and place it under your <repo>/.git/hook directory

set the proper commit-msg hook

this will set the Change-Id properly in your commit

3Use your previous command to create the commit again
4git log --shortstatto check the existence of Change-Id


How to Find All of My Merged Changes

You can find your recent merged changes from Gerrit self dashboard, however, it only works for Recent changes.

To find all of your changes, you can type in "is:closed(owner:self)" in the Search field at Gerrit self dashboard, then click on the Search button.

Image Addedcoming soon



How to Deploy a minimal ONAP sdnc environment

...