Permalink
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also .
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
- 13 commits
- 8 files changed
- 0 comments
- 7 contributors
Commits on Jul 01, 2021
Commits on Jul 04, 2021
Commits on Jul 05, 2021
Bumps [wiremock-jre8](https://github.com/tomakehurst/wiremock) from 2.28.1 to 2.29.0. - [Release notes](https://github.com/tomakehurst/wiremock/releases) - [Commits](tomakehurst/wiremock@2.28.1...2.29.0) --- updated-dependencies: - dependency-name: com.github.tomakehurst:wiremock-jre8 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [git-changelist-maven-extension](https://github.com/jenkinsci/incrementals-tools) from 1.0-beta-7 to 1.2. - [Release notes](https://github.com/jenkinsci/incrementals-tools/releases) - [Commits](https://github.com/jenkinsci/incrementals-tools/commits/parent-1.2) --- updated-dependencies: - dependency-name: io.jenkins.tools.incrementals:git-changelist-maven-extension dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
Commits on Jul 09, 2021
Commits on Jul 19, 2021
Bumps commons-io from 2.10.0 to 2.11.0. --- updated-dependencies: - dependency-name: commons-io:commons-io dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [wiremock-jre8](https://github.com/tomakehurst/wiremock) from 2.29.0 to 2.29.1. - [Release notes](https://github.com/tomakehurst/wiremock/releases) - [Commits](tomakehurst/wiremock@2.29.0...2.29.1) --- updated-dependencies: - dependency-name: com.github.tomakehurst:wiremock-jre8 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Commits on Jul 26, 2021
Bumps [slf4j-api](https://github.com/qos-ch/slf4j) from 1.7.31 to 1.7.32. - [Release notes](https://github.com/qos-ch/slf4j/releases) - [Commits](https://github.com/qos-ch/slf4j/commits) --- updated-dependencies: - dependency-name: org.slf4j:slf4j-api dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Commits on Aug 02, 2021
Bumps [checkstyle](https://github.com/checkstyle/checkstyle) from 8.44 to 8.45. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](checkstyle/checkstyle@checkstyle-8.44...checkstyle-8.45) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Commits on Aug 09, 2021
Bumps [checkstyle](https://github.com/checkstyle/checkstyle) from 8.45 to 8.45.1. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](checkstyle/checkstyle@checkstyle-8.45...checkstyle-8.45.1) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Commits on Aug 23, 2021
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.11.2 to 3.12.1. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](mockito/mockito@v3.11.2...v3.12.1) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Commits on Aug 24, 2021
Co-authored-by: Lakhtenkov, Igor <lakhti01@kits.kfplc.com> Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
Unified
Split
Showing
with
216 additions
and 168 deletions.
- +1 −1 .mvn/extensions.xml
- +1 −1 README.md
- +2 −2 plugin-management-cli/pom.xml
- +4 −4 plugin-management-library/pom.xml
- +26 −33 plugin-management-library/src/main/java/io/jenkins/tools/pluginmanager/impl/PluginManager.java
- +57 −0 ...ement-library/src/test/java/io/jenkins/tools/pluginmanager/impl/PluginManagerIntegrationTest.java
- +119 −121 plugin-management-library/src/test/java/io/jenkins/tools/pluginmanager/impl/PluginManagerTest.java
- +6 −6 pom.xml
| @@ -2,7 +2,7 @@ | ||
| <extension> | ||
| <groupId>io.jenkins.tools.incrementals</groupId> | ||
| <artifactId>git-changelist-maven-extension</artifactId> | ||
| <version>1.0-beta-7</version> | ||
| <version>1.2</version> | ||
| </extension> | ||
| </extensions> | ||
|
|
||
| @@ -52,7 +52,7 @@ jenkins-plugin-cli --plugin-file /your/path/to/plugins.txt --plugins delivery-pi | ||
| * `--view-security-warnings`: (optional) Set to true to show if any of the user specified plugins have security warnings | ||
| * `--view-all-security-warnings`: (optional) Set to true to show all plugins that have security warnings. | ||
| * `--available-updates`: (optional) Set to true to show if any requested plugins have newer versions available. If a Jenkins version-specific update center is available, the latest plugin version will be determined based on that update center's data. | ||
| * `--output {json,stdout,yaml}`: (optional) Format to output plugin updates file in, stdout is the default. | ||
| * `--output {stdout,yaml,txt}`: (optional) Format to output plugin updates file in, stdout is the default. | ||
| * `--latest false`: (optional) Set to false to download the minimum required version of all dependencies. | ||
| * `--latest-specified`: (optional) (advanced) Set to true to download latest dependencies of any plugin that is requested to have the latest version. All other plugin dependency versions are determined by the update center metadata or the plugin MANIFEST.MF. | ||
| * `--jenkins-update-center`: (optional) Sets the main update center filename, which can also be set via the JENKINS_UC environment variable. If a CLI option is entered, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to https://updates.jenkins.io/update-center.actual.json | ||
| @@ -3,13 +3,13 @@ | ||
| <parent> | ||
| <groupId>io.jenkins.plugin-management</groupId> | ||
| <artifactId>plugin-management-parent-pom</artifactId> | ||
| <version>2.10.0</version> | ||
| <version>2.10.1</version> | ||
| <relativePath>../pom.xml</relativePath> | ||
| </parent> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <artifactId>plugin-management-cli</artifactId> | ||
| <version>2.10.0</version> | ||
| <version>2.10.1</version> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <dependencies> | ||
| @@ -5,12 +5,12 @@ | ||
| <parent> | ||
| <groupId>io.jenkins.plugin-management</groupId> | ||
| <artifactId>plugin-management-parent-pom</artifactId> | ||
| <version>2.10.0</version> | ||
| <version>2.10.1</version> | ||
| <relativePath>../pom.xml</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>plugin-management-library</artifactId> | ||
| <version>2.10.0</version> | ||
| <version>2.10.1</version> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <dependencies> | ||
| @@ -22,7 +22,7 @@ | ||
| <dependency> | ||
| <groupId>commons-io</groupId> | ||
| <artifactId>commons-io</artifactId> | ||
| <version>2.10.0</version> | ||
| <version>2.11.0</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.commons</groupId> | ||
| @@ -67,7 +67,7 @@ | ||
| <dependency> | ||
| <groupId>com.github.tomakehurst</groupId> | ||
| <artifactId>wiremock-jre8</artifactId> | ||
| <version>2.28.1</version> | ||
| <version>2.29.1</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| @@ -796,13 +796,16 @@ public void getUCJson(VersionNumber jenkinsVersion) { | ||
| cm = new CacheManager(Settings.DEFAULT_CACHE_PATH, verbose); | ||
| cm.createCache(); | ||
|
|
||
| String cacheSuffix = jenkinsVersion != null ? "-" + jenkinsVersion.toString(): ""; | ||
| String cacheSuffix = jenkinsVersion != null ? "-" + jenkinsVersion : ""; | ||
| try { | ||
| URIBuilder uriBuilder = new URIBuilder(cfg.getJenkinsUc().toURI()); | ||
| if (jenkinsVersion != null) { | ||
| uriBuilder.addParameter("version", jenkinsVersion.toString()).build(); | ||
| } | ||
| latestUcJson = getJson(uriBuilder.build().toURL(), "update-center" + cacheSuffix); | ||
| URL url = uriBuilder.build().toURL(); | ||
| logVerbose("Update center URL: " + url); | ||
|
|
||
| latestUcJson = getJson(url, "update-center" + cacheSuffix); | ||
| } catch (MalformedURLException | URISyntaxException e) { | ||
| throw new RuntimeException(e); | ||
| } | ||
| @@ -924,11 +927,6 @@ public VersionNumber getLatestPluginVersion(Plugin dependendantPlugin, String pl | ||
| String pluginName = pluginInfo[0]; | ||
| String pluginVersion = pluginInfo[1]; | ||
| Plugin dependentPlugin = new Plugin(pluginName, pluginVersion, null, null); | ||
| if (useLatestSpecified && plugin.isLatest() || useLatestAll) { | ||
| VersionNumber latestPluginVersion = getLatestPluginVersion(plugin, pluginName); | ||
| dependentPlugin.setVersion(latestPluginVersion); | ||
| dependentPlugin.setLatest(true); | ||
| } | ||
| dependentPlugin.setOptional(dependency.contains("resolution:=optional")); | ||
|
|
||
| dependentPlugins.add(dependentPlugin); | ||
| @@ -974,24 +972,8 @@ public VersionNumber getLatestPluginVersion(Plugin dependendantPlugin, String pl | ||
| Plugin dependentPlugin = new Plugin(pluginName, pluginVersion, null, null); | ||
| dependentPlugin.setOptional(dependency.getBoolean("optional")); | ||
| dependentPlugin.setParent(plugin); | ||
|
|
||
| try { | ||
| if (useLatestSpecified && plugin.isLatest() || useLatestAll) { | ||
| VersionNumber latestPluginVersion = getLatestPluginVersion(plugin, pluginName); | ||
| dependentPlugin.setVersion(latestPluginVersion); | ||
| dependentPlugin.setLatest(true); | ||
| } | ||
| dependentPlugins.add(dependentPlugin); | ||
| } catch (PluginNotFoundException e) { | ||
| if (!dependentPlugin.getOptional()) { | ||
| throw e; | ||
| } | ||
| logVerbose(String.format( | ||
| "%s unable to find optional plugin %s in update center %s. " + | ||
| "Ignoring until it becomes required.", e.getOriginatorPluginAndDependencyChain(), | ||
| pluginName, jenkinsUcLatest)); | ||
| } | ||
| } | ||
| dependentPlugins.add(dependentPlugin); | ||
| } | ||
|
|
||
| logVerbose(dependentPlugins.isEmpty() ? String.format("%n%s has no dependencies", plugin.getName()) : | ||
| String.format("%n%s depends on: %n", plugin.getName()) + | ||
| @@ -1079,15 +1061,8 @@ public VersionNumber getLatestPluginVersion(Plugin dependendantPlugin, String pl | ||
| String dependencyName = p.getName(); | ||
| Plugin pinnedPlugin = topLevelDependencies != null ? topLevelDependencies.get(dependencyName) : null; | ||
|
|
||
| // See https://github.com/jenkinsci/plugin-installation-manager-tool/pull/102 | ||
| if (pinnedPlugin != null) { // There is a top-level plugin with the same ID | ||
| if (pinnedPlugin.getVersion().isNewerThanOrEqualTo(p.getVersion()) || pinnedPlugin.getVersion().equals(LATEST)) { | ||
| if (verbose) { | ||
| logVerbose(String.format("Skipping dependency %s:%s and its sub-dependencies, because there is a higher version defined on the top level - %s:%s", | ||
| p.getName(), p.getVersion(), pinnedPlugin.getName(), pinnedPlugin.getVersion())); | ||
| } | ||
| continue; | ||
| } else { | ||
| if (pinnedPlugin.getVersion().isOlderThan(p.getVersion()) && !pinnedPlugin.getVersion().equals(LATEST)) { | ||
| String message = String.format("depends on %s:%s, but there is an older version defined on the top level - %s:%s", | ||
| p.getName(), p.getVersion(), pinnedPlugin.getName(), pinnedPlugin.getVersion()); | ||
| PluginDependencyException exception = new PluginDependencyException(dependency, message); | ||
| @@ -1096,6 +1071,24 @@ public VersionNumber getLatestPluginVersion(Plugin dependendantPlugin, String pl | ||
| } else { | ||
| throw exception; | ||
| } | ||
| } else { | ||
| logVerbose(String.format("Skipping dependency %s:%s and its sub-dependencies, because there is a higher version defined on the top level - %s:%s", | ||
| p.getName(), p.getVersion(), pinnedPlugin.getName(), pinnedPlugin.getVersion())); | ||
| continue; | ||
| } | ||
| } else if (useLatestSpecified && dependency.isLatest() || useLatestAll) { | ||
| try { | ||
| VersionNumber latestPluginVersion = getLatestPluginVersion(dependency, p.getName()); | ||
| p.setVersion(latestPluginVersion); | ||
| p.setLatest(true); | ||
| } catch (PluginNotFoundException e) { | ||
| if (!p.getOptional()) { | ||
| throw e; | ||
| } | ||
| logVerbose(String.format( | ||
| "%s unable to find optional plugin %s in update center %s. " + | ||
| "Ignoring until it becomes required.", e.getOriginatorPluginAndDependencyChain(), | ||
| dependencyName, jenkinsUcLatest)); | ||
| } | ||
| } | ||
|
|
||
| @@ -228,6 +228,63 @@ public void allowsLatestTopLevelDependency() throws IOException { | ||
| assertThatNoException(); | ||
| } | ||
|
|
||
| @Test | ||
| public void latestAllPinnedPluginsIsLowerThanLatest() throws Exception { | ||
| // given | ||
| Plugin mailer = new Plugin("mailer", "1.34", null, null); | ||
| Plugin pinnedDisplayUrlApi = new Plugin("display-url-api", "2.3.4", null, null); | ||
|
|
||
| List<Plugin> requestedPlugins = new ArrayList<>(Arrays.asList(mailer, pinnedDisplayUrlApi)); | ||
|
|
||
| // when | ||
| PluginManager pluginManager = initPluginManager( | ||
| configBuilder -> configBuilder.withPlugins(requestedPlugins).withUseLatestAll(true)); | ||
|
|
||
| // then | ||
| Map<String, Plugin> pluginsAndDependencies = pluginManager.findPluginsAndDependencies(requestedPlugins); | ||
|
|
||
| assertThat(pluginsAndDependencies.values()).containsExactlyInAnyOrder( | ||
| mailer, pinnedDisplayUrlApi); | ||
| } | ||
|
|
||
| @Test | ||
| public void latestSpecifiedPinnedPluginsIsLowerThanLatest() throws Exception { | ||
| // given | ||
| Plugin testweaver = new Plugin("testweaver", "1.0.1", null, null); | ||
| Plugin pinnedStructs = new Plugin("structs", "1.18", null, null); | ||
|
|
||
| List<Plugin> requestedPlugins = new ArrayList<>(Arrays.asList(testweaver, pinnedStructs)); | ||
|
|
||
| // when | ||
| PluginManager pluginManager = initPluginManager( | ||
| configBuilder -> configBuilder.withPlugins(requestedPlugins).withUseLatestSpecified(true)); | ||
|
|
||
| // then | ||
| Map<String, Plugin> pluginsAndDependencies = pluginManager.findPluginsAndDependencies(requestedPlugins); | ||
|
|
||
| assertThat(pluginsAndDependencies.values()).containsExactlyInAnyOrder( | ||
| testweaver, pinnedStructs); | ||
| } | ||
|
|
||
| @Test | ||
| public void latestSpecifiedNoPinned() throws Exception { | ||
| // given | ||
| Plugin testweaver = new Plugin("testweaver", "latest", null, null); | ||
| Plugin structs = new Plugin("structs", "1.7", null, null); | ||
|
|
||
| List<Plugin> requestedPlugins = new ArrayList<>(Arrays.asList(testweaver)); | ||
|
|
||
| // when | ||
| PluginManager pluginManager = initPluginManager( | ||
| configBuilder -> configBuilder.withPlugins(requestedPlugins).withUseLatestSpecified(true)); | ||
|
|
||
| // then | ||
| Map<String, Plugin> pluginsAndDependencies = pluginManager.findPluginsAndDependencies(requestedPlugins); | ||
|
|
||
| assertThat(pluginsAndDependencies.values()).hasSameElementsAs( | ||
| pluginManager.getLatestVersionsOfPlugins(Arrays.asList(testweaver, structs))); | ||
| } | ||
|
|
||
| @Test | ||
| public void verifyDownloads_smoke() throws Exception { | ||
|
|
||
Oops, something went wrong.