ACTIONS_RUNTIME_URL, ACTIONS_RUNTIME_TOKEN and ACTIONS_CACHE_URL environment variables are missing.
Github actions have undocumented environment variables named ACTIONS_RUNTIME_URL, ACTIONS_RUNTIME_TOKEN and ACTIONS_CACHE_URL. The actions/cache action relies on this to create the url to interact with for storing caches.
https://github.com/actions/toolkit/blob/1cc56db0ff126f4d65aeb83798852e02a2c180c3/packages/cache/src/internal/cacheHttpClient.ts#L33-L47
They all get populated over here
This is the cause of #285, #169 is linked.
Issue is stale and will be closed in 7 days unless there is new activity
The issue is still persistent afaik.
Any news about this problem? Came here from #285
Coming from https://github.com/nektos/act/issues/169
Hi, I'm trying to understand the problem. Are these values dynamically set? Can they be manually set and read by act? If so what to?
Are these values dynamically set?
@jshwi Those environmental variables are only available to GitHub Actions runners, whether it be runner hosted by GitHub or self-hosted one.
Can they be manually set and read by act?
Probably.
If so what to?
No one knows, if it was that easy it would be fixed already.
Perhaps guys from GitHub (@joshmgross from https://github.com/actions/cache or @TingluoHuang from https://github.com/actions/runner, top committers) could chime in here, maybe give us some clues on how we could solve that issue. I presume it won't be so easy as obtaining and just hardcoding those values since, most likely they are undocumented for a reason and the reason is it's supposed to work only on GitHub Actions service (but please, prove me wrong). There is artefacts API https://docs.github.com/en/rest/reference/actions#artifacts which could be used to replace artefacts actions but I've not found anything regarding cache.
Thank you, @catthehacker. I appreciate now having a better understanding of this.
👋 @catthehacker is correct, these variables are for internal APIs. If you wanted to manually set these values, you'd also likely need to simulate an internal service to support what these APIs are used for (like caching and artifacts).
@joshmgross Thank you very much for response! 😄 Unfortunately that is what I was afraid of.
So my idea was that act would spin up small http server available to its containers and work as transparent proxy. I might be able to draft something up whenever I get some more free time.
Issue is stale and will be closed in 14 days unless there is new activity
I've built a very quick and simple express server that will simulate the download and upload endpoints of an artifact server here https://github.com/anthonykawa/artifact-server. If you want to use it to help understand building this into act, feel free. It only works if you specify the name and path inputs when uploading and downloading.
Thanks a lot @anthonykawa. Will take a look at it soon when I'll get time to develop artefact support.
Issue is stale and will be closed in 14 days unless there is new activity
Needed for artifacts, please don't close
I have built (this year) a whole act like clone which have a builtin artifact and cache server.
My clone defines all these variables and is able to use the official self-hosted runners. This source code is incompatible with act, because I used the same language as the official runner to reduce rewriting code and maintenance time.
My first goal wasn't to run them locally like act, but on a raspberry pi with a github like server (https://github.com/go-gitea/gitea).
I am testing the option from @anthonykawa (PRs incoming) and it seems that act does not properly honor the config:
::debug::Resource Url: localhost:8080_apis/artifactcache/cache?keys=Linux-ubuntu-latest-cargo-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855&version=00e54f95df51f6341273eea43863fcdc3856075880e81a8467ad4870f1a07f31
[Quick check/rust_fmt-1] 💬 ::debug::getCacheEntry - Attempt 1 of 2 failed with error: connect ECONNREFUSED 127.0.0.1:80
I did set an ENV defined as ACTIONS_CACHE_URL=localhost:8080.
We can see in the logs that we connect to it ::debug::Resource Url: localhost:8080_
But then suddenly, act complains about :80 not being available...
@chevdor the runner is running inside docker. I guess the @anthonykawa server is running on your machine, thus localhost refer to docker localhost and not yours.
you have to expose the service to make it accessible from inside a container
I'm trying to use @actions/cache in a node script run in a composite steps action, and it does not have these env vars on an ubuntu-latest github-hosted runner. Am I going to be out of luck here, or is there a way to emulate the @actions/cache action manually?
I've built a very quick and simple express server that will simulate the download and upload endpoints of an artifact server here https://github.com/anthonykawa/artifact-server. If you want to use it to help understand building this into act, feel free. It only works if you specify the name and path inputs when uploading and downloading.
Did someone get this up and running in combination with actions/cache@v2? I'm running out of ideas to share Docker images between jobs with Act. Any suggestion?
Did someone get this up and running in combination with
actions/cache@v2?
There is no plan to support that action at all.
I'm running out of ideas to share Docker images between jobs with
Act. Any suggestion?
What do you mean? All your images should be stored on your Docker host, there is no need to cache them.