Giter VIP home page Giter VIP logo

github-act-cache-server's Issues

Using with Docker on MacOS (and a workaround)

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"

getCacheEntry - failed with error: connect ECONNREFUSED ::1:8080

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 🤷

my workflow is trying to use a route that doesn't exist in the app

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"
| }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.