Cache `/root/.m2/repository`
See original GitHub issueDescription: I use containers (Ubuntu, Fedora, Almalinux) in GitHub Actions. In my workflows, I am using this action. In the “Post Setup Java” step, I see a warning about a path validation error.
What I have discovered is that the Maven local repository path by default is /root/.m2/repository
, so ~/.m2/repository
doesn’t exist.
Justification:
This is a very hard issue to discover, and since this path seems to the default on many images, or at least the ones I am using, it should be cached in addition to the usual ~/.m2/repository
.
https://github.com/actions/cache/issues/814
Are you willing to submit a PR? Potentially.
Alternatively, allow us as users to configure the cache path ourselves.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
How to cache local Maven repository using Docker with ...
I found a work-around, see Local settings.xml not picked up by Jenkins agent: The issue is related to the -u uid:gid that jenkins...
Read more >docker runner cache maven repository (#15167) - GitLab.org
But I'd like to cache the maven repository(/root/.m2 directory) for each build. ... or in `.mvn/maven.config` cache: paths: - .m2/repository.
Read more >Clearing the Maven Cache
In this short article, we looked at two ways to clear our local Maven cache. First, we looked at manually emptying our local...
Read more >kubernetes-plugin/maven-with-cache.groovy at master
This pipeline will execute a simple maven build, using a Persistent Volume Claim to store the local Maven repository.
Read more >Caches | Bitbucket Cloud
Bitbucket Pipelines is able to cache external build dependencies and ... To enable caching, add a caches section to your step . ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tristan957 i am closing the issue because of the problem relates to https://github.com/actions/runner repository and there’s no activity for 2 weeks. Please feel free to create the issue in this project in case of any problem.
Hey everyone,
I will try to provide more context to why is this happening.
When starting a job within a container, the runner will add system volume mounts. The volume mount interesting for this issue is
/github/home
which will be mapped to thePATH_TO_YOUR_RUNNER_WORK/_temp/_github_home
. It is that directory that is going to be used as a HOME, and can ensure that$HOME
directory exists regardless of the container you are using.But on the other hand, this introduces problems when users or scripts rely on the predefined $HOME variable that they expect to be set by the container. The issue is especially tricky when you create a docker container action, with the
USER
directive envHOME
env set.The reason the workaround works, is that the env field overwrites environment in context of this step, so when you invoke a command, it will use envs specified for that step, which is great for this particular use-case.
In situations where you want to customize containers used by jobs, and you are using self-hosted runners, you can use container hooks.
We are aware of this issue, and we are looking at ways to solve it without breaking existing workflows that rely on current behaviour.
I hope this is helpful, and please, let me know if you have any questions regarding this ☺️