Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class CmdRun extends CmdBase implements HubOptions {
final isTowerEnabled = config.navigate('tower.enabled') as Boolean
final isDataEnabled = config.navigate("lineage.enabled") as Boolean
if( isTowerEnabled || isDataEnabled || log.isTraceEnabled() )
runner.session.resolvedConfig = ConfigBuilder.resolveConfig(scriptFile.parent, this)
runner.session.resolvedConfig = ConfigBuilder.resolveConfig(scriptFile.parent, this, cliParams)
// note config files are collected during the build process
// this line should be after `ConfigBuilder#build`
runner.session.configFiles = builder.parsedConfigFiles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,13 +892,14 @@ class ConfigBuilder {
}
}

static String resolveConfig(Path baseDir, CmdRun cmdRun) {
static String resolveConfig(Path baseDir, CmdRun cmdRun, Map cliParams) {

final config = new ConfigBuilder()
.setShowClosures(true)
.setStripSecrets(true)
.setOptions(cmdRun.launcher.options)
.setCmdRun(cmdRun)
.setCliParams(cliParams)
.setBaseDir(baseDir)
.buildConfigObject()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2352,6 +2352,7 @@ class ConfigBuilderTest extends Specification {
process {
executor = { 'local' }
}
outputDir = params.outdir
}
second {
params.none = 'Blah'
Expand All @@ -2361,18 +2362,21 @@ class ConfigBuilderTest extends Specification {
when:
def opt = new CliOptions(config: [configFile.toFile().canonicalPath])
def cmd = new CmdRun(profile: 'first', withTower: 'http://foo.com', launcher: new Launcher(options: opt))
def txt = ConfigBuilder.resolveConfig(base, cmd)
def cliParams = [foo: 'Hola', outdir: 'output_folder']
def txt = ConfigBuilder.resolveConfig(base, cmd, cliParams)
then:
txt == '''\
params {
foo = 'Hello world'
foo = 'Hola'
outdir = 'output_folder'
awsKey = '[secret]'
}

process {
executor = { 'local' }
}

outputDir = 'output_folder'
outputFormat = 'text'
workDir = 'work'

Expand Down
Loading