Skip to content

Ensure valid plugin version used when --latest=false #865

@rrjjvv

Description

@rrjjvv

What feature do you want to see added?

As of this moment there is bad/incorrect data (details below) in the update center causing the installation of a specific plugin to fail. It claims a dependency on a plugin version that does not exist, but there is a version that satisfies the bounds. It would be nice if the tool was able to handle this case. Alternatively, outputting a message warning that the resolved version isn't valid would be helpful.

I have not looked at the code yet, but I'm assuming this isn't a bug in the tool (and that it wasn't intended to treat versions like full range specifications).

UC data for problematic plugin

The plugin I'm installing is git-forensics:3.2138.vf25ea_d549e33 (latest released version):

$ jq '.plugins."git-forensics"."3.2138.vf25ea_d549e33"' plugin-versions.json
{
  "buildDate": "Sep 25, 2025",
  "dependencies": [
    {
      "name": "commons-lang3-api",
      "optional": false,
      "version": "3.18.0-98.v3a_674c06072d"
    },
    {
      "name": "commons-text-api",
      "optional": false,
      "version": "1.14.0-194.v804a_dc3a_1b_d8"
    },
    {
      "name": "font-awesome-api",
      "optional": false,
      "version": "7.0.1-859.v128d3a_efb_6e5"
    },
    {
      "name": "forensics-api",
      "optional": false,
      "version": "3.1754.v2a_6613b_77002"
    },
    {
      "name": "plugin-util-api",
      "optional": false,
      "version": "6.1183.vdfd884091c0e"
    },
    {
      "name": "branch-api",
      "optional": false,
      "version": "2.1244.vf95c81f1641c"
    },
    {
      "name": "git",
      "optional": false,
      "version": "5.7.0"
    }
  ],
  "name": "git-forensics",
  "releaseTimestamp": "2025-09-25T19:18:00.00Z",
  "requiredCore": "2.516.3",
  "sha1": "Io9YiAtFBN3i3GvmhPASGs8BNtQ=",
  "sha256": "M6q+NYlVfQMZfYvd1fiQAnHn9pqlrtfegUn2S3zRN/M=",
  "url": "https://updates.jenkins.io/download/plugins/git-forensics/3.2138.vf25ea_d549e33/git-forensics.hpi",
  "version": "3.2138.vf25ea_d549e33"
}

Note it's calling for plugin-util-api:6.1183.vdfd884091c0e, which does not exist:

$ jq '.plugins."plugin-util-api"|keys' plugin-versions.json
[
<snip>
  "6.0.0",
  "6.1.0",
  "6.1154.ved7e7d3035a_5",
  "6.1157.vc75ef7129d86",
  "6.1165.v322e76215b_a_4",
  "6.1167.v022176c7e0ca_",
  "6.1192.v30fe6e2837ff"
]

Thus, jenkins-plugin-cli -p git-forensics:3.2138.vf25ea_d549e33 --latest=false fails because the transitive plugin doesn't exist at that version, but jenkins-plugin-cli -p git-forensics:3.2138.vf25ea_d549e33 --latest=true does work, since there is a valid/newer version. My desired/expected behavior would be that plugin-util-api:6.1192.v30fe6e2837ff is installed since it is the next valid version. (The fact that it happens to be the latest version as well is coincidence.)

Upstream changes

No response

Are you interested in contributing this feature?

Possibly, if it was straightforward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions