|
1 |
| -Getting started as a developer |
2 |
| -============================== |
| 1 | +.. _Ref0: https://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html |
| 2 | + |
| 3 | +.. _Ref1: https://gerrit-review.googlesource.com/Documentation/user-notify.html |
| 4 | + |
| 5 | +.. _Ref2: https://docs.opendev.org/opendev/git-review/latest/installation.html |
| 6 | + |
| 7 | +.. _Ref3: https://github.com/OpenSDN-io/community/issues |
| 8 | + |
| 9 | +.. _Ref4: https://github.com/orgs/OpenSDN-io/discussions |
| 10 | + |
| 11 | +.. _Ref5: https://discord.gg/35533ukb |
| 12 | + |
| 13 | +.. _Ref6: https://t.me/tungstenfabric_ru |
| 14 | + |
| 15 | +Getting started as a contributor |
| 16 | +================================ |
3 | 17 |
|
4 | 18 | This brief note would serve as a reference for a developer looking to
|
5 |
| -start-up on the OpenSDN development environment. |
| 19 | +start-up on the contributing to OpenSDN platform. |
6 | 20 |
|
7 |
| -PLEASE NOTE: Until 2018, OpenSDN was named “OpenContrail”. There |
8 |
| -are still several references to the old name in the code and other |
9 |
| -utilities. |
| 21 | +PLEASE NOTE: Until 2023, OpenSDN was named “Tungsten Fabric” and |
| 22 | +before 2019 it had title “OpenContrail”. There are still several |
| 23 | +references to the old name in the code and other utilities. |
10 | 24 |
|
| 25 | +1. Prerequisites |
| 26 | +---------------- |
11 | 27 |
|
12 |
| -1. OS installation and configuration |
13 |
| ------------------------------------- |
| 28 | +Before contributing you will need next accounts: |
14 | 29 |
|
15 |
| -Install Centos 7 for a stable installation of OpenSDN. |
| 30 | +1. a `GitHub <https://github.com>`_ account with publicly available e-mail |
| 31 | + (Settings -> Public profile -> Public e-mail); |
16 | 32 |
|
17 |
| -You can also use Ubuntu 20.04 (In case of problems, check https://github.com/OpenSDN-io/tf-devstack) |
| 33 | +2. a `Gerrit <https://gerrit.opensdn.io>`_ account linked to the GitHub |
| 34 | + account (using the GitHub account credentials). |
18 | 35 |
|
19 |
| -1.1 Relevant packages for the OpenSDN installation |
20 |
| ----------------------------------------------------------- |
| 36 | +2. Git installation and configuration |
| 37 | +------------------------------------- |
21 | 38 |
|
22 |
| -:: |
| 39 | +2.1 Installation of the Git version control system |
| 40 | +--------------------------------------------------- |
| 41 | +Next programs will be needed: git command and OpenSSH server. |
| 42 | +For example, on RPM based systems (CentOS, Fedora, etc) they can be |
| 43 | +installed with these commands: |
| 44 | + |
| 45 | + :: |
23 | 46 |
|
24 | 47 | sudo yum update
|
25 | 48 | sudo yum install git
|
26 | 49 | sudo yum install git-core
|
27 | 50 | sudo yum install openssh-server
|
28 | 51 |
|
29 |
| -1.2 Generate SSH key and add it to local SSH-agent |
30 |
| --------------------------------------------------- |
| 52 | +2.2 Generation of an SSH key |
| 53 | +---------------------------- |
| 54 | + |
| 55 | +If an SSH key was already generated, then this step can be omitted. |
31 | 56 |
|
32 | 57 | Ref:
|
33 | 58 | https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account
|
34 | 59 |
|
35 |
| -:: |
| 60 | + :: |
36 | 61 |
|
37 | 62 | ssh-keygen -t rsa -b 4096 -C "<username@someone.com>" //press "Enter" every time you see question
|
38 | 63 | eval $(ssh-agent -s)
|
39 | 64 | ssh-add ~/.ssh/id_rsa
|
40 |
| - cat ~/.ssh/id_rsa.pub |
41 | 65 |
|
42 |
| -Copy the entire output line(your public ssh id) |
| 66 | +Where "<username@someone.com>" corresponds to your GitHub email address. |
43 | 67 |
|
44 | 68 |
|
45 |
| -1.3 Add SSH key to GitHub account |
| 69 | +2.3 Add SSH key to GitHub account |
46 | 70 | ---------------------------------
|
47 | 71 |
|
48 |
| -1. Go to profile and select settings |
49 |
| - |
50 |
| -2. Choose SSH and GPG keys -> New SSH key |
| 72 | +1. Run `GitHub <https://github.com>`_ web page in a browser. |
51 | 73 |
|
52 |
| -3. Give a title for the key |
| 74 | +2. Go to profile and select settings. |
53 | 75 |
|
54 |
| -4. Paste the key copied in step 1.2 |
| 76 | +3. Choose SSH and GPG keys -> New SSH key. |
55 | 77 |
|
56 |
| -5. Add SSH key |
| 78 | +4. Give a title for the key in "Title" field. |
57 | 79 |
|
58 |
| -6. Make sure that in GitHub settings in Public profile you have public email(that you will add to global git config) |
59 |
| - This is required for the correct operation of the Gerrit |
| 80 | +5. Copy the public SSH key (for example, obtained from step 2.2): |
60 | 81 |
|
| 82 | + :: |
61 | 83 |
|
62 |
| -2. OpenSDN + Devstack setup(Ansible Deployer) |
63 |
| ------------------------------------------------------ |
64 |
| - |
65 |
| -Ref: https://github.com/OpenSDN-io/tf-devstack |
66 |
| - |
67 |
| -If you have any questions, you can see more detailed instructions in this README: |
68 |
| - |
69 |
| -https://github.com/OpenSDN-io/tf-devstack/tree/master/ansible |
| 84 | + cat ~/.ssh/id_rsa.pub |
70 | 85 |
|
71 |
| -2.1 Create a nonroot user and add it to the wheel group |
72 |
| -------------------------------------------------------- |
| 86 | +6. Paste the public SSH key into "Key" field. |
73 | 87 |
|
74 |
| -:: |
| 88 | +7. Add SSH key. |
75 | 89 |
|
76 |
| - sudo useradd <username> |
77 |
| - sudo passwd <username> |
78 |
| - sudo usermod -aG wheel <username> |
| 90 | +8. Make sure that in GitHub settings in Public profile you have public email |
| 91 | + (the one you will add to global git config). This is required for the correct |
| 92 | + operation of the Gerrit (see section 1.1). |
79 | 93 |
|
80 | 94 |
|
81 |
| -Modify user rigths configuration. Open the sudoers file |
| 95 | +3. Setting up Gerrit for committing code changes for a review |
| 96 | +------------------------------------------------------------- |
82 | 97 |
|
83 |
| -:: |
| 98 | +Reviewing process is organized using Gerrit system and |
| 99 | +"git review" command, Ref1_, Ref2_. |
84 | 100 |
|
85 |
| - sudo visudo |
| 101 | +3.1 Setup SSH access |
| 102 | +-------------------- |
86 | 103 |
|
87 |
| -In the opened file, locate the line |
| 104 | +1. Log into your `OpenSDN Gerrit account <https://gerrit.opensdn.io>`_ |
| 105 | + using via GitHub credentials. |
88 | 106 |
|
89 |
| -:: |
| 107 | +2. Go to top-right corner -> Settings. |
90 | 108 |
|
91 |
| - %wheel ALL=(ALL) ALL |
| 109 | +3. Left panel: SSH Keys -> New SSH key. |
92 | 110 |
|
93 |
| -Change it to |
| 111 | +4. Copy the public SSH key from step 2.3.5. |
94 | 112 |
|
95 |
| -:: |
| 113 | +5. Test the SSH access using your Gerrit account name "sshusername": |
96 | 114 |
|
97 |
| - %wheel ALL=(ALL) NOPASSWD: ALL |
| 115 | + :: |
98 | 116 |
|
99 |
| -Switch to the new user and navigate to the home directory |
| 117 | + $ ssh -p 29418 sshusername@gerrit.opensdn.io |
100 | 118 |
|
101 |
| -:: |
| 119 | +6. After the execution, you should see: |
102 | 120 |
|
103 |
| - su <username> |
104 |
| - cd |
| 121 | + :: |
105 | 122 |
|
| 123 | + **** Welcome to Gerrit Code Review **** |
106 | 124 |
|
107 |
| -2.1 Clone Contrail-installer and devstack Repositories |
108 |
| ------------------------------------------------------- |
| 125 | + Hi <sshusername>, you have successfully connected over SSH. |
109 | 126 |
|
110 |
| -:: |
| 127 | + Unfortunately, interactive shells are disabled. |
| 128 | + To clone a hosted Git repository, use: |
111 | 129 |
|
112 |
| - git clone http://github.com/OpenSDN-io/tf-devstack |
| 130 | + git clone ssh://sshusername@gerrit.opensdn.io:29418/REPOSITORY_NAME.git |
113 | 131 |
|
| 132 | + Connection to hostname closed. |
114 | 133 |
|
115 |
| -2.2 Set up OpenSDN |
116 |
| --------------------------- |
117 |
| - |
118 |
| -Execute script and wait for installation: |
119 |
| -:: |
120 |
| - |
121 |
| - ./tf-devstack/ansible/run.sh // |
122 | 134 |
|
123 |
| -2.3 Accessing Openstack and OpenSDN GUIs |
124 |
| ------------------------------------------------- |
125 |
| -Openstack and contrail GUIs can be accessed as follows:- |
| 135 | +3.2 Pushing code changes for a review |
| 136 | +------------------------------------- |
126 | 137 |
|
127 |
| -1. OpenSDN GUI: :code:`http://localhost:8143/` |
| 138 | +1. Install git-review utility. For example, on RPM-based systems run the |
| 139 | + command: |
128 | 140 |
|
129 |
| -2. Openstack GUI: :code:`http://localhost/dashboard/` (only if you have installed with the openstack orchestrator) |
| 141 | + :: |
130 | 142 |
|
| 143 | + sudo yum install git-review |
131 | 144 |
|
132 |
| -3. Setting up Gerrit for committing code-changes for review |
133 |
| ------------------------------------------------------------ |
| 145 | + Or it can be installed using pip Ref2_: |
134 | 146 |
|
135 |
| -https://gerrit-review.googlesource.com/Documentation/user-notify.html |
| 147 | + :: |
136 | 148 |
|
137 |
| -3.1 Setup SSH access |
138 |
| --------------------- |
| 149 | + sudo pip install git-review |
139 | 150 |
|
140 |
| -1. Log into your account at https://gerrit.opensdn.io (via GitHub) |
141 | 151 |
|
142 |
| -2. Go to top-right corner -> settings |
| 152 | +2. Configure Gerrit: |
143 | 153 |
|
144 |
| -3. Left panel: SSH Keys -> New SSH key |
| 154 | + :: |
145 | 155 |
|
146 |
| -4. Copy ssh key from step 1.2 |
| 156 | + git config --global user.email username@someone.com |
| 157 | + |
| 158 | + where "username@someone.com" is your email address that is publicly visible on |
| 159 | + your GitHub profile page. |
147 | 160 |
|
148 |
| -5. Test the SSH access |
| 161 | +3. Clone the repo where your changes need to be introduced: |
149 | 162 |
|
150 | 163 | ::
|
151 | 164 |
|
152 |
| - $ ssh -p 29418 sshusername@gerrit.opensdn.io |
153 |
| - |
154 |
| - **** Welcome to Gerrit Code Review **** |
| 165 | + git clone ssh://sshusername@gerrit.opensdn.io:29418/opensdn-io/REPOSITORY_NAME |
| 166 | + |
| 167 | + where "sshusername" is your OpenSDN Gerrit account name and "REPOSITORY_NAME" |
| 168 | + is the name of an OpenSDN repository (e.g., tf-dev-env, tf-controller, etc). |
| 169 | + Available OpenSDN repositories are listed `here <https://gerrit.opensdn.io/admin/repos>`_. |
155 | 170 |
|
156 |
| - Hi <sshusername>, you have successfully connected over SSH. |
| 171 | +4. Introduce your changes to the source code of the cloned repository. |
157 | 172 |
|
158 |
| - Unfortunately, interactive shells are disabled. |
159 |
| - To clone a hosted Git repository, use: |
| 173 | +5. Commit the changes |
160 | 174 |
|
161 | 175 | ::
|
162 | 176 |
|
163 |
| - git clone ssh://sshusername@gerrit.opensdn.io:29418/REPOSITORY_NAME.git |
164 |
| - |
165 |
| - Connection to hostname closed. |
| 177 | + git commit -m "<commit-note>" -s |
166 | 178 |
|
167 |
| -3.2 Pushing code-changes for review |
168 |
| ------------------------------------ |
| 179 | + "-s" option is needed to sign a commit with your own e-mail and digital |
| 180 | + signature. |
169 | 181 |
|
170 |
| - |
171 |
| -1. Install git-review |
| 182 | +6. Push the locally committed changes up for review |
172 | 183 |
|
173 | 184 | ::
|
174 | 185 |
|
175 |
| - sudo yum install git-review |
| 186 | + git review |
176 | 187 |
|
177 |
| -2. Configure Gerrit |
| 188 | + In case of successfull execution of the command, you will see in your terminal: |
178 | 189 |
|
179 | 190 | ::
|
180 | 191 |
|
181 |
| - git config --global user.email username@someone.com |
182 |
| - |
183 |
| -3. Clone the repo where changes need to be committed |
| 192 | + remote: SUCCESS |
184 | 193 |
|
185 |
| - :: |
| 194 | +NOTE. If any of the steps above have raised questions you can: |
186 | 195 |
|
187 |
| - git clone |
188 |
| - ssh://sshusername@gerrit.opensdn.io:29418/REPOSITORY_NAME.git |
| 196 | +* create an issue on in the community repository Ref3_; |
189 | 197 |
|
190 |
| -4. Commit the changes |
| 198 | +* discuss your question in the discussions section Ref4_; |
191 | 199 |
|
192 |
| - :: |
| 200 | +* or ask for help in Discord Ref5_ or in Telegram Ref6_. |
193 | 201 |
|
194 |
| - git commit -m "<commit-note>" |
195 | 202 |
|
196 |
| - Note: please ensure that any change being committed should have a corresponding |
197 |
| - launch-pad bug-id mentioned in the commit message, i.e. "Bug #1679466" |
| 203 | +4. References |
| 204 | +------------- |
198 | 205 |
|
199 |
| -5. Push the locally committed changes up for review |
| 206 | +1. Ref1_ : Gerrit Code Review - Email Notifications |
200 | 207 |
|
201 |
| - :: |
| 208 | +2. Ref2_ : gitreview. Installation and Configuration |
202 | 209 |
|
203 |
| - git review |
204 | 210 |
|
205 |
| -NOTE. If any of the steps above have raised questions, you can read the documentation at the link above |
|
0 commit comments