clelange / cmssw-docker

Dockerfiles for CMSSW
https://doi.org/10.5281/zenodo.3374807
MIT License
2 stars 9 forks source link

Path fix for github docker actions in Entrypoint #16

Open katilp opened 4 years ago

katilp commented 4 years ago

The github docker actions run docker run with the following

/usr/bin/docker run --name c27d318565180a5ce950be55cfcc7216d9c1a4_1ad10e --label c27d31 --workdir /github/workspace --rm -e INPUT_FILE-NAME -e INPUT_CMSSW_VERSION -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/github-action-test/github-action-test":"/github/workspace" c27d31:8565180a5ce950be55cfcc7216d9c1a4

In consequence, Entrypoint starts in a wrong directory (in /github/workspace owned by cmsinst instead of /home/cmsusr) for the CMSSW release area build and gives:

Setting up CMSSW_4_2_8
cannot make directory CMSSW_4_2_8 Permission denied

If you add cd /home/cmsusr at the beginning of Entrypoint it would work also with github docker actions.

Furthermore, when producing artifacts, github actions/upload-artifact looks for the file to upload in that same volume -v "/home/runner/work/github-action-test/github-action-test":"/github/workspace" but as it comes under ownership of cmsinst, chown is needed before copying there can be done. That's fine, but I wonder if there's a better solution.

I could not figure out any way of changing the default volumes in the docker run command in github actions.

clelange commented 4 years ago

I can add the cd /home/cmsusr, but I think that the owner of this new directory is a problem of GitHub Actions and there's nothing to be fixed here. I'm surprised that it picks up cmsinst. Maybe this is something you can pass?

clelange commented 4 years ago

Addressed in a8a204c