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

Compare with Current View Page History

« Previous Version 19 Next »

The Linux foundation infrastructure is hosted on public servers. Access is controlled by a main portal, where users can sign in. The portal also enables users who own groups to invite users to join their groups. There will be one or multiple groups per OpenECOMP component.

Figure 1 shows an overview of the Toolchain:


Figure 1. Toolchain

Tools

The following table lists the tools:

Tool NameURLDescription
Sonarhttps://sonar.openecomp.org/OpenECOMP Sonar server, will hold Sonar metrics computed by each component builds
Nexus 3https://nexus3.openecomp.org/OpenECOMP Nexus 3 repository, this repo will hold Docker containers produced by OpenECOMP builds. Access is automatically provided to builds by the maven settings on the Jenkins Master, see Jenkins job for more details. User should be able to access and browse artifacts through this URL.
Nexus 2https://nexus.openecomp.org/OpenECOMP Nexus 2 repository, this repo will hold Maven2 artifacts produced by builds (both Release and Snapshot, also Javadoc-mavensite), Access is automatically provided to builds by the maven settings on the Jenkins Master, see Jenkins job for more details. User should be able to access and browse artifacts through this URL.
JIRAhttps://jira.openecomp.org/OpenECOMP JIRA instance, used to track issues, releases, stories...
Jenkins Masterhttps://jenkins.openecomp.org/

OpenECOMP Jenkins Master host, this host will only serve as a 'Display' as most of the Jobs will be executed by 'minions' (slave hosts.

which are defined by using the jenkins configuration repository in Gerrit.

Identity portalhttps://identity.linuxfoundation.org/registering portal : controls user account and group management.
Help Deskhelpdesk@openecomp.org

Send email with    Subject: problem or request summary    Body: Additional details    

Gerrit serverhttps://gerrit.openecomp.org/

Gerrit code review server, hosting the OpenECOMP git repositories as well as controlling access, push, review of new code

Also host the jenkins job configuration in a git repository that is following the same workflow (see Gerrit Workflow below).

Confluencehttps://wiki.openecomp.orgOpenECOMP Wiki, used to track project documentation, recommendation, guidelines...

Environment Setup

Linux Foundation account setup

Follow the instructions on the identity portal to create a Linux Foundation account and get access to the OpenECOMP  Gerrit instance (verify that you can log in using the link in the table above and that you can see the OpenECOMP list of Repositories). 

Git and Gerrit local setup

The OpenECOMP repositories are stored on Gerrit. You need a Git client to be able to pull/push code.

You also need to add a plugin to Git in order to interact with Gerrit.  The plugin is called git-review.

To install git-review on Linux (Ubuntu) :

sudo apt-get install git-review 

To install it on Windows:

Shall we make the below section a sub-section?

Follow those steps if you are a Windows user and need to interact with Gerrit; it will help you when you install git-review on your system.

Step-by-step guide

NOTE: it is assumed that you already have a Gerrit profile setup and you can connect to it.

Preliminary Step: Install Putty and Generate a Putty Key

NOTE: If you already have keys registered with putty, skip this section.

  1. Ensure you have the complete putty suite installed. You should have pageant.exe, plink.exe and puttygen.exe.
  2. Generate a key with puttygen. Choose a passphrase, then select "Save private key" and choose a target; also "Save public key" and select a target. It is recommended to use file names containing "private" and "public" for the keys as both will end in .ppk.
  3. Start pageant if not started, then add your newly generated private key.
  4. Under the control panel > system > advanced system properties > environment variables, add a GIT_SSH entry (if not present) and point to plink.exe.
  5. When done, start a command line (cmd.exe) and run 'env'; the newly added environment variable should appear.
  6. In your Gerrit profile, add the public key. Also, copy/paste the known_hosts entries listed, into a file named known_hosts under your .ssh profile (something like C:\Users\<ATTUID>\.ssh) (if known_hosts does not exist, create it).

Remaining Steps

  1. Download Python, based on the TSS approved version (2.7.10 at OpenECOMP Release 1):

2. Using a command line with administrative privileges, go to the folder in which the .msi file was downloaded. For example:

    • cd C:\Users\xxxxxx\Downloads (Replace xxxxx with your user name if the package got downloaded to your Downloads folder.) 

NOTE: You'll know that cmd.exe has admin privileges if the console text is green.

3. Install Python:

    • msiexec /i python-2.7.10.msi (32-bits)
    • msiexec /i python-2.7.10.amd64.msi (64-bits)

4. Now, follow the instructions at the following URL:

NOTE: You MUST select "Add python.exe to Path."

5. When installation is complete, restart a new command line (admin privileges may be needed) and run:

    • pip install git-review

NOTE: By re-opening a new command line you'll benefit from the %PATH% update

6. Add your reviewer name for all future reviews:

    • git config --global --add gitreview.username "your_LF_user_name"

NOTE: Ensure that your user.name and user.email are matching what was configured for the Linux Foundation credentials: user.name should equal gitreview.username and email address should match the email  address that was configured for the Linux Foundation.


<<TODO: Should we make the section above a sub section ? >>


You also need to setup your git user email address to the one defined in your LF account, the easiest way to do so is to run :

git config --global user.email your LF account email
git config --global --add gitreview.username your_LF_user_name


For people using VPN, you might have proxy problem while connecting to LF website. To avoid the problem, you should add the proxy setting in git config, using the following command:

git config --global https.proxy https://<proxy username>:<proxy password>@<proxy url> 
git config --global http.proxy http://<proxy username>:<proxy password>@<proxy url>

Note: while entering proxy username, sometimes it may require to add the domain name in front of the username.

SSH or HTTPS

Once Git/Gerrit is installed, you will need to select a connection method to the remote server.

We recommend using SSH in which case you need to register your public key in your account settings in gerrit

If you choose to use HTTP/HTTPS, you'll need to generate an access password

In your gerrit account settings, select HTTP Password:


The icon at the right of the generated password allows you to copy the generated password to your clipboard, it will be needed when you interact with git/gerrit.

This password may have a limited time to live, so if you get errors like this one:

Problem running 'git remote update gerrit'
Fetching gerrit
fatal: unable to access 'https://USERNAME@gerrit.openecomp.org/r/a/mso/ ': Unknown SSL protocol error in connection to gerrit.openecomp.org:443 error: Could not fetch gerrit

Regenerating a password will most likely solve the connectivity issue. Sometime, the gerrit interface on HTTPS might be temporarily faulty, so retries might be needed.


Cloning the Repository Using the Command Line

Add a remote pointer to the Gerrit server hosting your repository (behind the company VPN Windows users will use the alternate command)

users using SSH:

git remote add origin ssh://USERNAME@gerrit.openecomp.org:29418/<REPONAME>

using HTTPS (you'll need the gerrit HTTP generated password for each HTTPS operation with git/gerrit):

git remote add origin https://USERNAME@gerrit.openecomp.org/r/a/<REPONAME>

Now clone the remote repository (because the repo already contains a commit from the LF team that created it), since we clone in the current folder, it will create a sub folder with the remote copy

users using SSH:

	git clone ssh://USERNAME@gerrit.openecomp.org:29418/<REPONAME>

using HTTPS (you'll need the gerrit HTTP generated password for each HTTPS operation with git/gerrit):

	git clone https://USERNAME@gerrit.openecomp.org/r/a/<REPONAME>

Pushing changes for review using command line

Now lets add some files and add our first commit with the associated message

git add somefiles
git commit -m "My first Awesome commit" 

Note that this is just an example and the commit message should be much more explicit than that

Now that everything is ready, you can sign off your commit, make sure that your git user matches the one set up on the LF as this will be verified by the gerrit server

git review -s

You may be prompted for your LF account password

Now let's verify the commit hook work, this will show you the commit message and the sign off entry

git commit -as --amend 

You can automatically add the signature for all your commits by setting the git configuration : git config --global format.signoff true

Eventually, we can push the change to the gerrit server

git review

The code should now appear in the gerrit web interface, it needs a committer to approve it with a +2 and also move the verifed flag to +1, to do so, the committer can open the gerrit UI and click on the open review list



Then click on the Reply button, you can also add reviewers for their inputs, add a review comment, and move the flags to +2 and +1



Once a committer approves it, the code can be merged to the master branch

If issues are found, both contributors and committers can amend the review (use the top-left download link on the review screen to get the direct clone commands that would download the reviewed code in a local repository)

Similarly to the above steps, do the needed modifications, and push the changes (again after signing them) using git review

Note that you can also work on local branch, gerrit will automatically use your local branch name as a Topic for the review, allowing you to share branches between team members

More details on how to use gerrit : https://gerrit.openecomp.org/r/Documentation/index.html

IDE Setup

The best is to add a plugin to your preferred IDE so that you can easily interact with Gerrit (without having the need to go to the website) :

Eclipse gerrit plugin setup

       Our current investigations are not yet successful to find a plugin that supports the current OpenECOMP version of Gerrit.

       Eclipse Mars & Neon natively supports pulling and pushing code to Gerrit type repositories, which means they will also have the sign off option available.

       When connecting to a gerrit repository, the gerrit icon will be shown in eclipse (git repository view) and new options will be available on right click

       2 plugins have support for review : Mylin Gerrit connector plugin and Egit, unfortunately they do not support a 2.12 gerrit server yet so the recommendation would be to do reviews using the gerrit web interface.

Note that users can still work locally, and push changes through the native support of Eclipse

Another option is to use IntelliJ :

IntelliJ gerrit plugin setup could be found <HERE>


<<TODO: Should we make the below section a sub section?>>

Linux Foundation uses Gerrit to download and upload code into repository. Gerrit plugin could be downloaded and installed in IntelliJ, in order to work with the LF code downloading/uploading procedure.

Using and IDE : Install Gerrit plugin in IntelliJ, cloning and pushing

Open File -> Settings -> Plugins of IntelliJ, and click on the Browse repositories... button.


In the new window, search for Gerrit, click Install to install the plugin, and finally restart IntelliJ.


To verify whether the Gerrit plugin is installed successfully, you can click File -> New -> Project from Version Control and verify whether Gerrit is present.



Working with a Proxy

For people working with a proxy, you might have proxy issues connecting to LF website. To avoid the connection issue, you shall define the proxy setting for both IntelliJ and Git.

To configure the proxy settings in IntelliJ, click File -> Settings -> Appearance & Behavior -> System Settings -> HTTP Proxy, enter the correct proxy settings and click Apply. In case of Manual proxy configuration, while entering the Host name, there is no need to write http:// in front of the URL. For example, if the proxy value is http://one.proxy.com, you shall put one.proxy.com as the Host name.



To configure the proxy settings for Git, play the following command:

git config --global https.proxy https://<proxy username>:<proxy password>@<proxy url> 
git config --global http.proxy http://<proxy username>:<proxy password>@<proxy url>

Note: while entering proxy username, sometimes it may require to add the domain name in front.

Download code

Click the project name in Linux Foundation Gerrit website. On top of the project, it provides you the command to clone the whole project. The project can be downloaded with 2 ways, via HTTP url or SSH url.

Download with HTTP URL

Click http under the LF Project page, it will display the url to use to clone the project.


Then open your IntelliJ, click File -> Settings -> Version Control -> Gerrit, enter the URL for the LF Gerrit website, your LF username and password and click OK. To test whether the connection is good, you can also click the Test button before clicking OK.

Note: the URL is with https not with http.


Then open File -> New -> Project from Version Control -> Git to open Clone Repository window. Enter the http url you have found above, but with https not with http, chose your Parent Directory and Directory Name and click Clone to clone the project.


A window will pop up to input the user name and password. The user name shall be the username of your Linux Foundation account and the password is generated in the Linux Foundation website.


To generate the password, go to the Settings window, click on HTTP Password, input your username and click Generate Password.



Download with SSH URL

To download the project with ssh url, you need to add the ssh key into the LF Gerrit website.

Click your account name on the top right corner of the website and click on Settings.


In the Settings window, select SSH Public Keys. Put your public key of your machine into the window and click Add.


The steps to create the SSH Key could be found in the following page: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

Click ssh under the LF Project page, it will display the url to use to clone the project.


Then open your IntelliJ, click File -> Settings -> Version Control -> Gerrit, enter the URL for the LF Gerrit website, your LF username and password and click OK. To test whether the connection is good, you can also click the Test button before clicking OK.


Then open File -> New -> Project from Version Control -> Git to open Clone Repository window. Enter the ssh url you have found above, chose your Parent Directory and Directory Name and click Clone to clone the project.


For the first downloading, a OpenSSH window will appear to authenticate the host. Enter yes in the command location and click OK to progress.


Commit changes

Once you have made changed in the code, before push the changes, you should commit the code locally first.

To do that, go to the Version Control window, under Local Changes, right click the changed files and click Commit Changes....


In the Commit Changes window, enter the Commit Message, select Sign-off commit option and click Commit button.


Then go to the Terminal window, use command apt-get install git-review to install git-review plugin in the machine, if not already installed.


Once installed, under root location of the project enter command git config --list, make sure the email address listed is exactly the same as the one you used in your LF account.


If your address is not present or not the same as the one defined in LF account, enter command git config --global user.email "jondoe@somewhere.com".

Then enter command git commit -as --amend to show the commit message and the sign off entry, as shown below. Make sure the email address is the exactly the same as the email you used in the LF account. If not, update the address.


Then enter command git review to upload the changed code into the LF for reviewing.


Go to Gerrit window and refresh, the committed changes will be shown in the window. Right click the commit, you can find the tab to Add Reviewers for reviewing or Abandon the changes if you don't want it any more.


If you have been selected as the reviewer of the changes. You can right click the corresponding commit and click Review, Code-Review to give your score and comments for the change.



 — Should we put the above section in a sub section





  • No labels