Add support for parameterized repository URLs and tests in GitHubSCMBuilder - #1557
Open
itsvshreyas wants to merge 2 commits into
Open
Conversation
Signed-off-by: Venkata Shreyas Kabekkodu <venkatashreyas.kabekkodu@fmr.com>
…lder Signed-off-by: Venkata Shreyas Kabekkodu <venkatashreyas.kabekkodu@fmr.com>
Author
|
Hi @jenkinsci/github-branch-source-plugin-developers , All tests have passed. Can someone please review this? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request implements support for parameterized repository names and owners in the GitHub Branch Source Plugin. See JENKINS-1543 for further information.
Changes Summary
Issue #1543 : Support parameterized repository names in GitHub SCM
Closes #1543
Users can now use Jenkins build parameters in their GitHub SCM configuration:
Implementation Details
Code Changes to GitHubSCMBuilder.java:
checkoutRepositoryUrlandconfiguredByUrlto store the original repository URL configurationsource.getRepositoryUrl()andsource.isConfiguredByUrl()withGitHubRemote()method to preserve the checkout repository URL when configured by URL, enabling parameter expansion to work correctly during Git checkoutHow It Works:
${repo},${owner}) are stored as-is in GitHubSCMSourcegetParamExpandedRepos()method automatically expands Jenkins${parameter}references using build environment variablesTest Coverage Added:
given__parameterized_repository_owner__when__checkout_remote_is_expanded__then__repository_is_selected- Tests parameter expansion for repository owner (${owner})given__parameterized_owner_and_repository__when__checkout_remote_is_expanded__then__repository_is_selected- Tests parameter expansion for both owner and repository (${owner}/${repo})Testing Verification
✅ All 92 tests in GitHubSCMBuilderTest pass
✅ No linting issues (spotless:check passes)
✅ Code formatted correctly
✅ 100% coverage for new code and tests
Submitter checklist
Reviewer checklist
Documentation changes
Manual Test Instructions for Reviewers
To verify this fix works end-to-end:
Create a parameterized job in Jenkins with:
repowith default valuetest-repoownerwith default valuemy-orgConfigure GitHub SCM in the job with:
Repository: owner/{repo}Run the job with different parameter values:
owner=my-org, repo=my-repoowner=other-org, repo=other-repo${owner}/${repo})Test Coverage:
mvn test -Dtest=GitHubSCMBuilderTestmvn spotless:check- Should pass with no formatting issuesUsers/aliases to notify
cc: @jenkinsci/github-branch-source-plugin-maintainers