Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use semver to pin only major/minor plugin versions #5435

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tom-seqera
Copy link
Contributor

Closes #4329

This makes two changes:

  1. Allows using SemVer version constraints to specify plugin versions
  2. Presents the directory of already downloaded plugins as an UpdateRepository, allowing the same SemVer version constraint to be applied offline as well.

The version range constraints are handled by the underlying SemVer library: https://github.com/zafarkhaja/jsemver?tab=readme-ov-file#range-expressions. Perhaps most usefully are tilde ranges (~), which allow pinning of the major or minor part of the version while automatically using any newer patch version. For example:

  • ~1.2 is equivalent to >=1.2.0 && <1.3.0,
  • ~1.2.1 is equivalent to >=1.2.1 && <1.3.0,
  • ~1 is equivalent to >=1.0.0 && <2.0.0

In offline mode, it will look for the latest already downloaded plugin version which matches the constraint.

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit 8411295
🔍 Latest deploy log https://app.netlify.com/sites/nextflow-docs-staging/deploys/675b1987f6988400087ec5f0
😎 Deploy Preview https://deploy-preview-5435--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Of particular relevance, this enables use of tilde ranges (~) to pin a major or
minor version while allowing updates to minor or patch versions.

Signed-off-by: Tom Sellman <tom.sellman@seqera.io>
Signed-off-by: Tom Sellman <tom.sellman@seqera.io>
This improves testability of the class by moving read of NXF_OFFLINE env var

Signed-off-by: Tom Sellman <tom.sellman@seqera.io>
(and tidy up the test setup a bit)

Signed-off-by: Tom Sellman <tom.sellman@seqera.io>
@tom-seqera tom-seqera force-pushed the 4329-partial-pin-plugin-version branch from 5be6e59 to bed76b5 Compare November 8, 2024 10:22
@tom-seqera tom-seqera marked this pull request as ready for review November 8, 2024 11:29
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@bentsherman
Copy link
Member

At a first glance the changes make sense. Will need to try a manual test with some real plugins, ideally a published plugin with multiple major versions, and then review the code in more detail

@tom-seqera do you feel good about this approach? I thought you said you had some concerns about the local plugin provider but now I don't remember

@tom-seqera
Copy link
Contributor Author

@tom-seqera do you feel good about this approach? I thought you said you had some concerns about the local plugin provider but now I don't remember

It's been a little while, but I think I found that some of the p4fj code (or maybe our wrapper code around it?) seems to generally assume that plugin update versions for a given plugin ID are only defined in a single repository and might not work properly if you tried to enable both the local cache and remote index at the same time.

It doesn't impact these specific changes because the code selects either the local cache or the remote index depending on the offline flag, but will likely be something we need to handle if/when we harmonise plugin loading or improve support for multiple plugin sources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugins: Use any available cached version if NXF_OFFLINE is true
2 participants