Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4433] Bug/Adding GH Org #4445

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[#4433] Bug/Adding GH Org
- Resolved Github Org installation event issue
- Updated Go version

Signed-off-by: Harold Wanyama <hwanyama@contractor.linuxfoundation.org>
nickmango committed Sep 30, 2024
commit 8d3999b4a7d6f9a4400400bcdb7f78a88d064203
2 changes: 1 addition & 1 deletion .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.20.1'
go-version: '1.23.1'
- name: Go Version
run: go version
- name: Setup Node
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.20.1'
go-version: '1.23.1'
- name: Go Version
run: go version
- name: Setup Node
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.20.1'
go-version: '1.23.1'
check-latest: true
- name: Go Version
run: go version
19 changes: 17 additions & 2 deletions cla-backend/cla/models/dynamo_models.py
Original file line number Diff line number Diff line change
@@ -500,6 +500,20 @@ class Meta:

organization_name_lower = UnicodeAttribute(hash_key=True)

class OrganizationNameLowerSearchIndex(GlobalSecondaryIndex):
"""
This class represents a global secondary index for querying organizations by Organization Name.
"""

class Meta:
"""Meta class for external ID github org index."""

index_name = "organization-name-lower-search-index"
write_capacity_units = int(cla.conf["DYNAMO_WRITE_UNITS"])
read_capacity_units = int(cla.conf["DYNAMO_READ_UNITS"])
projection = AllProjection()

organization_name_lower = UnicodeAttribute(hash_key=True)

class GitlabExternalGroupIDIndex(GlobalSecondaryIndex):
"""
@@ -3817,7 +3831,8 @@ class Meta:
project_sfid = UnicodeAttribute()
organization_sfid_index = GitlabOrgSFIndex()
project_sfid_organization_name_index = GitlabOrgProjectSfidOrganizationNameIndex()
organization_name_lowe_index = GitlabOrganizationNameLowerIndex()
organization_name_lower_index = GitlabOrganizationNameLowerIndex()
organization_name_lower_search_index = OrganizationNameLowerSearchIndex()
organization_project_id = UnicodeAttribute(null=True)
organization_company_id = UnicodeAttribute(null=True)
auto_enabled = BooleanAttribute(null=True)
@@ -3964,7 +3979,7 @@ def get_organization_by_installation_id(self, installation_id):
return None

def get_organization_by_lower_name(self, organization_name):
org_generator = self.model.scan(organization_name_lower__eq=organization_name.lower())
org_generator = self.model.organization_name_lower_search_index.query(organization_name.lower())
for org_model in org_generator:
org = GitHubOrg()
org.model = org_model
2 changes: 1 addition & 1 deletion cla-backend/cla/tests/unit/test_gh_org_models.py
Original file line number Diff line number Diff line change
@@ -35,6 +35,6 @@ def test_set_organization_name(gh_instance):
def test_get_org_by_name_lower(gh_instance):
""" Test getting GitHub org with case insensitive search """
gh_org = cla.utils.get_github_organization_instance()
gh_org.model.scan = Mock(return_value=[gh_instance.model])
gh_org.model.organization_name_lower_search_index.query = Mock(return_value=[gh_instance.model])
found_gh_org = gh_org.get_organization_by_lower_name(gh_instance.get_organization_name())
assert found_gh_org.get_organization_name_lower() == gh_instance.get_organization_name_lower()