allow overriding workdir for container jobs
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 1.4k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 24
Description
Describe the enhancement
Allow overriding container's workdir.
Currently, even if passing --workdir=/somedir to the container: options: it does not override the first --workdir option passed to docker create by the runner.
It would be nice to be able to override the workdir somehow, so that on self-hosted runners, after the job is done the checked out sources would not remain the in actions-runner/_work directory. In container jobs it makes no sense to mount the external directory, as all the job steps are executed within the container anyway. If work dir is set to some in-container directory, then after the job is done the container is discarded and all the build artifacts are discarded as well, no separate cleanup is needed.
Code Snippet
container:
image: debian:buster
options: --workdir=/home/build/myrepo
This example currently will result in that --workdir is passed twice to the docker create. The first one is the default one which is --workdir /__w/myrepo/myrepo and the second is the one indicated in options:, but it looks like docker create takes the first one and ignores the second one. So, there is no possibility to override the workdir.
Need to exclude the default --workdir option in case options: contains custom --workdir option.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the runner's Docker container-job handling and the docker create command construction, especially parsing container: options:. Verify how repeated --workdir arguments are handled. Done means a custom --workdir in options: prevents the default workdir from being passed and the container uses the requested path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, docker
- Domain
- ci-cd, devops, infrastructure
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100