Skip to content

Commit

Permalink
Fix missing .command.env when eval is used and task runs on a cloud e…
Browse files Browse the repository at this point in the history
…nv [ci fast]

Signed-off-by: Thanh Lee <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Sep 3, 2024
1 parent 4667241 commit 4a6b54a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ class BashWrapperBuilder {
result += copyFileToWorkDir(TaskRun.CMD_ERRFILE) + ' || true' + ENDL
if( statsEnabled )
result += copyFileToWorkDir(TaskRun.CMD_TRACE) + ' || true' + ENDL
if( outputEnvNames )
if( outputEnvNames || outputEvals )
result += copyFileToWorkDir(TaskRun.CMD_ENV) + ' || true' + ENDL
return result
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,46 @@ class BashWrapperBuilderTest extends Specification {

}

def 'should get unstage control script'(){
given:
BashWrapperBuilder builder
when:
builder = newBashWrapperBuilder()
then:
builder.getUnstageControls() == '''\
cp .command.out /work/dir/.command.out || true
cp .command.err /work/dir/.command.err || true
'''.stripIndent()


when:
builder = newBashWrapperBuilder(statsEnabled: true)
then:
builder.getUnstageControls() == '''\
cp .command.out /work/dir/.command.out || true
cp .command.err /work/dir/.command.err || true
cp .command.trace /work/dir/.command.trace || true
'''.stripIndent()

when:
builder = newBashWrapperBuilder(outputEnvNames: ['some-data'])
then:
builder.getUnstageControls() == '''\
cp .command.out /work/dir/.command.out || true
cp .command.err /work/dir/.command.err || true
cp .command.env /work/dir/.command.env || true
'''.stripIndent()

when:
builder = newBashWrapperBuilder(outputEvals: [some:'data'])
then:
builder.getUnstageControls() == '''\
cp .command.out /work/dir/.command.out || true
cp .command.err /work/dir/.command.err || true
cp .command.env /work/dir/.command.env || true
'''.stripIndent()
}


def 'should create wrapper with podman' () {
when:
Expand Down

0 comments on commit 4a6b54a

Please sign in to comment.