diff --git a/plugins/nf-wave/src/main/io/seqera/wave/plugin/config/WaveConfig.groovy b/plugins/nf-wave/src/main/io/seqera/wave/plugin/config/WaveConfig.groovy index 2940e79d22..aa8414e572 100644 --- a/plugins/nf-wave/src/main/io/seqera/wave/plugin/config/WaveConfig.groovy +++ b/plugins/nf-wave/src/main/io/seqera/wave/plugin/config/WaveConfig.groovy @@ -60,7 +60,7 @@ class WaveConfig { this.strategy = parseStrategy(opts.strategy) this.bundleProjectResources = opts.bundleProjectResources this.reportOpts = new ReportOpts(opts.report as Map ?: Map.of()) - this.retryOpts = new RetryOpts(opts.retryPolicy as Map ?: Map.of()) + this.retryOpts = retryOpts0(opts) this.httpClientOpts = new HttpOpts(opts.httpClient as Map ?: Map.of()) if( !endpoint.startsWith('http://') && !endpoint.startsWith('https://') ) throw new IllegalArgumentException("Endpoint URL should start with 'http:' or 'https:' protocol prefix - offending value: $endpoint") @@ -86,6 +86,15 @@ class WaveConfig { String cacheRepository() { cacheRepository } + private RetryOpts retryOpts0(Map opts) { + if( opts.retryPolicy ) + return new RetryOpts(opts.retryPolicy as Map) + if( opts.retry ) { + log.warn "Configuration options 'wave.retry' has been deprecated - replace it with 'wave.retryPolicy'" + return new RetryOpts(opts.retry as Map) + } + return new RetryOpts(Map.of()) + } protected List parseStrategy(value) { if( !value ) { log.debug "Wave strategy not specified - using default: $DEF_STRATEGIES" diff --git a/plugins/nf-wave/src/test/io/seqera/wave/plugin/config/WaveConfigTest.groovy b/plugins/nf-wave/src/test/io/seqera/wave/plugin/config/WaveConfigTest.groovy index 1e09ef41b6..a2971d6786 100644 --- a/plugins/nf-wave/src/test/io/seqera/wave/plugin/config/WaveConfigTest.groovy +++ b/plugins/nf-wave/src/test/io/seqera/wave/plugin/config/WaveConfigTest.groovy @@ -171,6 +171,15 @@ class WaveConfigTest extends Specification { opts.retryOpts().jitter == 1.0d opts.retryOpts().delay == Duration.of('1s') opts.retryOpts().maxDelay == Duration.of('10s') + + // legacy + when: + opts = new WaveConfig([retry:[ maxAttempts: 10, jitter: 2.0, delay: '3s', maxDelay: '40s' ]]) + then: + opts.retryOpts().maxAttempts == 10 + opts.retryOpts().jitter == 2.0d + opts.retryOpts().delay == Duration.of('3s') + opts.retryOpts().maxDelay == Duration.of('40s') } def 'should get http config options' () {