martinthomson / i-d-template

A template for IETF internet draft git repositories
Other
208 stars 182 forks source link

Not caching and reusing references #322

Closed martinthomson closed 1 year ago

martinthomson commented 2 years ago

The GitHub Action should be caching downloaded references, but it doesn't seem to be doing that reliably.

martinthomson commented 2 years ago

I have a solution for this now; the reason is that the directories visible to the caching step are not the same as those presented to the code running inside the docker image step. The upshot is that the cached content needs to be put into directories under the source code when running as a GitHub Action.


There are concepts like the $RUNNER_TEMP directory, but there is no way to easily learn from outside the running docker image where that directory will be mounted. It appears that the $RUNNER_TEMP variable exists, but the directory it refers to is not mounted:

/usr/bin/docker run --name ghcriomartinthomsonidtemplateactionlatest_e9b28e --label 6f1554 --workdir /github/workspace --rm -e XML2RFC_REFCACHEDIR -e VENVDIR -e BUNDLE_PATH -e INPUT_TOKEN -e INPUT_MAKE -e GITHUB_TOKEN -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_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -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/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/http-extensions/http-extensions":"/github/workspace" ghcr.io/martinthomson/i-d-template-action:latest  "all"

This (from a recent run) seems to indicate that $RUNNER_TEMP (/home/runner/work/_temp on the host) exists only as a unique thing outside of the docker runner. The variable is passed to the docker run command, but it refers to a directory that doesn't exist, only specific items underneath that directory are mounted separately.

martinthomson commented 1 year ago

Fixed a while back with a ton of work. Moved resources under the repository directory, with a lot of variable overrides, so that they remain visible within and without the docker image. Seems to be stable now.