Search 1.9 billion lines of Odoo code on GitHub

github_connector

Author: Odoo Community Association (OCA), GRAP, Akretion, Tecnativa
License: AGPL-3
Branch: 15.0
Repository: Gabinete-Digital/interface-github
Dependencies: base, and web
Languages: HTML (612, 11.3%), JSON (600, 11.1%), Python (1763, 32.7%), SVG (132, 2.4%), XML (1920, 35.6%), and reStructuredText (367, 6.8%)
Other branches: 10.0, 11.0, 11.0_FIX_github_modules, 12.0, 12.0-ocabot-merge-pr-44-by-legalsylvain-bump-no, 13.0, and 14.0
Other repositories: Change2improve/interface-github, Dobtor-OCA/interface-github, ERPLibre/interface-github, ForgeFlow/interface-github, Freni-SerpentCS/interface-github, Guobower/interface-github, InformaticaArelux/interface-github, JazziMc/interface-github, MrZ-777/interface-github, Numigi/interface-github, OCA/interface-github, RoelAdriaans/interface-github, SeuMarco/interface-github, StephanRozendaal/interface-github, Tecnativa/interface-github, Vauxoo/interface-github, VisiionSolucionesTecnologicas/interface-github, acsone/interface-github, akretion/interface-github, apetbiz/interface-github, aurestic/interface-github, bizzappdev/interface-github, bjoliveau/oca-custom, czgonroad/interface-github, diagramsoftware/interface-github, efatto/interface-github, grap/interface-github, haroldtamo/interface-github, hbrunn/interface-github, iRichGit/interface-github, jsilvestar/interface-github, legalsylvain/interface-github, legalsylvain/oca-custom-1, leminhooyahoo/interface-github, lideritjnma/interface-github, maartenleijnse/interface-github, murtuzasaleh/interface-github, oscarolar/interface-github, oscars8a/interface-github, pnajman-modoolar/interface-github, pscloud/interface-github, royalline1/interface-github, sanube/interface-github, shiftctrl-io/interface-github, simplifysolutions/interface-github, sunshineLhj/interface-github, and xwh123807/interface-github

<h1 class="title">Github Connector</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/interface-github/tree/15.0/github_connector"><img alt="OCA/interface-github" src="https://img.shields.io/badge/github-OCA%2Finterface--github-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/interface-github-15-0/interface-github-15-0-github_connector"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/229/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This module allows you to:</p> <ul class="simple"> <li>Fetch into Odoo social information from Github (Organizations, Teams, Users)</li> <li>Fetch into Odoo Code structure information from Github (Repositories, Branches)</li> <li>Download source code from Github</li> <li>Analyze repository code from rules previously created</li> </ul> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#installation" id="id1">Installation</a></li> <li><a class="reference internal" href="#configuration" id="id2">Configuration</a><ul> <li><a class="reference internal" href="#technical-information" id="id3">Technical Information</a></li> </ul> </li> <li><a class="reference internal" href="#usage" id="id4">Usage</a><ul> <li><a class="reference internal" href="#initial-upload-from-github" id="id5">Initial upload from Github</a></li> <li><a class="reference internal" href="#select-branches-to-download" id="id6">Select branches to download</a></li> <li><a class="reference internal" href="#team-members-synchronization" id="id7">Team / members synchronization</a></li> <li><a class="reference internal" href="#repositories-synchronization" id="id8">Repositories synchronization</a></li> <li><a class="reference internal" href="#fetching-the-source-code" id="id9">Fetching the source code</a></li> <li><a class="reference internal" href="#analysis-source-code" id="id10">Analysis source code</a></li> <li><a class="reference internal" href="#data-creation-in-github" id="id11">Data creation in Github</a></li> <li><a class="reference internal" href="#note" id="id12">Note</a></li> <li><a class="reference internal" href="#reporting" id="id13">Reporting</a></li> </ul> </li> <li><a class="reference internal" href="#known-issues-roadmap" id="id14">Known issues / Roadmap</a></li> <li><a class="reference internal" href="#bug-tracker" id="id15">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id16">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id17">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id18">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id19">Maintainers</a></li> </ul> </li> </ul> </div> <a name="installation"></a> <h2><a class="toc-backref" href="#id1">Installation</a></h2> <p>To install this addon, you need to install some python dependencies</p> <pre> <code lang="bash">sudo pip install PyGitHub sudo pip install pygount sudo pip install pathspec sudo pip install GitPython</code> </pre> <p>Analysis source code is generated by <a class="reference external" href="https://github.com/roskakori/pygount">https://github.com/roskakori/pygount</a></p> <a name="configuration"></a> <h2><a class="toc-backref" href="#id2">Configuration</a></h2> <p>Once installed, you have to:</p> <ol class="arabic simple"> <li>Open your odoo.conf file and add extra settings to mention Github credentials, and the local path where the source code will be downloaded:<ul> <li><code>source_code_local_path = /workspace/source_code/</code></li> </ul> </li> </ol> <p>Note: you can define the route as environment variable using the key SOURCE_CODE_LOCAL_PATH</p> <p>Note: make sure that Odoo process has read / write access on that folder</p> <blockquote> <ul class="simple"> <li><code>github_token = your_github_access_token</code></li> </ul> </blockquote> <p>Note: The login/password auth has been deprecated by GitHub. <a class="reference external" href="https://docs.github.com/en/rest/overview/other-authentication-methods#via-username-and-password">https://docs.github.com/en/rest/overview/other-authentication-methods#via-username-and-password</a></p> <ol class="arabic"> <li><p class="first">Go to 'Settings' / 'Technical' / 'Parameters' / 'System Parameters' and define the following values:</p> <ol class="arabic simple"> <li><code>github.max_try</code>: number of call to the API before an error is raised. The more unstable/slow your connection, the higher should be this value</li> <li><code>git.partial_commit_during_analysis</code>: Set to <code>True</code> if you want to commit the result of the analysis in the database after each repository analysis. We recommend to set to <code>True</code> when you perform the initial download (potentially with a lot of repositories) in order to reduce the size of the transaction</li> </ol> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_settings.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_settings.png" /> </li> <li><p class="first">Go to your(s) user(s) form to add them in the new 'Connector Github Manager' groups. The members of this group will have the possibility to run Github synchronization.</p> </li> </ol> <a name="technical-information"></a> <h3><a class="toc-backref" href="#id3">Technical Information</a></h3> <p>This module provides 4 crons that you can enable:</p> <ul class="simple"> <li>Synchronize All Organizations and Teams (<code>cron_update_organization</code>)</li> <li>Synchronize Branches List for All repositories (<code>cron_update_branch_list</code>)</li> <li>Download Source Code for All Github Branches (<code>cron_download_code</code>)</li> <li>Analyze Source Code for All Github Branches (<code>cron_analyze_code</code>)</li> </ul> <a name="usage"></a> <h2><a class="toc-backref" href="#id4">Usage</a></h2> <a name="initial-upload-from-github"></a> <h3><a class="toc-backref" href="#id5">Initial upload from Github</a></h3> <p>To fetch information from Github, you have to:</p> <ol class="arabic"> <li><p class="first">go to 'Github' / 'Settings' / 'Sync Object'</p> </li> <li><p class="first">Select the object type you want to synchronize and its Gthub name</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/sync_organization.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/sync_organization.png" /> </li> <li><p class="first">Once done for your organization(s), go to 'Github' / 'Github Commnunity' / 'Organizations'</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_organization_kanban.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_organization_kanban.png" /> </li> <li><p class="first">Optionally, once organization is created, you can create series for your projects. Go to 'Github' / 'Organizations' / click on your organization / 'Organization Series' Tabs</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_organization_series.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_organization_series.png" /> </li> </ol> <a name="select-branches-to-download"></a> <h3><a class="toc-backref" href="#id6">Select branches to download</a></h3> <p>This setting will prevent to download undesired branches, downloading only main branches (releases):</p> <ol class="arabic"> <li><p class="first">In the 'Settings' tab, set repositories you don't want to download (or repositories you want to download). If 'Specific repositories' is set, 'Ignored Repositories' value is ignored.</p> </li> <li><p class="first">In the 'Settings' tab, set the URL of the 'External Services' you use for Continuous Integration and Coverage.</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_organization_external_services.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_organization_external_services.png" /> </li> <li><p class="first">Once done, click on buttons 'Syncs', to synchronize repositories, teams and members. (This process can take a while depending of your size)</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_organization_sync_buttons.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_organization_sync_buttons.png" /> </li> </ol> <a name="team-members-synchronization"></a> <h3><a class="toc-backref" href="#id7">Team / members synchronization</a></h3> <p>You can synchronize members teams:</p> <ol class="arabic"> <li><p class="first">Go to 'Teams' / tree view / 'Actions' / 'Update from Github'.</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_team_kanban.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_team_kanban.png" /> </li> <li><p class="first">In each team, you can see the members list and the role of the members</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_team_partner_kanban.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_team_partner_kanban.png" /> </li> <li><p class="first">In each team, you can see the repositories list but not the permissions of the team. (See 'Known Issues' Section)</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_team_repository_kanban.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_team_repository_kanban.png" /> </li> </ol> <a name="repositories-synchronization"></a> <h3><a class="toc-backref" href="#id8">Repositories synchronization</a></h3> <p>You can synchronize the branches of your repositories:</p> <ol class="arabic"> <li><p class="first">Go to 'Repositories' / tree view / 'Actions' / 'Update from Github'</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_repository_kanban.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_repository_kanban.png" /> </li> <li><p class="first">In each repository, you can see the main branches list and the size of code source.</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_repository_branch_kanban.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_repository_branch_kanban.png" /> </li> </ol> <a name="fetching-the-source-code"></a> <h3><a class="toc-backref" href="#id9">Fetching the source code</a></h3> <p>Finally, you can download locally the source code of all your branches:</p> <ol class="arabic"> <li><p class="first">Go to 'Repository Branches' / tree view / 'Actions' / 'Download and Analyse Source Code'.</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/wizard_download_analyze.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/wizard_download_analyze.png" /> </li> <li><p class="first">In the tree view you can update manually source code or refresh analysis.</p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_repository_branch_list.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_repository_branch_list.png" /> </li> </ol> <a name="analysis-source-code"></a> <h3><a class="toc-backref" href="#id10">Analysis source code</a></h3> <p>It's possible to create custom analysis rules that relate to a GitHub organization, GitHub repository and/or GitHub repository branch to analyze code.</p> <ol class="arabic simple"> <li>Go to 'Settings' / 'Analysis rule groups' and create records that allow to organize the rules</li> <li>Go to 'Settings' / 'Analysis rules' and create rules, for example:</li> </ol> <blockquote> <ol class="arabic simple"> <li>Name: All code, Group: General, Paths: <code>*</code></li> <li>Name: Python code, Group: General, Paths: <code>*.py</code></li> <li>Name: Xml code, Group: General, Paths: <code>*.xml</code></li> <li>Name: Repository 1, Group: Custom, Paths: /path/</li> </ol> </blockquote> <p>Note: Paths field in 'Analysis rule' allow to put multiple paths for line, path format is according to <a class="reference external" href="https://git-scm.com/docs/gitignore#_pattern_format">https://git-scm.com/docs/gitignore#_pattern_format</a></p> <ol class="arabic simple"> <li>Go to <em>GitHub &gt; GitHub Community &gt; Organizations</em> and define Analysis rules (optional)</li> <li>Go to <em>GitHub &gt; GitHub Repository &gt; Repositories</em> and define Analysis rules (optional)</li> <li>Go to <em>GitHub &gt; GitHub Repository &gt; Repository Branches</em> and define Analysis rules (optional)</li> </ol> <p>Analysis source code is executed when 'Update Source Code Analysis' button in some 'Repository Branch', get all the Analysis rules (Repository + Organization) and analyze code and generate info about it Other option to Analysis source code is in cron called 'Analyze Source Code for All Github Branches'</p> <p>You can see in 'Repository Branch' / 'Code Analysis' the info obtained from analysis rules.</p> <a name="data-creation-in-github"></a> <h3><a class="toc-backref" href="#id11">Data creation in Github</a></h3> <p>You have the possibility to creates two items in Github directly from Odoo</p> <ol class="arabic"> <li><p class="first">Teams:</p> <ol class="arabic simple"> <li>Go to 'Settings' / 'Create Team in Github'.</li> <li>Set the information and click on Create in Github.</li> <li>Odoo will try to create the team. If access right and datas are correct, the creation will be done directly in Github</li> <li>Later on, a synchronization will be performed, to create the according team in the Odoo instance.</li> </ol> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/wizard_create_team.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/wizard_create_team.png" /> </li> <li><p class="first">Repositories:</p> <ol class="arabic simple"> <li>Go to 'Settings' / 'Create Team in Github'.</li> <li>Set the information and click on Create in Github.</li> </ol> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/wizard_create_repository.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/wizard_create_repository.png" /> </li> </ol> <a name="note"></a> <h3><a class="toc-backref" href="#id12">Note</a></h3> <p>Analysis in this module is basic: for the time being, it just gives branches size.</p> <p>Nevertheless, you can develop an extra Odoo Custom module to extend analysis function and get extra statistics, depending on your needs.</p> <p>In that way, you can see the module github_connector_odoo, if your repositories contain Odoo modules.</p> <a name="reporting"></a> <h3><a class="toc-backref" href="#id13">Reporting</a></h3> <p>This module provides several reports</p> <p><strong>Branches by Serie</strong></p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/reporting_branches_by_serie.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/reporting_branches_by_serie.png" /> <p><strong>Sizes by Serie</strong></p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/reporting_sizes_by_serie.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/reporting_sizes_by_serie.png" /> <p><strong>Repository branch analysis rule</strong></p> <img alt="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_repository_branch_rule_info_report.png" src="https://raw.githubusercontent.com/OCA/interface-github/15.0/github_connector/static/description/github_repository_branch_rule_info_report.png" /> <a name="known-issues-roadmap"></a> <h2><a class="toc-backref" href="#id14">Known issues / Roadmap</a></h2> <ul> <li><p class="first">For the time being, Github API doesn't provide some informations that are available by the classic UI, that includes:</p> <ol class="arabic simple"> <li>team hierarchy: the field is present in the model github_team.parent_id, but unused.</li> </ol> </li> <li><p class="first">Possible improvements:</p> <ol class="arabic simple"> <li>Create a new module github_connector_website, that could display teams / repositories / branches informations for non logged users.</li> <li>Analyze commits (author, quantity by series, etc...): this feature has been partially implemented in a V8.0 PR.</li> <li>Synchronize Pull Request, Issues, Comments: this feature has been partially implemented in a V8.0 PR.</li> </ol> </li> <li><p class="first">Refactor the github connector:</p> <p>A python library called PyGitHub is available. It could be interesting to use it, instead of using custom code. However, this lib doesn't provide good access to child object, generating for the time being, unnecessary API calls. For example, updating a repository should call before a call to the parent organization (The current module is so faster).</p> </li> </ul> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id15">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/interface-github/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed <a class="reference external" href="https://github.com/OCA/interface-github/issues/new?body=module:%20github_connector%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id16">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id17">Authors</a></h3> <ul class="simple"> <li>GRAP</li> <li>Akretion</li> <li>Tecnativa</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id18">Contributors</a></h3> <ul class="simple"> <li>Sylvain LE GAL (<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>)</li> <li>Sébastien BEAU (<a class="reference external" href="mailto:sebastien.beau&#64;akretion.com">sebastien.beau&#64;akretion.com</a>)</li> <li>Benoît GUILLOT (<a class="reference external" href="mailto:benoit.guillot&#64;akretion.com">benoit.guillot&#64;akretion.com</a>)</li> <li>Enrique Martín (<a class="reference external" href="mailto:enriquemartin&#64;digital5.es">enriquemartin&#64;digital5.es</a>)</li> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:&quot;,<ul> <li>Pedro M. Baeza</li> <li>Vicent Cubells</li> <li>Alexandre Díaz</li> <li>Ernesto Tejeda</li> <li>Carlos Roca</li> <li>Víctor Martínez</li> <li>João Marques</li> </ul> </li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id19">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/interface-github/tree/15.0/github_connector">OCA/interface-github</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>