Path Validation Error when caching on container jobs
See original GitHub issueWhen I use the cache action with a container job, the cache is not saved during the post cache step and instead I get the following error
Post job cleanup.
/usr/bin/docker exec ecc19d4d[2](https://github.com/daoudi-mohammed/spring-boilerplate/runs/6771275062?check_suite_focus=true#step:10:2)b410eadd[3](https://github.com/daoudi-mohammed/spring-boilerplate/runs/6771275062?check_suite_focus=true#step:10:3)082d7a7d5d22cc782f29dfba69ac4a8edc83090a10843c sh -c "cat /etc/*release | grep ^ID"
Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
Here is the code for my job
jobs:
unit-tests:
runs-on: ubuntu-latest
container: openjdk:17-jdk-alpine
steps:
- name: Setup git
working-directory: ""
run: |
apk add -q --no-cache --no-progress git yq tar
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Check out repository code
uses: actions/checkout@v2
- name: Cache maven packages
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.m2/repository
key: test
- name: Run liquibase update
run: |
mkdir -pv ${{ github.workspace }}/.m2/repository/
echo "hello" > ${{ github.workspace }}/.m2/repository/hello.txt
I tried replacing the ${{ github.workspace }} with it’s exact value (absolute path) but nothing worked.
However when I use a hardcoded path that has nothing to do with ${{ github.workspace }} it works
with:
path: |
/test/.m2/repository
key: test
- name: Run liquibase update
run: |
mkdir -pv test/.m2/repository/
echo "hello" > test/.m2/repository/hello.txt
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Path Validation Error when caching on container jobs - IssueHint
When I use the cache action with a container job, the cache is not saved during the post cache step and instead I...
Read more >Path Validation Error when caching on container jobs
Path Validation Error when caching on container jobs.
Read more >Error to cache the deps inside a docker container · Issue #15174
I'm using Deno v 1.21.3 and I'm trying to build a docker image for my application: FROM ubuntu:20.04 # install curl RUN apt-get...
Read more >Cache created in `ubuntu-latest` cannot be restored in Docker ...
It seems that the @actions/cache job silently fails if there is no zstd binary available in the PATH in the container that you...
Read more >Document - Container Launch error with Distributed cache files fails ...
The job works fine in the Job Tracker/Task Tracker environment because full path is being used for the target while creating the symlinks....
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
It definitely helps! Thank you so much @kotewar
This is a mixed scenario where the workflow is running on ubuntu image sometimes, and on the container the rest of the times. That’s why
${{ github.workspace }}
is sometimes evaluated as/__w
and/home/runner/work/repo-name/repo-name
the rest of the times. To investigate the issue, we went ahead to understand the behaviour of actions when ran in a container. If interested to know, please refer the workflow to understand the same. The logs will give you a better idea of the same.To conclude our understandings, here’s what we found -
${{ github.workspace }}
as/__w
. If anything is running with/home/runner/work/repo-name/repo-name
as current working directory, its outside your container in theubuntu-latest
image (or base image for that matter)..m2
folder must be known. After investigation, it turns out that.m2
folder inopenjdk:17-jdk-alpine
is actually present at/root/.m2/repository
location. So this should actually be the path that must be used to cache the/.m2/repository
folder. Refer this/.m2
folder is located, it should be referred in path parameter of the cache action.Sample code to get
.m2
folder location and setting it in the appropriate location.Please try using this and see if you get the expected results. You can refer this workflow. Hope this helps! 😊