docker-workflow-plugin icon indicating copy to clipboard operation
docker-workflow-plugin copied to clipboard

Force jenkins user on exec commands

Open diorcety opened this issue 7 years ago • 5 comments

replace #130 Allow to specify an different user for the run

docker.image('dummy').inside('-u root:root -e BUILDER_UID=1001 -e BUILDER_GID=1001 -e BUILDER_USER=jenkins -e BUILDER_GROUP=jenkins -e HOME=/home/jenkins) {
}

Will run docker run -t -u 1001:1001 -u root:root ... and docker exec -u 1001:1001 ...

diorcety avatar Dec 14 '18 13:12 diorcety

How can this be used with DSL? At the moment we do something like:

agent {
    label 'docker'
    image 'php:7.1'
}

Obviously we can specify extra args, but will these allow overriding the user in the run stage?

I guess one 'ideal' would be to take a user argument in the agent stanza.

andrewnicols avatar Feb 27 '19 07:02 andrewnicols

I rebased my PR on master

diorcety avatar Oct 22 '19 08:10 diorcety

Does this change break any existing usage? If so then it should be implemented conditionally, based on a new parameter etc.

romanek-adam avatar May 20 '21 12:05 romanek-adam

This is break only the usage when the user force the user as image parameters with -u root:root for example. The current behaviour seems to be an issue for many people currently

diorcety avatar May 20 '21 13:05 diorcety

Okay, I finally succeeded to test the behaviour.

diorcety avatar May 28 '21 13:05 diorcety