Skip to content

Commit

Permalink
Remove undocumented userEmulation mode
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Dec 18, 2023
1 parent b7f1a19 commit af9f6fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@
*/

package nextflow.container


import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
/**
* Helper methods to handle Docker containers
*
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com>
*/
@Slf4j
@CompileStatic
class DockerBuilder extends ContainerBuilder<DockerBuilder> {

private boolean sudo

private boolean remove = true

private boolean userEmulation

private String registry

private String name

private boolean tty

private static final String USER_AND_HOME_EMULATION = '-u $(id -u) -e "HOME=${HOME}" -v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro -v /etc/group:/etc/group:ro -v $HOME:$HOME'

private String removeCommand

private String killCommand
Expand Down Expand Up @@ -69,8 +69,8 @@ class DockerBuilder extends ContainerBuilder<DockerBuilder> {
if( params.containsKey('runOptions') )
addRunOptions(params.runOptions.toString())

if ( params.containsKey('userEmulation') )
this.userEmulation = params.userEmulation?.toString() == 'true'
if ( params.userEmulation?.toString() == 'true' )
log.warn1("Undocumented setting `docker.userEmulation` is not supported any more - consider to remove it from your config")

if ( params.containsKey('remove') )
this.remove = params.remove?.toString() == 'true'
Expand Down Expand Up @@ -150,9 +150,6 @@ class DockerBuilder extends ContainerBuilder<DockerBuilder> {
if( temp )
result << "-v $temp:/tmp "

if( userEmulation )
result << USER_AND_HOME_EMULATION << ' '

// mount the input folders
result << makeVolumes(mounts)
result << '-w "$NXF_TASK_WORKDIR" '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ class DockerBuilderTest extends Specification {
.build()
.runCommand == 'docker run -i -v "$NXF_TASK_WORKDIR":"$NXF_TASK_WORKDIR" -w "$NXF_TASK_WORKDIR" -x --zeta busybox'

new DockerBuilder('busybox')
.params(userEmulation:true)
.build()
.runCommand == 'docker run -i -u $(id -u) -e "HOME=${HOME}" -v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro -v /etc/group:/etc/group:ro -v $HOME:$HOME -v "$NXF_TASK_WORKDIR":"$NXF_TASK_WORKDIR" -w "$NXF_TASK_WORKDIR" busybox'

new DockerBuilder('busybox')
.setName('hola')
.build()
Expand Down

0 comments on commit af9f6fc

Please sign in to comment.