Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force jenkins user on exec commands #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

diorcety
Copy link

@diorcety diorcety commented Dec 14, 2018

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 ...

@andrewnicols
Copy link

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.

@diorcety
Copy link
Author

I rebased my PR on master

@romanek-adam
Copy link

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

@diorcety
Copy link
Author

diorcety commented May 20, 2021

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 diorcety force-pushed the exec branch 3 times, most recently from 39963ee to 33cb834 Compare May 27, 2021 12:56
@diorcety diorcety force-pushed the exec branch 2 times, most recently from 1ec100b to be15d7c Compare May 28, 2021 13:14
@diorcety
Copy link
Author

Okay, I finally succeeded to test the behaviour.

@diorcety diorcety changed the title Set --user on exec, not on main run command Force jenkins user on exec commands May 31, 2021
@diorcety diorcety force-pushed the exec branch 2 times, most recently from 9b33ba2 to 897d4c7 Compare June 19, 2023 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants