Add parameter to change archive repository URL and check Jenkins version against archive repositories #759
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 PR introduces the ability to set a custom URL for the Jenkins plugin archive repository and adds a flag
--archive
to check if the selected Jenkins version corresponds to archived repositories. If the version is found in the archive, the tool will use the update center from the archive repository; otherwise, it will use the default update center URL.The functionality is implemented through:
--jenkins-archive-repo-mirror
and the corresponding environment variableJENKINS_ARCHIVE_REPO_MIRROR
to configure a custom archive repository mirror URL.--archive
flag to check whether the selected Jenkins version is available in the archived repositories. If the version is archived, the tool will fetch metadata from the archive repository.This allows users to specify an alternative archive repository mirror, making it easier to work with repository mirrors, especially in environments with proxies like
Sonatype Nexus Repository
.If no custom URL is provided, the default value
https://archives.jenkins.io/
will be used, ensuring backward compatibility.Changes
CliOptions.java:
--archive
flag to specify if the tool should use archived update center metadata for plugin dependencies.--jenkins-archive-repo-mirror
CLI option to allow specifying a custom archive repository mirror URL.Config.java:
isUseArchiveAll()
to check if the--archive
flag is set and whether to use archived repository metadata.Settings.java:
PluginManager.java:
--archive
flag. If the version is archived, the tool will use the update center URL from the archive repository.PluginManagerUtils.java:
resolveArchiveUpdateCenterUrl()
method to resolve the URL for the update center based on the Jenkins version and the provided archive mirror URL.Tests:
ConfigArchiveRepoTest.java
to test the new--jenkins-archive-repo-mirror
CLI option and the--archive
flag.--archive
flag.Testing done
Command-line option tests:
ConfigArchiveRepoTest.java
to test the new--jenkins-archive-repo-mirror
CLI option.Archive version checks:
--archive
flag, checking whether the Jenkins version exists in the archive repository and whether the correct update center URL is used.Environment variable tests:
JENKINS_ARCHIVE_REPO_MIRROR
are not yet implemented but can be added if necessary.Submitter checklist