sp-ricard-valverde / github-act-cache-server Goto Github PK
View Code? Open in Web Editor NEWGithub artifact cache server to be used locally
Github artifact cache server to be used locally
Docker Desktop on MacOS runs the docker engine inside a Linux VM (or Rosetta 2 runtime), which doesn't have access to host networking. As a consequence, the act
runner can't actually access localhost:8080
.
::debug::getCacheEntry - Attempt 1 of 2 failed with error: connect ECONNREFUSED 127.0.0.1:8080
::debug::Resource Url: http://localhost:8080/_apis/artifactcache/cache?keys=<key>&version=<...>
::debug::getCacheEntry - Attempt 2 of 2 failed with error: connect ECONNREFUSED 127.0.0.1:8080
❌ Failure
I'm not sure if you want to implement this directly in the repo, but the workaround I've been using involves creating a separate act
network. I've given the cache server a fixed hostname, allowing the act
container to refer to it directly by its hostname.
Changes to docker-compose.yml:
diff --git a/docker-compose.yml b/docker-compose.yml
index 7924a28..b3a430b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -5,12 +5,20 @@ services:
context: .
args:
- AUTH_KEY=${ACT_CACHE_AUTH_KEY:?Missing env var ACT_CACHE_AUTH_KEY}
+ hostname: act-cache-server.docker
+ container_name: act-cache-server
ports:
- '8080:8080'
+ networks:
+ - act
volumes:
- github-act-cache-server-cache:/usr/src/app/.caches
- github-act-cache-server-db:/usr/local/etc/
#- ./src:/usr/src/app/src # development
+networks:
+ act:
+ name: act
+ driver: bridge
volumes:
github-act-cache-server-cache:
github-act-cache-server-db:
Changes to .actrc:
+ --env ACTIONS_CACHE_URL=http://act-cache-server.docker:8080/
+ --env ACTIONS_RUNTIME_URL=http://act-cache-server.docker:8080/
--env ACTIONS_RUNTIME_TOKEN=foo
+ --container-options "--network=act"
Hey
Following up from a thread in the nektos/act repo. At least a couple of us are experiencing an issue where the localhost server rejects to connect.
I'm on macOS and launching the cache server with:
ACT_CACHE_AUTH_KEY=1234 docker compose up --build
Then act
with:
act -j lint -W .github/workflows/test.yml \
--env ACTIONS_CACHE_URL=http://localhost:8080/ \
--env ACTIONS_RUNTIME_URL=http://localhost:8080/ \
--env ACTIONS_RUNTIME_TOKEN=1234
And it yields this error:
::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78
[ci/test] ❓ ::***::getCacheEntry - Attempt 1 of 2 failed with error: connect ECONNREFUSED ::1:8080
[ci/test] 💬 ::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78
[ci/test] ❓ ::***::getCacheEntry - Attempt 2 of 2 failed with error: connect ECONNREFUSED ::1:8080
[ci/test] ❓ ::warning::Failed to restore: getCacheEntry failed: connect ECONNREFUSED ::1:8080
Any ideas? 🙏
I've tried all sorts of different ways to initialise the env
variables but it's always the same 🤷
So I have an workflow that works when I use
act --container-architecture linux/amd64 --artifact-server-path /tmp/artifacts
But fails when using this cache server instead. My workflow attempts to
I think it comes from https://github.com/actions/upload-artifact
::debug::Artifact Url: http://localhost:8080/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview
| Create Artifact Container - Error is not retryable
| ##### Begin Diagnostic HTTP information #####
| Status Code: 404
| Status Message: Not Found
| Header Information: {
| "x-powered-by": "Express",
| "content-security-policy": "default-src 'none'",
| "x-content-type-options": "nosniff",
| "content-type": "text/html; charset=utf-8",
| "content-length": "177",
| "date": "Fri, 07 Apr 2023 07:12:33 GMT",
| "connection": "close"
| }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.