summaryrefslogtreecommitdiffstats
path: root/docs/guides/onap-developer/how-to-use-docs/setting-up-environment.rst
blob: d0e980e6e6f2d9a0115d738a4a68e705095d3e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
.. This work is licensed under a Creative Commons Attribution 4.0
.. International License. http://creativecommons.org/licenses/by/4.0
.. Copyright 2020 Nokia.

Setting up environment
======================

This chapter is based on the `Git Guide <https://docs.releng.linuxfoundation.org/en/latest/git.html>`_
and the `Gerrit Guide <https://docs.releng.linuxfoundation.org/en/latest/gerrit.html>`_
in the Linux Foundation Releng Documentation.

Prerequisites
~~~~~~~~~~~~~

Before you start, you should have an LFID account (sign up
`here <https://sso.linuxfoundation.org/>`_).

Installing git
~~~~~~~~~~~~~~

1. Install Git.

   For Debian based systems:

   .. code-block:: bash

      sudo apt-get install git -y


   For rpm based systems:

   .. code-block:: bash

      sudo dnf install git -y


   For MacOS systems, install `homebrew <http://brew.sh>`_ and install Git

   .. code-block:: bash

      brew install git

.. note:: For more information on git, see the `Git Guide <https://docs.releng.linuxfoundation.org/en/latest/git.html>`_ in the Linux Foundation Releng Documentation.

Configure Git
~~~~~~~~~~~~~

1. Set the author name or email used to sign off a commit with the following commands.

.. code-block:: bash

   git config --local user.name "Your Name"
   git config --local user.email yourname@example.com

.. note:: Your name and e-mail address (including capitalization) must match the one you entered when creating your LFID account.

2. Optionally, change the Git commit editor to your preferred editor, for example, vim.

.. code-block:: bash

   git config --global core.editor "vim"

Installing git-review
~~~~~~~~~~~~~~~~~~~~~

1. Install git-review.

.. code-block:: bash

    pip install git-review

.. note:: If you don’t have pip installed already, follow the `installation documentation <https://pip.pypa.io/en/stable/installation/>`_ for pip.

Setting up gerrit
~~~~~~~~~~~~~~~~~

Setting SSH keys
----------------

1. Generate SSH keys.

    For OpenSSH 8.7 or older versions:

    .. code-block:: bash

       ssh-keygen -t rsa

    For OpenSSH 8.8 or later versions, either use ed25519 or ECDSA algorithm to generate ssh keys:

    .. code-block:: bash

        ssh-keygen -t ed25519

    or

    .. code-block:: bash

        ssh-keygen -t ECDSA

    .. note:: OpenSSH 8.8+ disables RSA signatures using the SHA-1 hash algorithm by default, which may cause authentication problem when pull/push code. You can either specify the encrypt algorithm or re-enable the RSA/SHA1 in ~/.ssh/config file to solve the issue. For more information, please refer to `OpenSSH Release Notes <https://www.openssh.com/releasenotes.html>`_.

    Your public key is now available as .ssh/id_rsa.pub or .ssh/id_ed25519.pub or .ssh/id_ecdsa.pub under .ssh folder.

2. Print the generated key to the terminal and copy it.

.. code-block:: bash

    cat .ssh/id_rsa.pub

3. On the project gerrit page, go to Settings.

.. figure:: https://docs.releng.linuxfoundation.org/en/latest/_images/gerrit-settings.png
   :alt: Settings page for your Gerrit account
   :width: 50 %

4. Click **SSH Public Keys** under **Settings**.

5. Click **Add Key**.

6. In the **Add SSH Public Key** text box, paste the contents of your **id\_rsa.pub** file and then click **Add**.

.. figure:: https://docs.releng.linuxfoundation.org/en/latest/_images/gerrit-ssh-keys.png
    :alt: Adding your SSH key
    :width: 50 %

Setting up CLA as an individual contributor
-------------------------------------------

1. Navigate to **Settings** — the gear icon on the upper right corner, and click **Agreements** from the menu on the left:

.. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/settings-icon.png

.. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/agreements.png

2. Click **New Contributor Agreement**.

.. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/agreement-link.png

3. New Contributor Agreement types appear:

.. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/new-contributor-agreement.png

4. Choose the Individual CLA option.

.. figure:: CLA_types.png

5. Click the **Please review the agreement link** and then click the message link that appears:

.. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/cla-gerrit-icla-proceed-to-sign-cla.png

6. Sign in to EasyCLA if you are prompted.

7. Select **Company**.

.. note:: To contribute to this project, you must be authorized under a signed Contributor License Agreement. You are contributing on behalf of your work for a company.

If any further prompts appear, follow the steps described at the below links:

- `If a Confirmation of Association with statement appears <https://docs.linuxfoundation.org/docs/communitybridge/easycla/contributors/contribute-to-a-gerrit-project#if-a-confirmation-of-association-with-statement-appears>`_
- `If your company has not signed CCLA <https://docs.linuxfoundation.org/docs/communitybridge/easycla/contributors/contribute-to-a-gerrit-project#if-your-company-has-not-signed-ccla>`_
- `If you are not added to the approved list <https://docs.linuxfoundation.org/docs/communitybridge/easycla/contributors/contribute-to-a-gerrit-project#if-you-are-not-added-to-the-approved-list>`_
- `If Company is not in the list <https://docs.linuxfoundation.org/docs/communitybridge/easycla/contributors/contribute-to-a-gerrit-project#if-company-is-not-in-the-list>`_

8. Complete the form and click **SEND**.

The CCLA manager signs a Corporate CLA and adds you to the approved list.