Add User config setting for docker executor
What does this MR do?
This MR let people set a user for the docker executor. All the commands executed in the container will be executed as that user.
Why was this MR needed?
This is the first step needed to achieve #27895 (closed).
What's the best way to test this MR?
(Note: This MR is intended to be used on MS Windows, but the test requirements on Linux is simpler and the interface is cross-platform. )
First, set the user field to www-data
, which would look like this:
[[runners]]
executor = "docker"
builds_dir = "/tmp" # we are not root now, we have to be careful of permission issues
# ...
[runners.docker]
# ...
user = "www-data"
Then execute the following CI pipeline:
stages:
- test
test-user-change:
stage: test
tags: # adjust on your needs
- os::linux
- env::docker
image: "php:apache"
script:
- bash -c "whoami"
The log should contain www-data
instead of root
.
What are the relevant issue numbers?
Edited by Jamesits