actions / actions/runner

[FEAT REQ] Support `user` argument in Action YAML when `using: 'docker'`

Open
#1,711 3 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Runner Feature
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

Describe the enhancement

I have a Dockerfile that specifies a USER. As discussed in #1214, a USER specified in the Dockerfile causes a GitHub Action to fail.

I can't help but notice the Action YAML accepts several docker run argument names (e.g. entrypoint, env, etc...). If it were to also accept user, then I could override the USER definition in the Dockerfile and run the container as the root user. This would allow the runner to make the necessary folders, and also provide an acceptable workaround for issue #1214.

For the CI, it doesn't matter much if the root user builds and "owns" all the resulting files. However, when I run the container locally, it makes my local file system require elevated privileges to clean up build artifacts. While it's true that I can specify a different user on the command line when I build locally, it would be better if this was handled by the runner. If the runner specifies the root user, then it's codified in YAML and does not have to be considered at each invocation.

Code Snippet

name: 'Build'
description: 'Build using CMake and the ARM toolchain'
runs:
  using: 'docker'
  image: '../../../Dockerfile'
  user: 'root'
  entrypoint: 'sh'
  args:
    - '-c'
    - 'rm -rf build/ && mkdir build && cd build/ && cmake -DSPARROW_LORA_ONLY=1 .. && make -j'

Additional information
Add any other context about the feature here.

NOTE: if the feature request has been agreed upon then the assignee will create an ADR. See docs/adrs/README.md

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing Docker-related Action YAML arguments described in the issue and the context of issue #1214. Check docs/adrs/README.md for the repository's feature-request process, then trace where arguments such as entrypoint and env are handled. Done means a docker action can accept user: 'root' and the behavior is covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker, github-actions
Domain
ci-cd, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.