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

Compare with Current View Page History

« Previous Version 25 Next »

Follow the steps below to set up the development environment on your client machine.

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.  Then verify that you can log in at https://gerrit.openecomp.org/ and that you can see the OpenECOMP list of repositories.

Linux Setup

<<TODO: describe a Linux client set-up for Git and git-review>>

To install git-review on Linux (Ubuntu), type the following command.

sudo apt-get install git-review

Windows Setup

Installing Git

Install Git on your client, visit: https://www.atlassian.com/git/tutorials/install-git, and download the appropriate installation image for your host. Execute the installation script.

Include the "Git Bash" and "Git GUI" components (this is the default). For example, during the Windows installation, leave the following boxes checked:

If you intend to type Git commands from the Windows Command Prompt, leave the default setting for adjusting the PATH environment:

The repositories use Unix-style line-feed for line termination, so on your windows Git client, select the conversion option:

Select the following option based on your own preference (non-default shown, so 'winpty' is not required):

Choose the defaults here:

The installer lets you choose the experimental 'difftool'; either choice will work. Continue with the installation dialogs until the installation is complete.

Windows Setup for git-review

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.

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\<my-id>\.ssh) (if known_hosts does not exist, create it).

Install Python and git-review on Windows

Download Python version 2.7.10:

Execute the install file that you just downloaded. (You must have administrative privileges.) During installation, select "Add python.exe to Path", overriding the default setting. Also, be sure to install "pip" (this is the default).

Continue with the installation until it is completed.

Run Git Bash as Administrator (for example, in Windows 10, use the Windows menu, scroll to the Git directory, right-click on Git-bash, and select "Run as administrator":

Within Git-bash, type the following command:

$ pip install git-review

To use git review, you have to be in a git clone directory that already contains a (possibly hidden) .gitreview configuration file (see Gerrit/Advanced usage#Setting up a repository for git-remote), otherwise you will get the error message UnboundLocalError: local variable 'no_git_dir' referenced before assignment.

The git and git-review installation steps above are described at: https://www.mediawiki.org/wiki/Gerrit/git-review#Windows 

Configure Git to remember your Linux Foundation user name and email address (the user name and email address associated with your Linux Foundation login):

git config --global user.email <your_LF_account_email>

git config --global --add gitreview.username <your_LF_user_name>

If you are using VPN, you might encounter a proxy problem while connecting to the Linux Foundation 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: When entering the proxy username, you might be required to add the domain name in front of the username.

Selecting a connection method (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. To do so:

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 you might 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 by Using the Command Line

  1. Add a remote pointer to the Gerrit server that hosts your repository using either SSH or HTTPS. (Users behind a VPN will prefer the HTTPS method, since most VPNs won't allow an ssh connection.)

    Using SSH:

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

    Using HTTPS:

    With HTTPS, first you will 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>
     
  2. Now clone the remote repository (because the repo already contains a commit from the Linux Foundation team that created it). Since we clone in the current folder, it will create a sub folder with the remote copy.

    Using SSH:

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

    Using HTTPS:

    With HTTPS, first you will need the Gerrit HTTP-generated password for each HTTPS operation with Git/Gerrit.

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

    Installing the Gerrit plugin in IntelliJ

    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 Linux Foundation 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 putone.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.




  • No labels