|
| 1 | +================ |
| 2 | +Github Connector |
| 3 | +================ |
| 4 | + |
| 5 | +.. |
| 6 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 7 | + !! This file is generated by oca-gen-addon-readme !! |
| 8 | + !! changes will be overwritten. !! |
| 9 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 10 | + !! source digest: sha256:29c14b59b60246cac8e8b59309bf989c02dd1b2067ce1f395b45d31f5f29944f |
| 11 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 12 | +
|
| 13 | +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png |
| 14 | + :target: https://odoo-community.org/page/development-status |
| 15 | + :alt: Beta |
| 16 | +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png |
| 17 | + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
| 18 | + :alt: License: AGPL-3 |
| 19 | +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Finterface--github-lightgray.png?logo=github |
| 20 | + :target: https://github.com/OCA/interface-github/tree/18.0/github_connector |
| 21 | + :alt: OCA/interface-github |
| 22 | +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png |
| 23 | + :target: https://translation.odoo-community.org/projects/interface-github-18-0/interface-github-18-0-github_connector |
| 24 | + :alt: Translate me on Weblate |
| 25 | +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png |
| 26 | + :target: https://runboat.odoo-community.org/builds?repo=OCA/interface-github&target_branch=18.0 |
| 27 | + :alt: Try me on Runboat |
| 28 | + |
| 29 | +|badge1| |badge2| |badge3| |badge4| |badge5| |
| 30 | + |
| 31 | +This module allows you to: |
| 32 | + |
| 33 | +- Fetch into Odoo social information from Github (Organizations, Teams, |
| 34 | + Users) |
| 35 | +- Fetch into Odoo Code structure information from Github (Repositories, |
| 36 | + Branches) |
| 37 | +- Download source code from Github |
| 38 | +- Analyze repository code from rules previously created |
| 39 | + |
| 40 | +**Table of contents** |
| 41 | + |
| 42 | +.. contents:: |
| 43 | + :local: |
| 44 | + |
| 45 | +Installation |
| 46 | +============ |
| 47 | + |
| 48 | +To install this addon, you need to install some python dependencies |
| 49 | + |
| 50 | +.. code:: bash |
| 51 | +
|
| 52 | + sudo pip install PyGitHub |
| 53 | + sudo apt install cloc |
| 54 | + sudo pip install pathspec |
| 55 | + sudo pip install GitPython |
| 56 | +
|
| 57 | +Analysis source code is generated by |
| 58 | +https://github.com/roskakori/pygount |
| 59 | + |
| 60 | +Configuration |
| 61 | +============= |
| 62 | + |
| 63 | +Once installed, you have to: |
| 64 | + |
| 65 | +1. Open your odoo.conf file and add extra settings to mention Github |
| 66 | + credentials, and the local path where the source code will be |
| 67 | + downloaded: |
| 68 | + |
| 69 | + - ``source_code_local_path = /workspace/source_code/`` |
| 70 | + |
| 71 | +Note: you can define the route as environment variable using the key |
| 72 | +SOURCE_CODE_LOCAL_PATH |
| 73 | + |
| 74 | +Note: make sure that Odoo process has read / write access on that folder |
| 75 | + |
| 76 | + - ``github_token = your_github_access_token`` |
| 77 | + |
| 78 | +Note: The login/password auth has been deprecated by GitHub. |
| 79 | +https://docs.github.com/en/rest/overview/other-authentication-methods#via-username-and-password |
| 80 | + |
| 81 | +1. Go to 'Settings' / 'Technical' / 'Parameters' / 'System Parameters' |
| 82 | + and define the following values: |
| 83 | + |
| 84 | + 1. ``github.max_try``: number of call to the API before an error is |
| 85 | + raised. The more unstable/slow your connection, the higher should |
| 86 | + be this value |
| 87 | + 2. ``git.partial_commit_during_analysis``: Set to ``True`` if you |
| 88 | + want to commit the result of the analysis in the database after |
| 89 | + each repository analysis. We recommend to set to ``True`` when you |
| 90 | + perform the initial download (potentially with a lot of |
| 91 | + repositories) in order to reduce the size of the transaction |
| 92 | + |
| 93 | + |image| |
| 94 | + |
| 95 | +2. Go to your(s) user(s) form to add them in the new 'Connector Github |
| 96 | + Manager' groups. The members of this group will have the possibility |
| 97 | + to run Github synchronization. |
| 98 | + |
| 99 | +Technical Information |
| 100 | +--------------------- |
| 101 | + |
| 102 | +This module provides 4 crons that you can enable: |
| 103 | + |
| 104 | +- Synchronize All Organizations and Teams (``cron_update_organization``) |
| 105 | +- Synchronize Branches List for All repositories |
| 106 | + (``cron_update_branch_list``) |
| 107 | +- Download Source Code for All Github Branches (``cron_download_code``) |
| 108 | +- Analyze Source Code for All Github Branches (``cron_analyze_code``) |
| 109 | + |
| 110 | +.. |image| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_settings.png |
| 111 | + |
| 112 | +Usage |
| 113 | +===== |
| 114 | + |
| 115 | +Initial upload from Github |
| 116 | +-------------------------- |
| 117 | + |
| 118 | +To fetch information from Github, you have to: |
| 119 | + |
| 120 | +1. go to 'Github' / 'Settings' / 'Sync Object' |
| 121 | + |
| 122 | +2. Select the object type you want to synchronize and its Gthub name |
| 123 | + |
| 124 | + |sync_organization| |
| 125 | + |
| 126 | +3. Once done for your organization(s), go to 'Github' / 'Github |
| 127 | + Commnunity' / 'Organizations' |
| 128 | + |
| 129 | + |github_organization_kanban| |
| 130 | + |
| 131 | +4. Optionally, once organization is created, you can create series for |
| 132 | + your projects. Go to 'Github' / 'Organizations' / click on your |
| 133 | + organization / 'Organization Series' Tabs |
| 134 | + |
| 135 | + |github_organization_series| |
| 136 | + |
| 137 | +Select branches to download |
| 138 | +--------------------------- |
| 139 | + |
| 140 | +This setting will prevent to download undesired branches, downloading |
| 141 | +only main branches (releases): |
| 142 | + |
| 143 | +1. In the 'Settings' tab, set repositories you don't want to download |
| 144 | + (or repositories you want to download). If 'Specific repositories' is |
| 145 | + set, 'Ignored Repositories' value is ignored. |
| 146 | + |
| 147 | +2. In the 'Settings' tab, set the URL of the 'External Services' you use |
| 148 | + for Continuous Integration and Coverage. |
| 149 | + |
| 150 | + |github_organization_external_services| |
| 151 | + |
| 152 | +3. Once done, click on buttons 'Syncs', to synchronize repositories, |
| 153 | + teams and members. (This process can take a while depending of your |
| 154 | + size) |
| 155 | + |
| 156 | + |github_organization_sync_buttons| |
| 157 | + |
| 158 | +Team / members synchronization |
| 159 | +------------------------------ |
| 160 | + |
| 161 | +You can synchronize members teams: |
| 162 | + |
| 163 | +1. Go to 'Teams' / tree view / 'Actions' / 'Update from Github'. |
| 164 | + |
| 165 | + |github_team_kanban| |
| 166 | + |
| 167 | +2. In each team, you can see the members list and the role of the |
| 168 | + members |
| 169 | + |
| 170 | + |github_team_partner_kanban| |
| 171 | + |
| 172 | +3. In each team, you can see the repositories list but not the |
| 173 | + permissions of the team. (See 'Known Issues' Section) |
| 174 | + |
| 175 | + |github_team_repository_kanban| |
| 176 | + |
| 177 | +Repositories synchronization |
| 178 | +---------------------------- |
| 179 | + |
| 180 | +You can synchronize the branches of your repositories: |
| 181 | + |
| 182 | +1. Go to 'Repositories' / tree view / 'Actions' / 'Update from Github' |
| 183 | + |
| 184 | + |github_repository_kanban| |
| 185 | + |
| 186 | +2. In each repository, you can see the main branches list and the size |
| 187 | + of code source. |
| 188 | + |
| 189 | + |github_repository_branch_kanban| |
| 190 | + |
| 191 | +Fetching the source code |
| 192 | +------------------------ |
| 193 | + |
| 194 | +Finally, you can download locally the source code of all your branches: |
| 195 | + |
| 196 | +1. Go to 'Repository Branches' / tree view / 'Actions' / 'Download and |
| 197 | + Analyse Source Code'. |
| 198 | + |
| 199 | + |wizard_download_analyze| |
| 200 | + |
| 201 | +2. In the tree view you can update manually source code or refresh |
| 202 | + analysis. |
| 203 | + |
| 204 | + |github_repository_branch_list| |
| 205 | + |
| 206 | +Analysis source code |
| 207 | +-------------------- |
| 208 | + |
| 209 | +It's possible to create custom analysis rules that relate to a GitHub |
| 210 | +organization, GitHub repository and/or GitHub repository branch to |
| 211 | +analyze code. |
| 212 | + |
| 213 | +1. Go to 'Settings' / 'Analysis rule groups' and create records that |
| 214 | + allow to organize the rules |
| 215 | +2. Go to 'Settings' / 'Analysis rules' and create rules, for example: |
| 216 | + |
| 217 | +.. |
| 218 | +
|
| 219 | + 1. Name: All code, Group: General, Paths: ``*`` |
| 220 | + 2. Name: Python code, Group: General, Paths: ``*.py`` |
| 221 | + 3. Name: Xml code, Group: General, Paths: ``*.xml`` |
| 222 | + 4. Name: Repository 1, Group: Custom, Paths: /path/ |
| 223 | + |
| 224 | +Note: Paths field in 'Analysis rule' allow to put multiple paths for |
| 225 | +line, path format is according to |
| 226 | +https://git-scm.com/docs/gitignore#_pattern_format |
| 227 | + |
| 228 | +1. Go to *GitHub > GitHub Community > Organizations* and define Analysis |
| 229 | + rules (optional) |
| 230 | +2. Go to *GitHub > GitHub Repository > Repositories* and define Analysis |
| 231 | + rules (optional) |
| 232 | +3. Go to *GitHub > GitHub Repository > Repository Branches* and define |
| 233 | + Analysis rules (optional) |
| 234 | + |
| 235 | +Analysis source code is executed when 'Update Source Code Analysis' |
| 236 | +button in some 'Repository Branch', get all the Analysis rules |
| 237 | +(Repository + Organization) and analyze code and generate info about it |
| 238 | +Other option to Analysis source code is in cron called 'Analyze Source |
| 239 | +Code for All Github Branches' |
| 240 | + |
| 241 | +You can see in 'Repository Branch' / 'Code Analysis' the info obtained |
| 242 | +from analysis rules. |
| 243 | + |
| 244 | +Data creation in Github |
| 245 | +----------------------- |
| 246 | + |
| 247 | +You have the possibility to creates two items in Github directly from |
| 248 | +Odoo |
| 249 | + |
| 250 | +1. Teams: |
| 251 | + |
| 252 | + 1. Go to 'Settings' / 'Create Team in Github'. |
| 253 | + 2. Set the information and click on Create in Github. |
| 254 | + 3. Odoo will try to create the team. If access right and datas are |
| 255 | + correct, the creation will be done directly in Github |
| 256 | + 4. Later on, a synchronization will be performed, to create the |
| 257 | + according team in the Odoo instance. |
| 258 | + |
| 259 | + |wizard_create_team| |
| 260 | + |
| 261 | +2. Repositories: |
| 262 | + |
| 263 | + 1. Go to 'Settings' / 'Create Team in Github'. |
| 264 | + 2. Set the information and click on Create in Github. |
| 265 | + |
| 266 | + |wizard_create_repository| |
| 267 | + |
| 268 | +Note |
| 269 | +---- |
| 270 | + |
| 271 | +Analysis in this module is basic: for the time being, it just gives |
| 272 | +branches size. |
| 273 | + |
| 274 | +Nevertheless, you can develop an extra Odoo Custom module to extend |
| 275 | +analysis function and get extra statistics, depending on your needs. |
| 276 | + |
| 277 | +In that way, you can see the module github_connector_odoo, if your |
| 278 | +repositories contain Odoo modules. |
| 279 | + |
| 280 | +Reporting |
| 281 | +--------- |
| 282 | + |
| 283 | +This module provides several reports |
| 284 | + |
| 285 | +**Branches by Serie** |
| 286 | + |
| 287 | +|reporting_branches_by_serie| |
| 288 | + |
| 289 | +**Sizes by Serie** |
| 290 | + |
| 291 | +|reporting_sizes_by_serie| |
| 292 | + |
| 293 | +**Repository branch analysis rule** |
| 294 | + |
| 295 | +|github_repository_branch_rule_info_report| |
| 296 | + |
| 297 | +.. |sync_organization| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/sync_organization.png |
| 298 | +.. |github_organization_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_organization_kanban.png |
| 299 | +.. |github_organization_series| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_organization_series.png |
| 300 | +.. |github_organization_external_services| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_organization_external_services.png |
| 301 | +.. |github_organization_sync_buttons| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_organization_sync_buttons.png |
| 302 | +.. |github_team_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_team_kanban.png |
| 303 | +.. |github_team_partner_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_team_partner_kanban.png |
| 304 | +.. |github_team_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_team_repository_kanban.png |
| 305 | +.. |github_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_repository_kanban.png |
| 306 | +.. |github_repository_branch_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_repository_branch_kanban.png |
| 307 | +.. |wizard_download_analyze| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/wizard_download_analyze.png |
| 308 | +.. |github_repository_branch_list| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_repository_branch_list.png |
| 309 | +.. |wizard_create_team| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/wizard_create_team.png |
| 310 | +.. |wizard_create_repository| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/wizard_create_repository.png |
| 311 | +.. |reporting_branches_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/reporting_branches_by_serie.png |
| 312 | +.. |reporting_sizes_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/reporting_sizes_by_serie.png |
| 313 | +.. |github_repository_branch_rule_info_report| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_repository_branch_rule_info_report.png |
| 314 | + |
| 315 | +Known issues / Roadmap |
| 316 | +====================== |
| 317 | + |
| 318 | +- For the time being, Github API doesn't provide some informations that |
| 319 | + are available by the classic UI, that includes: |
| 320 | + |
| 321 | + 1. team hierarchy: the field is present in the model |
| 322 | + github_team.parent_id, but unused. |
| 323 | + |
| 324 | +- Possible improvements: |
| 325 | + |
| 326 | + 1. Create a new module github_connector_website, that could display |
| 327 | + teams / repositories / branches informations for non logged users. |
| 328 | + 2. Analyze commits (author, quantity by series, etc...): this feature |
| 329 | + has been partially implemented in a V8.0 PR. |
| 330 | + 3. Synchronize Pull Request, Issues, Comments: this feature has been |
| 331 | + partially implemented in a V8.0 PR. |
| 332 | + |
| 333 | +- Refactor the github connector: |
| 334 | + |
| 335 | + A python library called PyGitHub is available. It could be interesting |
| 336 | + to use it, instead of using custom code. However, this lib doesn't |
| 337 | + provide good access to child object, generating for the time being, |
| 338 | + unnecessary API calls. For example, updating a repository should call |
| 339 | + before a call to the parent organization (The current module is so |
| 340 | + faster). |
| 341 | + |
| 342 | +Bug Tracker |
| 343 | +=========== |
| 344 | + |
| 345 | +Bugs are tracked on `GitHub Issues <https://github.com/OCA/interface-github/issues>`_. |
| 346 | +In case of trouble, please check there if your issue has already been reported. |
| 347 | +If you spotted it first, help us to smash it by providing a detailed and welcomed |
| 348 | +`feedback <https://github.com/OCA/interface-github/issues/new?body=module:%20github_connector%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
| 349 | + |
| 350 | +Do not contact contributors directly about support or help with technical issues. |
| 351 | + |
| 352 | +Credits |
| 353 | +======= |
| 354 | + |
| 355 | +Authors |
| 356 | +------- |
| 357 | + |
| 358 | +* GRAP |
| 359 | +* Akretion |
| 360 | +* Tecnativa |
| 361 | + |
| 362 | +Contributors |
| 363 | +------------ |
| 364 | + |
| 365 | +- Sylvain LE GAL (https://twitter.com/legalsylvain) |
| 366 | +- Sébastien BEAU (sebastien.beau@akretion.com) |
| 367 | +- Benoît GUILLOT (benoit.guillot@akretion.com) |
| 368 | +- Enrique Martín (enriquemartin@digital5.es) |
| 369 | +- `Tecnativa <https://www.tecnativa.com>`__:", |
| 370 | + |
| 371 | + - Pedro M. Baeza |
| 372 | + - Vicent Cubells |
| 373 | + - Alexandre Díaz |
| 374 | + - Ernesto Tejeda |
| 375 | + - Carlos Roca |
| 376 | + - Víctor Martínez |
| 377 | + - João Marques |
| 378 | + - Carolina Fernandez |
| 379 | + |
| 380 | +Maintainers |
| 381 | +----------- |
| 382 | + |
| 383 | +This module is maintained by the OCA. |
| 384 | + |
| 385 | +.. image:: https://odoo-community.org/logo.png |
| 386 | + :alt: Odoo Community Association |
| 387 | + :target: https://odoo-community.org |
| 388 | + |
| 389 | +OCA, or the Odoo Community Association, is a nonprofit organization whose |
| 390 | +mission is to support the collaborative development of Odoo features and |
| 391 | +promote its widespread use. |
| 392 | + |
| 393 | +This module is part of the `OCA/interface-github <https://github.com/OCA/interface-github/tree/18.0/github_connector>`_ project on GitHub. |
| 394 | + |
| 395 | +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
0 commit comments