Skip to content

Update to plugin registry V1 #6316

Merged
pditommaso merged 9 commits intomasterfrom
update-plugin-registry-v1
Aug 11, 2025
Merged

Update to plugin registry V1 #6316
pditommaso merged 9 commits intomasterfrom
update-plugin-registry-v1

Conversation

@jorgee
Copy link
Contributor

@jorgee jorgee commented Jul 29, 2025

This PR includes two changes to integrate Nextflow with plugin registry updates:

  1. Update plugins download to the plugin registry API v1
    POST /plugins/collect -> GET /v1/plugins/dependencies
  2. Update OciAwareFileDownloader:
  • Fix automatic redirection problems (changing protocol http-> https and getting the correct filename) by doing a manual redirection.
  • Refactor with Java HTTP client

Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@netlify
Copy link

netlify bot commented Jul 29, 2025

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit 1731036
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/68998afb5fb4990008c470ae
😎 Deploy Preview https://deploy-preview-6316--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 project configuration.

@jorgee
Copy link
Contributor Author

jorgee commented Jul 30, 2025

@pditommaso and @bentsherman
When doing this change, I had a doubt about how to manage the api path inside nextflow. Currently, we require to set the NXF_PLUGINS_INDEX_URL=<plugins-host>/api and Nextflow adds the path /plugins/collect to get the plugins.

For the changes for v1, I have added the 'v1' in the path to do not change the environment variable. However, there are other options to manage it:
1- NXF_PLUGINS_INDEX_URL=<plugins-host>/api/v1 only add /plugins/...
2- NXF_PLUGINS_INDEX_URL=<plugins-host> and nextflow add the full api path /api/v1/....

I think (2) makes more sense, but I would like to know your opinion.

The same is happening for the gradle plugin and the nf-plugin-template. Depending on what we include in the URL, we need to update the template, the plugin or both.

@pditommaso
Copy link
Member

The "correct" way it to keep as parameter api root path ie. https://<HOST>/api (without slash) and append /v1/etc

@jorgee
Copy link
Contributor Author

jorgee commented Jul 30, 2025

The "correct" way it to keep as parameter api root path ie. https://<HOST>/api (without slash) and append /v1/etc

Then, this PR does not require more changes and I will create a PR in the gradle plugin to support v1.

@pditommaso
Copy link
Member

Worth adding a retry logic e.g

safeApply(()-> httpClient.send(request, HttpResponse.BodyHandlers.ofByteArray()))

I've made a little library to wrap the FailSafe boilerplate into a reusable component, see here https://github.com/seqeralabs/libseqera/tree/master/lib-retry

@jorgee
Copy link
Contributor Author

jorgee commented Jul 31, 2025

There is already a retry logic with FailSafe here. I see it is not using the common RetryConfig, defaults are hardcoded. I will modify to use it. Or do you prefer to replace this retry logic by lib-retry?

@pditommaso
Copy link
Member

Maybe i'm missing something, what about these sends

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString())

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString())

@jorgee
Copy link
Contributor Author

jorgee commented Jul 31, 2025

Ah! yes, you are right. I was just looking at the fetch part.

@pditommaso
Copy link
Member

Then let's adopt the new lib consistently at least here

jorgee added 2 commits July 31, 2025 14:08
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@jorgee
Copy link
Contributor Author

jorgee commented Jul 31, 2025

I have created a common RetryableHttpClient that wraps the Java Http Client with the Sequera lib-retry lib. I have used it in the fetch call in HttpPluginRepository and the download calls in OciAwareFileDownloader. With this change, all calls are retried for the retriable error codes (the old fail-safe mechanism in fetch was not doing it).

The retry configuration for these calls is obtained from the common retry configuration nextflow.retryConfig using RetryConfig. As it is not in the nf-commons package and it depends on other nextflow module classes, I have created the IRetryConfig interface that is implemented by RetryConfig and I have also added a new method in ISession to get the common retry configuration.

I tried to use the lib-retry Retryable.Config interface instead of using the IRetryConfig, but RetryConfig was using nextflow.utils. Duration instead of Java Duration and I wasn't sure if changing the type could introduce side effects, so I discarded this option.

Copy link
Member

@bentsherman bentsherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please allow me to review the config classes before merging. I need to make sure everything will work with the config refactor in #6271

jorgee added 4 commits August 1, 2025 11:04
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@jorgee jorgee requested a review from bentsherman August 1, 2025 18:22
Copy link
Member

@bentsherman bentsherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good from my side. We ended up not involving the retry config since it isn't essential. Now we just need to test against the registry

pditommaso and others added 2 commits August 8, 2025 23:46
## Key Changes

**RetryConfig Enhancement & Movement:**
- Move RetryConfig from nextflow to nf-commons module for better reusability
- Add support for multiplier parameter in retry configuration
- Replace navigate() dependency with static compilation-friendly getNestedConfig() helper
- Add NXF_RETRY_POLICY_MULTIPLIER environment variable (default: 2.0)

**HTTP Client Modernization:**
- Replace custom HttpRetryableClient with external io.seqera:lib-httpx library
- Update HttpPluginRepository to use HxClient for better reliability
- Enhanced OciAwareFileDownloader with improved authentication and error handling

**Documentation:**
- Add NXF_PLUGINS_REGISTRY_URL and NXF_RETRY_POLICY_MULTIPLIER to env-vars.md
- Document retry policy multiplier configuration for exponential backoff

**Dependencies:**
- Add io.seqera:lib-httpx:1.0.0 and io.seqera:lib-retry:1.2.0
- Remove custom HTTP retry implementation in favor of external libraries

This refactoring improves the plugin system's HTTP infrastructure reliability while
maintaining backward compatibility and adding new configuration flexibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@pditommaso pditommaso requested a review from a team as a code owner August 11, 2025 06:17
@pditommaso
Copy link
Member

pditommaso commented Aug 11, 2025

Latest Updates - Plugin HTTP Infrastructure Refactoring

Key Changes

RetryConfig Enhancement & Movement:

  • Move RetryConfig from nextflow to nf-commons module for better reusability
  • Add support for multiplier parameter in retry configuration
  • Replace navigate() dependency with static compilation-friendly getNestedConfig() helper
  • Add NXF_RETRY_POLICY_MULTIPLIER environment variable (default: 2.0)

HTTP Client Modernization:

  • Replace custom HttpRetryableClient with external io.seqera:lib-httpx library
  • Update HttpPluginRepository to use HxClient for better reliability
  • Enhanced OciAwareFileDownloader with improved authentication and error handling

Documentation:

  • Add NXF_PLUGINS_REGISTRY_URL and NXF_RETRY_POLICY_MULTIPLIER to env-vars.md
  • Document retry policy multiplier configuration for exponential backoff

Dependencies:

  • Add io.seqera:lib-httpx:1.0.0 and io.seqera:lib-retry:1.2.0
  • Remove custom HTTP retry implementation in favor of external libraries

This refactoring improves the plugin system's HTTP infrastructure reliability while maintaining backward compatibility and adding new configuration flexibility.

@pditommaso pditommaso merged commit 9b1d1b6 into master Aug 11, 2025
21 of 23 checks passed
@pditommaso pditommaso deleted the update-plugin-registry-v1 branch August 11, 2025 07:32
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.

3 participants