Skip to content

Conversation

@SergK
Copy link
Member

@SergK SergK commented Oct 24, 2025

Consolidate duplicated git repository setup code across chain handlers into a reusable PrepareGitRepository function and GitRepositoryContext struct.

Changes:

  • Add GitRepositoryContext struct to hold git operation context
  • Add PrepareGitRepository function for common git setup workflow
  • Refactor PutDeployConfigs to use PrepareGitRepository
  • Refactor PutGitLabCIConfig to use PrepareGitRepository
  • Add comprehensive unit tests for PrepareGitRepository

This reduces code duplication and improves maintainability by centralizing GitServer retrieval, SSH credential extraction, repository cloning, and branch checkout logic.

Fixes #229

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking change which improves an existing feature or documentation)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Checklist:

  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Pull Request contains one commit. I squash my commits.

@SergK SergK requested a review from a team as a code owner October 24, 2025 08:09
@SergK SergK requested a review from zmotso October 24, 2025 08:15
Consolidate duplicated git repository setup code across chain handlers
into a reusable PrepareGitRepository function and GitRepositoryContext struct.

Changes:
- Add GitRepositoryContext struct to hold git operation context
- Add PrepareGitRepository function for common git setup workflow
- Refactor PutDeployConfigs to use PrepareGitRepository
- Refactor PutGitLabCIConfig to use PrepareGitRepository
- Add comprehensive unit tests for PrepareGitRepository

This reduces code duplication and improves maintainability by
centralizing GitServer retrieval, SSH credential extraction,
repository cloning, and branch checkout logic.

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
@SergK SergK force-pushed the refactor-git-checkout branch from 462192a to c45f9c4 Compare October 24, 2025 08:18
@SergK SergK merged commit eb7116c into master Oct 27, 2025
3 checks passed
@SergK SergK deleted the refactor-git-checkout branch October 27, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Extract common git repository preparation logic into reusable function

3 participants