Skip to content

Commit

Permalink
[MIG] github_connector: Migration to 17.0
Browse files Browse the repository at this point in the history
TT51638
  • Loading branch information
victoralmau committed Nov 8, 2024
1 parent bb5dbe1 commit 4d989c6
Show file tree
Hide file tree
Showing 24 changed files with 264 additions and 273 deletions.
70 changes: 35 additions & 35 deletions github_connector/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@ To fetch information from Github, you have to:

2. Select the object type you want to synchronize and its Gthub name

|image|
|sync_organization|

3. Once done for your organization(s), go to 'Github' / 'Github
Commnunity' / 'Organizations'

|image1|
|github_organization_kanban|

4. Optionally, once organization is created, you can create series for
your projects. Go to 'Github' / 'Organizations' / click on your
organization / 'Organization Series' Tabs

|image2|
|github_organization_series|

Select branches to download
---------------------------
Expand All @@ -148,13 +148,13 @@ only main branches (releases):
2. In the 'Settings' tab, set the URL of the 'External Services' you use
for Continuous Integration and Coverage.

|image3|
|github_organization_external_services|

3. Once done, click on buttons 'Syncs', to synchronize repositories,
teams and members. (This process can take a while depending of your
size)

|image4|
|github_organization_sync_buttons|

Team / members synchronization
------------------------------
Expand All @@ -163,17 +163,17 @@ You can synchronize members teams:

1. Go to 'Teams' / tree view / 'Actions' / 'Update from Github'.

|image5|
|github_team_kanban|

2. In each team, you can see the members list and the role of the
members

|image6|
|github_team_partner_kanban|

3. In each team, you can see the repositories list but not the
permissions of the team. (See 'Known Issues' Section)

|image7|
|github_team_repository_kanban|

Repositories synchronization
----------------------------
Expand All @@ -182,12 +182,12 @@ You can synchronize the branches of your repositories:

1. Go to 'Repositories' / tree view / 'Actions' / 'Update from Github'

|image8|
|github_repository_kanban|

2. In each repository, you can see the main branches list and the size
of code source.

|image9|
|github_repository_branch_kanban|

Fetching the source code
------------------------
Expand All @@ -197,12 +197,12 @@ Finally, you can download locally the source code of all your branches:
1. Go to 'Repository Branches' / tree view / 'Actions' / 'Download and
Analyse Source Code'.

|image10|
|wizard_download_analyze|

2. In the tree view you can update manually source code or refresh
analysis.

|image11|
|github_repository_branch_list|

Analysis source code
--------------------
Expand Down Expand Up @@ -257,14 +257,14 @@ Odoo
4. Later on, a synchronization will be performed, to create the
according team in the Odoo instance.

|image12|
|wizard_create_team|

2. Repositories:

1. Go to 'Settings' / 'Create Team in Github'.
2. Set the information and click on Create in Github.

|image13|
|wizard_create_repository|

Note
----
Expand All @@ -285,33 +285,33 @@ This module provides several reports

**Branches by Serie**

|image14|
|reporting_branches_by_serie|

**Sizes by Serie**

|image15|
|reporting_sizes_by_serie|

**Repository branch analysis rule**

|image16|

.. |image| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/sync_organization.png
.. |image1| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_kanban.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_series.png
.. |image3| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_external_services.png
.. |image4| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_sync_buttons.png
.. |image5| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_kanban.png
.. |image6| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_partner_kanban.png
.. |image7| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_repository_kanban.png
.. |image8| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_kanban.png
.. |image9| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_kanban.png
.. |image10| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_download_analyze.png
.. |image11| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_list.png
.. |image12| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_team.png
.. |image13| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_repository.png
.. |image14| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_branches_by_serie.png
.. |image15| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_sizes_by_serie.png
.. |image16| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_rule_info_report.png
|github_repository_branch_rule_info_report|

.. |sync_organization| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/sync_organization.png
.. |github_organization_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_kanban.png
.. |github_organization_series| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_series.png
.. |github_organization_external_services| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_external_services.png
.. |github_organization_sync_buttons| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_sync_buttons.png
.. |github_team_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_kanban.png
.. |github_team_partner_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_partner_kanban.png
.. |github_team_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_repository_kanban.png
.. |github_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_kanban.png
.. |github_repository_branch_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_kanban.png
.. |wizard_download_analyze| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_download_analyze.png
.. |github_repository_branch_list| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_list.png
.. |wizard_create_team| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_team.png
.. |wizard_create_repository| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_repository.png
.. |reporting_branches_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_branches_by_serie.png
.. |reporting_sizes_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_sizes_by_serie.png
.. |github_repository_branch_rule_info_report| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_rule_info_report.png

Known issues / Roadmap
======================
Expand Down
2 changes: 1 addition & 1 deletion github_connector/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "Github Connector",
"summary": "Synchronize information from Github repositories",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Connector",
"license": "AGPL-3",
"author": "Odoo Community Association (OCA), GRAP, Akretion, Tecnativa",
Expand Down
6 changes: 0 additions & 6 deletions github_connector/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -1457,9 +1457,3 @@ msgstr "o"
#, python-format
msgid "source_code_local_path should be defined in your configuration file"
msgstr "source_code_local_path debe definirse en su archivo de configuración"

#~ msgid "# String"
#~ msgstr "# Cadena"

#~ msgid "Total string"
#~ msgstr "Total cadena"
3 changes: 2 additions & 1 deletion github_connector/models/abstract_github_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ def create_from_name(self, name):
else:
try:
# Try to get an organization 1st.
# An organization is always an user, but a user is not necessarily an org.
# An organization is always an user, but a user is not necessarily
# an org.
gh_obj = gh_api.get_organization(p_name)
except UnknownObjectException:
# Try to get an user.
Expand Down
7 changes: 2 additions & 5 deletions github_connector/models/github_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,8 @@ def _compute_team_qty(self):
@api.depends("name", "organization_id.github_name")
def _compute_complete_name(self):
for repository in self:
repository.complete_name = "%(login)s/%(rep_name)s" % (
{
"login": repository.organization_id.github_name,
"rep_name": repository.name or "",
}
repository.complete_name = "{}/{}".format(
repository.organization_id.github_name, repository.name or ""
)

@api.depends("repository_branch_ids.repository_id")
Expand Down
2 changes: 1 addition & 1 deletion github_connector/models/github_repository_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _download_code(self):
)
% (branch.local_path)
) from None
command = ("git clone %s -b %s %s") % (
command = ("git clone {} -b {} {}").format(
gh_repo.clone_url,
branch.name,
branch.local_path,
Expand Down
34 changes: 17 additions & 17 deletions github_connector/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ To fetch information from Github, you have to:

2. Select the object type you want to synchronize and its Gthub name

![image](../static/description/sync_organization.png)
![sync_organization](static/description/sync_organization.png)

3. Once done for your organization(s), go to 'Github' / 'Github
Commnunity' / 'Organizations'

![image](../static/description/github_organization_kanban.png)
![github_organization_kanban](static/description/github_organization_kanban.png)

4. Optionally, once organization is created, you can create series for
your projects. Go to 'Github' / 'Organizations' / click on your
organization / 'Organization Series' Tabs

![image](../static/description/github_organization_series.png)
![github_organization_series](static/description/github_organization_series.png)

## Select branches to download

Expand All @@ -31,44 +31,44 @@ only main branches (releases):
2. In the 'Settings' tab, set the URL of the 'External Services' you
use for Continuous Integration and Coverage.

![image](../static/description/github_organization_external_services.png)
![github_organization_external_services](static/description/github_organization_external_services.png)

3. Once done, click on buttons 'Syncs', to synchronize repositories,
teams and members. (This process can take a while depending of your
size)

![image](../static/description/github_organization_sync_buttons.png)
![github_organization_sync_buttons](static/description/github_organization_sync_buttons.png)

## Team / members synchronization

You can synchronize members teams:

1. Go to 'Teams' / tree view / 'Actions' / 'Update from Github'.

![image](../static/description/github_team_kanban.png)
![github_team_kanban](static/description/github_team_kanban.png)

2. In each team, you can see the members list and the role of the
members

![image](../static/description/github_team_partner_kanban.png)
![github_team_partner_kanban](static/description/github_team_partner_kanban.png)

3. In each team, you can see the repositories list but not the
permissions of the team. (See 'Known Issues' Section)

![image](../static/description/github_team_repository_kanban.png)
![github_team_repository_kanban](static/description/github_team_repository_kanban.png)

## Repositories synchronization

You can synchronize the branches of your repositories:

1. Go to 'Repositories' / tree view / 'Actions' / 'Update from Github'

![image](../static/description/github_repository_kanban.png)
![github_repository_kanban](static/description/github_repository_kanban.png)

2. In each repository, you can see the main branches list and the size
of code source.

![image](../static/description/github_repository_branch_kanban.png)
![github_repository_branch_kanban](static/description/github_repository_branch_kanban.png)

## Fetching the source code

Expand All @@ -77,12 +77,12 @@ Finally, you can download locally the source code of all your branches:
1. Go to 'Repository Branches' / tree view / 'Actions' / 'Download and
Analyse Source Code'.

![image](../static/description/wizard_download_analyze.png)
![wizard_download_analyze](static/description/wizard_download_analyze.png)

2. In the tree view you can update manually source code or refresh
analysis.

![image](../static/description/github_repository_branch_list.png)
![github_repository_branch_list](static/description/github_repository_branch_list.png)

## Analysis source code

Expand Down Expand Up @@ -133,14 +133,14 @@ Odoo
4. Later on, a synchronization will be performed, to create the
according team in the Odoo instance.

![image](../static/description/wizard_create_team.png)
![wizard_create_team](static/description/wizard_create_team.png)

2. Repositories:

1. Go to 'Settings' / 'Create Team in Github'.
2. Set the information and click on Create in Github.

![image](../static/description/wizard_create_repository.png)
![wizard_create_repository](static/description/wizard_create_repository.png)

## Note

Expand All @@ -159,12 +159,12 @@ This module provides several reports

**Branches by Serie**

![image](../static/description/reporting_branches_by_serie.png)
![reporting_branches_by_serie](static/description/reporting_branches_by_serie.png)

**Sizes by Serie**

![image](../static/description/reporting_sizes_by_serie.png)
![reporting_sizes_by_serie](static/description/reporting_sizes_by_serie.png)

**Repository branch analysis rule**

![image](../static/description/github_repository_branch_rule_info_report.png)
![github_repository_branch_rule_info_report](static/description/github_repository_branch_rule_info_report.png)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GithubRepositoryBranchRuleInfoReport(models.Model):

@property
def _table_query(self):
return "%s %s %s" % (self._select(), self._from(), self._group_by())
return f"{self._select()} {self._from()} {self._group_by()}"

@api.model
def _select(self):
Expand All @@ -63,8 +63,10 @@ def _from(self):
FROM github_repository_branch_rule_info as grbri
LEFT JOIN github_analysis_rule as gar ON grbri.analysis_rule_id = gar.id
LEFT JOIN github_analysis_rule_group as garg ON gar.group_id = garg.id
LEFT JOIN github_repository_branch as grb ON grbri.repository_branch_id = grb.id
LEFT JOIN github_organization_serie as gos ON grb.organization_serie_id = gos.id
LEFT JOIN github_repository_branch as grb
ON grbri.repository_branch_id = grb.id
LEFT JOIN github_organization_serie as gos
ON grb.organization_serie_id = gos.id
LEFT JOIN github_repository as gr ON grb.repository_id = gr.id
"""

Expand Down
Loading

0 comments on commit 4d989c6

Please sign in to comment.