Docker Container Action - How to persist files in workspace #26963
-
Hi, Can anybody help explain what I’m missing here? I’m following this guide to run a docker container action, and trying to copy out the files. It’s a pretty simple container action that runs a shell script like this:
From the logs I see that both workspace.file and workspace-folder are created in the running container. However, if I list the files using ls as the next step after the container, it seems that the workspace-folder has been persisted but workspace-file has not (after the container has exited)
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
When using a docker container action, there are some volumes configured in docker run command. Files inside container under /github/workspace are mapped to runner workspace /home/runner/work/my-repo-name/my-repo-name . And files inside container under /github/home are mapped to /home/runner/work/_temp/_github_home in runner machine. The files you created in entrypoint.sh will be persisted after the container has exited but the empty folder will not. In your workflow yml file upload artifacts actions, the path you specifed is wrong. $GITHUB_WORKSPACE and $HOME is the right syntax in bash script , it could not be replaced in upload artifacts path input variable. And $HOME in runner is point to /home/runner , it is not mapped to /github/home. You need to use /home/runner/work/_temp/_github_home instead. Please try my workflow file sample:
|
Beta Was this translation helpful? Give feedback.
-
Thanks so much! Can’t believe I didn’t think to look at that in the logs |
Beta Was this translation helpful? Give feedback.
When using a docker container action, there are some volumes configured in docker run command.
Files inside container under /github/workspace are mapped to runner workspace /home/runner/work/my-repo-name/my-repo-name . And files inside container under /github/home are mapped to /home/runner/work/_temp/_github_home in runner machine.
The files you created in entrypoint.sh will be persisted after the container has exited but the empty folder will not.
In your workflow yml file upload artifacts actions, the path you specifed is wrong.
$GITHUB_WORKSPACE and $HOME is the right syntax in bash script , it could not be replaced in upload artifacts path i…