Workflow with OSM tools: Difference between revisions

From OSM Public Wiki
Jump to: navigation, search
Line 29: Line 29:
# Enter your username
# Enter your username
# Enter you password
# Enter you password
# It is recommended to install the Gerrit commit-msg hook for the cloned repository in order to automatically insert a Change-Id tag in commit messages. You can install it by entering the following command for openmano repository <pre> scp -p -P 29418 <username>@osm.etsi.org:hooks/commit-msg openmano/.git/hooks/ </pre> More information about the Gerrit commit-msg hook can be found here https://git.eclipse.org/r/Documentation/cmd-hook-commit-msg.html
'''Note''':  
'''Note''':  
* You can find the project repository URL on '''[https://osm.etsi.org/gitweb/ Gitweb]''' or on '''[https://osm.etsi.org/gerrit/ Gerrit]'''
* You can find the project repository URL on '''[https://osm.etsi.org/gitweb/ Gitweb]''' or on '''[https://osm.etsi.org/gerrit/ Gerrit]'''
Line 39: Line 41:
**# Click on "List" menu.
**# Click on "List" menu.
**# Select a product to see the available cloning URLs.
**# Select a product to see the available cloning URLs.
*It is recommended to install the
<pre>scp -p -P 29418 benalaya@osm.etsi.org:hooks/commit-msg openmano/.git/hooks/</pre>


= Configure your Git environment =
= Configure your Git environment =

Revision as of 20:20, 18 July 2016


Login to OSM portal

  1. Go to OSM portal: https://osm.etsi.org/
  2. Login using your username and password

Note:

If you need any help, contact us at OSMsupport@etsi.org

Report a bug on Bugzilla

  1. Go to the OSM Portal
  2. Click on Bugzilla menu on the portal menu bar.
  3. Click on "new" on Bugzilla menu bar.
  4. Choose the product, e.g. "OSM".
  5. Complete the bug form. If you know, choose the component, e.g OpenMANO, Riftware, UI, SO, etc.
  6. Enter the bug summary, description, attachement, etc.
  7. Click on the "Submit Bug" button to confirm.
  8. A bug id is generated (e.g. Bug 6 -Small Error)

Clone your project

  1. Clone a git repository, for example:
     git clone https://osm.etsi.org/gerrit/osm/openmano.git 
  2. Enter your username
  3. Enter you password
  4. It is recommended to install the Gerrit commit-msg hook for the cloned repository in order to automatically insert a Change-Id tag in commit messages. You can install it by entering the following command for openmano repository
     scp -p -P 29418 <username>@osm.etsi.org:hooks/commit-msg openmano/.git/hooks/ 
    More information about the Gerrit commit-msg hook can be found here https://git.eclipse.org/r/Documentation/cmd-hook-commit-msg.html

Note:

  • You can find the project repository URL on Gitweb or on Gerrit
    • On Gitweb
      1. Click on Gitweb menu on the portal menu bar.
      2. Select a product to see the available cloning URLs
    • On Gerrit
      1. Click on Gerrit menu on the portal menu bar.
      2. Click on "Projects" menu on the Gerrit menu bar.
      3. Click on "List" menu.
      4. Select a product to see the available cloning URLs.
  • It is recommended to install the
scp -p -P 29418 benalaya@osm.etsi.org:hooks/commit-msg openmano/.git/hooks/

Configure your Git environment

  1. Configure your git username globally:
     git config --global user.name <username> 
  2. Configure your git email address:
     git config --global user.email <email> 
  3. Check your git configuration:
     git config --list 
Note: Your email address will be visible on commits to Git. 
If you'd like to keep your email address private, you can mask your email as follows:
if your email is <name@company.com> you can set user.email to <hidden@company.com>
This allows other users to identify you as a contributor (with your user name) and
Git Stats to keep track of your company's contributions (with the email domain)

In case you are using git in the same computer for other open source projects, you can restrict your git variables to the local folder:

git config --local user.name <username>
git config --local user.email <email> 

Commit changes to your local project

  1. go to the "openmano" folder
    cd osm/openmano
  2. Make some changes on the source (e.g. add a line to the "example-file")
  3. Stage the change.
     git add example-file 
  4. Commit the change to your local repository. You can add a bug id in your commit message to link the bug to your contribution
     git commit -s -m "Bug 2 fixed!!"  
  5. You can see your commit message and update it, if needed, using the following command:
    git commit --amend 

Developer's Certificate of Origin

  • The "-s" parameter enables to Sign the contribution. It adds the following line at the end of your commit message:
   Signed-off-by: Random J Developer <random@developer.example.org>
  • The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as a open-source patch. The rules are pretty simple: signing a contribution means that you can certify the below:
        Developer's Certificate of Origin 1.1

        By making a contribution to this project, I certify that:

        (a) The contribution was created in whole or in part by me and I
            have the right to submit it under the open source license
            indicated in the file; or

        (b) The contribution is based upon previous work that, to the best
            of my knowledge, is covered under an appropriate open source
            license and I have the right under that license to submit that
            work with modifications, whether created in whole or in part
            by me, under the same open source license (unless I am
            permitted to submit under a different license), as indicated
            in the file; or

        (c) The contribution was provided directly to me by some other
            person who certified (a), (b) or (c) and I have not modified
            it.

        (d) I understand and agree that this project and the contribution
            are public and that a record of the contribution (including all
            personal information I submit with it, including my sign-off) is
            maintained indefinitely and may be redistributed consistent with
            this project or the open source license(s) involved.

Push your contribution to Gerrit

  1. To avoid merge conflicts, it is recommended to do a pull with rebase before pushing your contribution in order to merge latest changes made by other users.
    git pull --rebase
  2.  Push your commits to Gerrit for Code Review using the following command
     git push origin HEAD:refs/for/master 
  3. Enter your username.
  4. Enter your password.
  5. You can review your contribution on Gerrit web interface

Notes:

  • The following actions are execution automatically after pushing any contribution to Gerrit:
    • Gerrit reports the new contribution state to the corresponding bug in Bugzilla
    • Gerrit notifies Jenkins to build the new contribution.

Gerrit Notifications

Gerrit sends email notifications to: • Owner of the change • Reviewers of the change • Project watchers

Each user can configure his own watched projects and branches in the "settings/watched project" menu. Email notifications can be sent for New Changes, New Patch Sets, All Comments, Submitted Changes and Abandoned Changes.

Link: https://osm.etsi.org/gerrit/#/settings/projects (you can navigate there from the Gerrit console by clicking on the arrow by your login on the top right corner)

Continuous Integration

  1. Jenkins builds, tests the new contribution, and reports the result on its web interface.
  2. Jenkins votes on the contribution using “Code-Verif” (-1, +1) on Gerrit.


Code Review

  1. Other contributors and MDG Committers can comment the new contribution and vote using “Code-Review” (-1, 0, +1) on Gerrit.
  2. The MDG Leader can comment the new contribution and votes using “Code-Review” (-2, -1, 0, +1, +2) on Gerrit.


Merge the contribution

  1. The MDG Leader can "Submit" the change only if +1 "Code-Verif" (from Jenkins) and at least one +2 "Code-Review".
  2. Gerrit reports the result of the code review to the corresponding bug in Bugzilla