setup-ros icon indicating copy to clipboard operation
setup-ros copied to clipboard

provide an option to run without sudo

Open christian-rauch opened this issue 1 year ago • 3 comments

Description

Inside Docker containers, processes usually run as root. The action uses sudo to install packages via apt. This has two downsides:

  1. You may have to install sudo to make the action work.
  2. Since sudo runs without -E environment variables are not forwarded.

Completion Criteria

The action should provide two options:

  1. flag to select if actions should run with or without sudo
  2. 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.

christian-rauch avatar Nov 10 '23 08:11 christian-rauch

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(?).

christophebedard avatar Nov 14 '23 01:11 christophebedard

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.

christian-rauch avatar Nov 14 '23 07:11 christian-rauch

Sounds reasonable to me. A PR would be appreciated :grin:

christophebedard avatar Dec 06 '23 01:12 christophebedard