falcondev-oss / github-actions-cache-server

Self-hosted GitHub Actions cache server implementation. Compatible with official 'actions/cache' action
https://gha-cache-server.falcondev.io
MIT License
92 stars 4 forks source link

[Help] Setup looks good, but still downloads cache from external source #32

Closed MarcARoberge closed 2 months ago

MarcARoberge commented 2 months ago

Hello! I just need some help/support. I am configuring this server on Mac OS and everything looks good except when I run the setup-node actions with the cache: npm option, it stills downloads it from an outside source.

This is an echo of the env.ACTIONS_CACHE_URL for this job (looks good). image

And here's what it looks like when using the setup-node actions image

Any idea why it acts like that? Any clue to where to look ?

LouisHaftmann commented 2 months ago

How are you setting the ACTIONS_CACHE_URL and did you modify the runner binary so it actually uses the custom ACTIONS_CACHE_URL?

MarcARoberge commented 2 months ago

This is the step:

 - name: Set up secret file
        env:
          ACTIONS_CACHE_URL: ${{ secrets.ACTIONS_CACHE_URL }}
        run: |
          echo ${{env.ACTIONS_CACHE_URL}} | sed 's/./& /g'
LouisHaftmann commented 2 months ago

Have a look at this https://gha-cache-server.falcondev.io/getting-started#getting-the-actions-runner-to-use-the-cache-server

MarcARoberge commented 2 months ago

I did try it, but since I am on Mac it looks like I needed some changes, if not I would get a illegal byte sequence error. Here's the command I did:

 LC_ALL=C sed -i '' 's/\x41\x00\x43\x00\x54\x00\x49\x00\x4F\x00\x4E\x00\x53\x00\x5F\x00\x43\x00\x41\x00\x43\x00\x48\x00\x45\x00\x5F\x00\x55\x00\x52\x00\x4C\x00/\x41\x00\x43\x00\x54\x00\x49\x00\x4F\x00\x4E\x00\x53\x00\x5F\x00\x43\x00\x41\x00\x43\x00\x48\x00\x45\x00\x5F\x00\x4F\x00\x52\x00\x4C\x00/g' ./actions-runner-6/bin/Runner.Worker.dll
LouisHaftmann commented 2 months ago

Can you try running the action with debug logs enabled. It should print out the url it is downloading cache from.

LouisHaftmann commented 2 months ago

Have you tried setting the ACTIONS_CACHE_URL env var when running the actions runner, not inside the workflow file:

ACTIONS_CACHE_URL=<url> ./run.sh
MarcARoberge commented 2 months ago

From what I can see from debug is that it is evaluating the secrets.ACTIONS_CACHE_URL but looks like it is still the Github's one. I'll try to find something else with the sed command that might caused that.

image
MarcARoberge commented 2 months ago

Update: using gsed on Mac OS seems to give a better result.

UPDATE 2: I was missing a /. Trying with gsed

MarcARoberge commented 2 months ago

Ok really good progress done. Looks like everything is setup, but I am receiving a error 500 since it looks like the cache is too big (around 5gb).

cache-server-1  | [nitro] [request error] [unhandled] The value of "size" is out of range. It must be >= 0 && <= 4294967296. Received 6_144_972_628
cache-server-1  |   at Function.alloc (node:buffer:389:3)  
cache-server-1  |   at Object.reserveCache (./server/chunks/runtime.mjs:5636:47)  
cache-server-1  |   at handler (./server/chunks/routes/_token/_apis/artifactcache/index.post.mjs:40:43)  
cache-server-1  |   at process.processTicksAndRejections (node:internal/process/task_queues:95:5)  
cache-server-1  |   at async _callHandler (./server/chunks/runtime.mjs:2726:16)  
cache-server-1  |   at async Object.handler (./server/chunks/runtime.mjs:2846:19)  
cache-server-1  |   at async Server.toNodeHandle (./server/chunks/runtime.mjs:3112:7)

From what I understand, Buffer.alloc has a size limit. What can we do from here? Thinking maybe doing chunks?

LouisHaftmann commented 2 months ago

Should be fixed in v2.1.0