Adding environment setup chapter
[doc.git] / docs / guides / onap-developer / how-to-use-docs / setting-up-environment.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2020 Nokia.
4
5 Setting up environment
6 ======================
7
8 This chapter is based on the `Git Guide <https://docs.releng.linuxfoundation.org/en/latest/git.html>`_
9 and the `Gerrit Guide <https://docs.releng.linuxfoundation.org/en/latest/gerrit.html>`_
10 in the Linux Foundation Releng Documentation.
11
12 Prerequisites
13 ~~~~~~~~~~~~~
14
15 Before you start, you should have an LFID account (sign up
16 `here <https://identity.linuxfoundation.org/>`_).
17
18 Installing git
19 ~~~~~~~~~~~~~~
20
21 1. Install Git.
22
23    For Debian based systems:
24
25    .. code-block:: bash
26
27       sudo apt-get install git -y
28
29
30    For rpm based systems:
31
32    .. code-block:: bash
33
34       sudo dnf install git -y
35
36
37    For MacOS systems, install `homebrew <http://brew.sh>`_ and install Git
38
39    .. code-block:: bash
40
41       brew install git
42
43 .. 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.
44
45 Configure Git
46 ~~~~~~~~~~~~~
47
48 1. Set the author name or email used to sign off a commit with the following commands.
49
50 .. code-block:: bash
51
52    git config --local user.name "Your Name"
53    git config --local user.email yourname@example.com
54
55 .. note:: Your name and e-mail address (including capitalization) must match the one you entered when creating your LFID account.
56
57 2. Optionally, change the Git commit editor to your preferred editor, for example, vim.
58
59 .. code-block:: bash
60
61    git config --global core.editor "vim"
62
63 Installing git-review
64 ~~~~~~~~~~~~~~~~~~~~~
65
66 1. Install git-review.
67
68 .. code-block:: bash
69
70     pip install git-review
71
72 .. note:: If you don’t have pip installed already, follow the `installation documentation <https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py>`_ for pip.
73
74 Setting up gerrit
75 ~~~~~~~~~~~~~~~~~
76
77 Setting SSH keys
78 ----------------
79
80 1. Generate SSH keys.
81
82 .. code-block:: bash
83
84     ssh-keygen -t rsa
85
86 Your public key is now available as .ssh/id_rsa.pub in your home folder.
87
88 2. Print the generated key to the terminal and copy it.
89
90 .. code-block:: bash
91
92     cat .ssh/id_rsa.pub
93
94 3. On the project gerrit page, go to Settings.
95
96 .. figure:: https://docs.releng.linuxfoundation.org/en/latest/_images/gerrit-settings.png
97    :alt: Settings page for your Gerrit account
98    :width: 50 %
99
100 4. Click **SSH Public Keys** under **Settings**.
101
102 5. Click **Add Key**.
103
104 6. In the **Add SSH Public Key** text box, paste the contents of your **id\_rsa.pub** file and then click **Add**.
105
106 .. figure:: https://docs.releng.linuxfoundation.org/en/latest/_images/gerrit-ssh-keys.png
107     :alt: Adding your SSH key
108     :width: 50 %
109
110 Setting up CLA as an individual contributor
111 -------------------------------------------
112
113 1. Navigate to **Settings** — the gear icon on the upper right corner, and click **Agreements** from the menu on the left:
114
115 .. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/settings-icon.png
116
117 .. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/agreements.png
118
119 2. Click **New Contributor Agreement**.
120
121 .. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/agreement-link.png
122
123 3. New Contributor Agreement types appear:
124
125 .. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/new-contributor-agreement.png
126
127 4. Choose the Individual CLA option.
128
129 .. figure:: CLA_types.png
130
131 5. Click the **Please review the agreement link** and then click the message link that appears:
132
133 .. figure:: https://raw.githubusercontent.com/communitybridge/docs/master/.gitbook/assets/cla-gerrit-icla-proceed-to-sign-cla.png
134
135 6. Sign in to EasyCLA if you are prompted.
136
137 7. Select **Company**.
138
139 .. 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.
140
141 If any further prompts appear, follow the steps described at the below links:
142
143 - `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>`_
144 - `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>`_
145 - `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>`_
146 - `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>`_
147
148 8. Complete the form and click **SEND**.
149
150 The CCLA manager signs a Corporate CLA and adds you to the approved list.