Skip to content

Commit 9b1d1b6

Browse files
jorgeepditommasoclaude
authored
Update to plugin registry V1 (#6316)
**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 <[email protected]> --------- Signed-off-by: jorgee <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent bfa67ca commit 9b1d1b6

File tree

16 files changed

+747
-393
lines changed

16 files changed

+747
-393
lines changed

docs/reference/env-vars.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ The following environment variables control the configuration of the Nextflow ru
161161
`NXF_PLUGINS_DIR`
162162
: The path where the plugin archives are loaded and stored (default: `$NXF_HOME/plugins`).
163163

164+
`NXF_PLUGINS_REGISTRY_URL`
165+
: :::{versionadded} 25.08.0-edge
166+
:::
167+
: Specifies the URL of the plugin registry used to download and resolve plugins. This allows using custom or private plugin registries instead of the default public registry.
168+
164169
`NXF_PLUGINS_TEST_REPOSITORY`
165170
: :::{versionadded} 23.04.0
166171
:::
@@ -191,6 +196,11 @@ The following environment variables control the configuration of the Nextflow ru
191196
:::
192197
: Max delay used for HTTP retryable operations (default: `90s`).
193198

199+
`NXF_RETRY_POLICY_MULTIPLIER`
200+
: :::{versionadded} 25.08.0-edge
201+
:::
202+
: Delay multiplier used for HTTP retryable operations (default: `2.0`).
203+
194204
`NXF_SCM_FILE`
195205
: :::{versionadded} 20.10.0
196206
:::

modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class PublishDir {
235235
protected void apply0(Set<Path> files) {
236236
assert path
237237
// setup the retry policy config to be used
238-
this.retryConfig = RetryConfig.config(session)
238+
this.retryConfig = RetryConfig.config(session.config)
239239

240240
createPublishDir()
241241
validatePublishMode()

modules/nextflow/src/main/groovy/nextflow/util/ConfigHelper.groovy

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2024, Seqera Labs
2+
* Copyright 2013-2025, Seqera Labs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,13 +18,10 @@ package nextflow.util
1818

1919
import java.nio.file.Path
2020

21-
import com.google.common.base.CaseFormat
2221
import groovy.json.JsonOutput
23-
import groovy.transform.CompileDynamic
2422
import groovy.transform.CompileStatic
2523
import groovy.transform.PackageScope
2624
import groovy.util.logging.Slf4j
27-
import nextflow.SysEnv
2825
import nextflow.config.ConfigClosurePlaceholder
2926
import org.codehaus.groovy.runtime.InvokerHelper
3027
import org.yaml.snakeyaml.DumperOptions
@@ -370,37 +367,5 @@ class ConfigHelper {
370367
return value
371368
}
372369

373-
static <T> T valueOf(Map config, String name, String prefix, T defValue, Class<T> type) {
374-
assert name, "Argument 'name' cannot be null or empty"
375-
assert type, "Argument 'type' cannot be null"
376-
377-
// try to get the value from the config map
378-
final cfg = config?.get(name)
379-
if( cfg != null ) {
380-
return toType(cfg, type)
381-
}
382-
// try to fallback to the sys environment
383-
if( !prefix.endsWith('_') )
384-
prefix += '_'
385-
final key = prefix.toUpperCase() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, name)
386-
final env = SysEnv.get(key)
387-
if( env != null ) {
388-
return toType(env, type)
389-
}
390-
// return the default value
391-
return defValue
392-
}
393-
394-
@CompileDynamic
395-
static protected <T> T toType(Object value, Class<T> type) {
396-
if( value == null )
397-
return null
398-
if( type==Boolean.class ) {
399-
return type.cast(Boolean.valueOf(value.toString()))
400-
}
401-
else {
402-
return value.asType(type)
403-
}
404-
}
405370
}
406371

modules/nextflow/src/main/groovy/nextflow/util/RetryConfig.groovy

Lines changed: 0 additions & 87 deletions
This file was deleted.

modules/nextflow/src/test/groovy/nextflow/util/ConfigHelperTest.groovy

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ package nextflow.util
1919
import java.nio.file.Files
2020
import java.nio.file.Paths
2121

22-
import nextflow.SysEnv
2322
import nextflow.config.ConfigClosurePlaceholder
2423
import spock.lang.Specification
2524
import spock.lang.Unroll
26-
2725
/**
2826
*
2927
* @author Paolo Di Tommaso <[email protected]>
@@ -354,72 +352,5 @@ class ConfigHelperTest extends Specification {
354352
"withName:2foo" | "'withName:2foo'" | "withName:'2foo'"
355353
}
356354

357-
@Unroll
358-
def 'should get config from map' () {
359-
given:
360-
def NAME = 'foo'
361-
def PREFIX = 'P_'
362-
and:
363-
SysEnv.push(ENV)
364-
365-
expect:
366-
ConfigHelper.valueOf(CONFIG, NAME, PREFIX, DEF_VAL, DEF_TYPE) == EXPECTED
367-
368-
cleanup:
369-
SysEnv.pop()
370-
371-
where:
372-
CONFIG | ENV | DEF_VAL | DEF_TYPE | EXPECTED
373-
null | [:] | null | String | null
374-
[:] | [:] | null | String | null
375-
[:] | [:] | 'one' | String | 'one'
376-
[foo:'two'] | [:] | 'one' | String | 'two'
377-
[foo:''] | [:] | 'one' | String | ''
378-
[foo:'two'] | [P_FOO:'bar'] | 'one' | String | 'two'
379-
[:] | [P_FOO:'bar'] | 'one' | String | 'bar'
380-
381-
and:
382-
null | [:] | null | Integer | null
383-
[:] | [:] | null | Integer | null
384-
[:] | [:] | 1 | Integer | 1
385-
[foo:2] | [:] | 1 | Integer | 2
386-
[foo:'2'] | [:] | 1 | Integer | 2
387-
[foo:'2'] | [P_FOO:'3'] | 1 | Integer | 2
388-
[:] | [P_FOO:'3'] | 1 | Integer | 3
389-
390-
and:
391-
null | [:] | null | Boolean | null
392-
[:] | [:] | true | Boolean | true
393-
[foo:false] | [:] | true | Boolean | false
394-
[foo:'false'] | [:] | true | Boolean | false
395-
[foo:true] | [:] | false | Boolean | true
396-
[foo:'true'] | [:] | false | Boolean | true
397-
[foo:'true'] | [P_FOO:'false']| null | Boolean | true
398-
[:] | [P_FOO:'false']| null | Boolean | false
399-
[:] | [P_FOO:'true'] | null | Boolean | true
400-
401-
and:
402-
[:] | [:] | Duration.of('1s') | Duration | Duration.of('1s')
403-
[foo:'10ms'] | [:] | null | Duration | Duration.of('10ms')
404-
[:] | [P_FOO:'1s'] | null | Duration | Duration.of('1s')
405-
}
406-
407-
def 'should map camelCase to snake uppercase' () {
408-
given:
409-
SysEnv.push(ENV)
410-
411-
expect:
412-
ConfigHelper.valueOf([:], NAME, PREFIX, null, String) == EXPECTED
413-
414-
cleanup:
415-
SysEnv.pop()
416-
417-
where:
418-
EXPECTED | PREFIX | NAME | ENV
419-
null | 'foo' | 'bar' | [:]
420-
'one' | 'foo' | 'bar' | [FOO_BAR: 'one']
421-
'one' | 'foo_' | 'bar' | [FOO_BAR: 'one']
422-
'one' | 'foo_' | 'thisAndThat' | [FOO_THIS_AND_THAT: 'one']
423-
}
424355

425356
}

modules/nextflow/src/test/groovy/nextflow/util/RetryConfigTest.groovy

Lines changed: 0 additions & 63 deletions
This file was deleted.

modules/nf-commons/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ dependencies {
3434
api 'org.pf4j:pf4j:3.12.0'
3535
api 'org.pf4j:pf4j-update:2.3.0'
3636
api 'dev.failsafe:failsafe:3.1.0'
37+
api 'io.seqera:lib-httpx:1.0.0'
38+
api 'io.seqera:lib-retry:1.2.0'
3739
// patch gson dependency required by pf4j
3840
api 'com.google.code.gson:gson:2.13.1'
3941

0 commit comments

Comments
 (0)