Skip to content

Commit

Permalink
OJ-39228: fix double uploading bug in git data (#367)
Browse files Browse the repository at this point in the history
* OJ-39228: fix double uploading bug in git data

* OJ-39288: small fix to make sure this works with support gql is false
  • Loading branch information
gavinpitt-jf authored Oct 16, 2024
1 parent 0b82dfa commit 6578747
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion jf_agent/config_file_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def get_ingest_config(
Handles converting our agent config to the jf_ingest IngestionConfig
shared dataclass.
"""
from jf_agent.git.utils import JF_INGEST_SUPPORTED_PROVIDERS
from jf_agent.git.utils import GH_PROVIDER, JF_INGEST_SUPPORTED_PROVIDERS

company_info = get_company_info(config, creds)

Expand Down Expand Up @@ -480,6 +480,12 @@ def get_ingest_config(
instance_creds = list(creds.git_instance_to_creds.values())[0]
instance_slug = endpoint_git_instance_info['slug']

if agent_git_config.git_provider == GH_PROVIDER and not endpoint_git_instance_info.get(
'supports_graphql_endpoints', False
):
# For legacy reasons, to use the JF Ingest adapter for Github you need to have this feature flag enabled
continue

jf_ingest_git_auth_config = _get_jf_ingest_git_auth_config(
company_slug=company_slug,
config=agent_git_config,
Expand Down
6 changes: 6 additions & 0 deletions jf_agent/git/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import logging
from typing import Any, List

from jf_ingest.config import GitProviderInJellyfishRepo

logger = logging.getLogger(__name__)

'''
Expand All @@ -27,6 +29,10 @@
JF_INGEST_SUPPORTED_PROVIDERS = (
GH_PROVIDER,
ADO_PROVIDER,
# Agent and Jellyfish (Direct Connect) enums don't match 100%,
# so this list must account for both
GitProviderInJellyfishRepo.GITHUB.value,
GitProviderInJellyfishRepo.ADO.value,
)


Expand Down
6 changes: 5 additions & 1 deletion jf_agent/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,16 @@ def main():
# JF Ingest
from jf_agent.git.utils import JF_INGEST_SUPPORTED_PROVIDERS

# Extreme paranoia, normalize everything to lowercase
lower_case_supported_providers = [
provider.lower() for provider in JF_INGEST_SUPPORTED_PROVIDERS
]
directories_to_skip_uploading_for.update(
[
f'git_{git_config.instance_file_key}'
for git_config in ingest_config.git_configs
if git_config.git_provider.value.lower()
in JF_INGEST_SUPPORTED_PROVIDERS
in lower_case_supported_providers
]
)
# Jira is supported by all customers, always skip it
Expand Down

0 comments on commit 6578747

Please sign in to comment.