setup-ros
setup-ros copied to clipboard
provide an option to run without sudo
Description
Inside Docker containers, processes usually run as root. The action uses sudo to install packages via apt. This has two downsides:
- You may have to install
sudo
to make the action work. - Since sudo runs without
-E
environment variables are not forwarded.
Completion Criteria
The action should provide two options:
- flag to select if actions should run with or without sudo
- parameter to provide additional command line argument to sudo, e.g.
-E
.
Testing Notes / Suggestions
Add an additional test where the action runs as root without sudo
being installed.
You may have to install sudo to make the action work.
Can you share an example GitHub action config where this would be necessary? I'm guessing this is only if your own Docker image doesn't have sudo
OR if you run your own runners(?).
Docker images without sudo
are one issue. You can quickly check this with docker run --rm -ti ubuntu:22.04 bash -c "sudo apt update"
. This could be worked around by installing sudo
in the image first, but it would still be nicer if you do not have to do this.
The main problem is that you cannot pass options to sudo
, such as -E
or --preserve-env
.
Sounds reasonable to me. A PR would be appreciated :grin: