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

change the apis to support the multi jira #545

Merged
merged 4 commits into from
Dec 30, 2024

Conversation

jnathangreeg
Copy link
Contributor

@jnathangreeg jnathangreeg commented Dec 30, 2024

PR Type

Enhancement


Description

  • Enhanced Jira integration to support multiple Jira connections using V2 API endpoints
  • Added jiraCollabGUID parameter to all Jira-related API calls for multi-Jira support
  • Updated test infrastructure to handle multiple Jira configurations
  • Modified issue template to include collaborationGUID field
  • Added helper methods to retrieve Jira collaboration GUID from config
  • Updated API endpoint paths to use V2 versions (/configV2, /issueV2, etc.)

Changes walkthrough 📝

Relevant files
Enhancement
backend_api.py
Update Jira integration API endpoints to V2 version           

infrastructure/backend_api.py

  • Updated API endpoints to use V2 versions for Jira integration
  • Modified method names and URLs for Jira-related API calls
  • Updated integration status and configuration endpoints
  • +8/-8     
    jira_workflows.py
    Add Jira collaboration GUID support to workflows                 

    tests_scripts/workflows/jira_workflows.py

  • Added method to get Jira collaboration GUID
  • Updated workflow creation to use dynamic collaboration GUID
  • Removed unused imports
  • +15/-4   
    Tests
    jira_integration.py
    Add multi-Jira support to integration tests                           

    tests_scripts/helm/jira_integration.py

  • Added support for multiple Jira connections using jiraCollabGUID
  • Updated API calls to use new V2 endpoints
  • Added new method to get Jira collaboration GUID
  • Modified tests to handle multiple Jira configurations
  • +27/-7   
    Configuration changes
    issueTmpl.json
    Add collaboration GUID to issue template                                 

    configurations/integrations/issueTmpl.json

    • Added collaborationGUID field to issue template
    +1/-0     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Method Name Error

    The method name 'laget_integration_status' appears to be a typo and should be 'get_integration_status' to maintain consistent naming conventions

    def get_sessions(self, container, component):
    Code Duplication

    The get_jira_collaboration_guid method is duplicated across multiple files. Consider moving it to a shared utility class

    def get_jira_collaboration_guid(self):
        config = self.backend.get_jira_config()
        jira_connections = config.get("jiraConnections", [])
        if not jira_connections:
            raise Exception("No Jira connections found in the response")
        collabGUID = jira_connections[0].get("jiraCollabGUID", "")
        if not collabGUID:
            raise Exception("Jira collaboration GUID is empty or missing")
        return collabGUID

    Copy link

    codiumai-pr-agent-free bot commented Dec 30, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    ✅ Fix method name typo to maintain consistent naming conventions
    Suggestion Impact:The method name was changed from 'laget_integration_status' to 'get_integration_status' exactly as suggested

    code diff:

    -    def laget_integration_status(self, provider: str):
    +    def get_integration_status(self, provider: str):

    The method name laget_integration_status appears to be a typo. It should be
    get_integration_status to maintain consistent naming conventions and clarity.

    infrastructure/backend_api.py [2881-2882]

    -def laget_integration_status(self, provider: str):
    +def get_integration_status(self, provider: str):
         url = API_INTEGRATIONS + "/connectionV2/status"
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The typo in method name 'laget_integration_status' could cause confusion and breaks naming conventions. This is a significant issue as it affects API consistency and code readability.

    8
    Improve error handling with more descriptive error messages

    Add error handling for the case when no Jira status is found in the connection
    status list to provide a more descriptive error message.

    tests_scripts/helm/jira_integration.py [64-65]

     jiraStatus = next((status for status in connectionStatus if status['provider'] == 'jira'), None)
    -assert jiraStatus, "Jira is missing form connection status"
    +if not jiraStatus:
    +    raise ValueError("No Jira provider found in connection status. Available providers: " + 
    +                    ", ".join(status['provider'] for status in connectionStatus))
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Enhanced error message would make debugging easier by providing more context about available providers when Jira status is missing.

    6
    Remove duplicate variable assignment to prevent potential confusion

    Remove the duplicate assignment of projectsResp variable which could lead to
    confusion and potential bugs.

    tests_scripts/helm/jira_integration.py [76]

    -projectsResp = projectsResp = self.backend.search_jira_projects({'innerFilters': [{'jiraCollabGUID': jiraCollaborationGUID, 'siteId': site['id'], 'name': 'Jira System Tests'}]})
    +projectsResp = self.backend.search_jira_projects({'innerFilters': [{'jiraCollabGUID': jiraCollaborationGUID, 'siteId': site['id'], 'name': 'Jira System Tests'}]})
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: The duplicate assignment of 'projectsResp' is a minor code quality issue that could lead to confusion but doesn't affect functionality.

    5

    Copy link

    Failed to generate code suggestions for PR

    @@ -58,21 +58,22 @@ def start(self):

    def setup_jira_config(self):
    Logger.logger.info('check jira connection status')
    connectionStatus = self.backend.get_integration_status("jira")
    connectionStatus = self.backend.laget_integration_status("jira")
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    should be latest

    @jnathangreeg jnathangreeg merged commit 15eb4d5 into master Dec 30, 2024
    2 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants