Skip to content

Commit cb7133d

Browse files
authored
Fix resolution of params in resolved config text (#7072)
1 parent 5b4c8f0 commit cb7133d

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ class CmdRun extends CmdBase implements HubOptions {
418418
final isTowerEnabled = config.navigate('tower.enabled') as Boolean
419419
final isDataEnabled = config.navigate("lineage.enabled") as Boolean
420420
if( isTowerEnabled || isDataEnabled || log.isTraceEnabled() )
421-
runner.session.resolvedConfig = ConfigBuilder.resolveConfig(scriptFile.parent, this)
421+
runner.session.resolvedConfig = ConfigBuilder.resolveConfig(scriptFile.parent, this, cliParams)
422422
// note config files are collected during the build process
423423
// this line should be after `ConfigBuilder#build`
424424
runner.session.configFiles = builder.parsedConfigFiles

modules/nextflow/src/main/groovy/nextflow/config/ConfigBuilder.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,13 +892,14 @@ class ConfigBuilder {
892892
}
893893
}
894894

895-
static String resolveConfig(Path baseDir, CmdRun cmdRun) {
895+
static String resolveConfig(Path baseDir, CmdRun cmdRun, Map cliParams) {
896896

897897
final config = new ConfigBuilder()
898898
.setShowClosures(true)
899899
.setStripSecrets(true)
900900
.setOptions(cmdRun.launcher.options)
901901
.setCmdRun(cmdRun)
902+
.setCliParams(cliParams)
902903
.setBaseDir(baseDir)
903904
.buildConfigObject()
904905

modules/nextflow/src/test/groovy/nextflow/config/ConfigBuilderTest.groovy

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,6 +2352,7 @@ class ConfigBuilderTest extends Specification {
23522352
process {
23532353
executor = { 'local' }
23542354
}
2355+
outputDir = params.outdir
23552356
}
23562357
second {
23572358
params.none = 'Blah'
@@ -2361,18 +2362,21 @@ class ConfigBuilderTest extends Specification {
23612362
when:
23622363
def opt = new CliOptions(config: [configFile.toFile().canonicalPath])
23632364
def cmd = new CmdRun(profile: 'first', withTower: 'http://foo.com', launcher: new Launcher(options: opt))
2364-
def txt = ConfigBuilder.resolveConfig(base, cmd)
2365+
def cliParams = [foo: 'Hola', outdir: 'output_folder']
2366+
def txt = ConfigBuilder.resolveConfig(base, cmd, cliParams)
23652367
then:
23662368
txt == '''\
23672369
params {
2368-
foo = 'Hello world'
2370+
foo = 'Hola'
2371+
outdir = 'output_folder'
23692372
awsKey = '[secret]'
23702373
}
23712374
23722375
process {
23732376
executor = { 'local' }
23742377
}
23752378
2379+
outputDir = 'output_folder'
23762380
outputFormat = 'text'
23772381
workDir = 'work'
23782382

0 commit comments

Comments
 (0)