[GH-ISSUE #329] ACTIONS_RUNTIME_URL, ACTIONS_RUNTIME_TOKEN and ACTIONS_CACHE_URL environment variables are missing. #231

Closed
opened 2026-03-01 21:41:32 +03:00 by kerem · 67 comments
Owner

Originally created by @quisse on GitHub (Aug 3, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/329

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.
github.com/actions/toolkit@1cc56db0ff/packages/cache/src/internal/cacheHttpClient.ts (L33-L47)

They all get populated over here

This is the cause of #285, #169 is linked.

Originally created by @quisse on GitHub (Aug 3, 2020). Original GitHub issue: https://github.com/nektos/act/issues/329 Github actions have undocumented environment variables named `ACTIONS_RUNTIME_URL`, `ACTIONS_RUNTIME_TOKEN` and `ACTIONS_CACHE_URL`. The [actions/cache](https://github.com/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](https://github.com/DavidGOrtega/gh-runner/blob/48b040fa804be4a2f43abee064b365838f94055b/src/Runner.Worker/Handlers/ContainerActionHandler.cs#L178-L185) This is the cause of #285, #169 is linked.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 25, 2020):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:733351675 --> @github-actions[bot] commented on GitHub (Nov 25, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@quisse commented on GitHub (Nov 25, 2020):

The issue is still persistent afaik.

<!-- gh-comment-id:733564050 --> @quisse commented on GitHub (Nov 25, 2020): The issue is still persistent afaik.
Author
Owner

@DivoK commented on GitHub (Dec 20, 2020):

Any news about this problem? Came here from #285

<!-- gh-comment-id:748595005 --> @DivoK commented on GitHub (Dec 20, 2020): Any news about this problem? Came here from #285
Author
Owner

@ayozemr commented on GitHub (Jan 19, 2021):

Coming from https://github.com/nektos/act/issues/169

<!-- gh-comment-id:762959793 --> @ayozemr commented on GitHub (Jan 19, 2021): Coming from https://github.com/nektos/act/issues/169
Author
Owner

@jshwi commented on GitHub (Jan 24, 2021):

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?

<!-- gh-comment-id:766299067 --> @jshwi commented on GitHub (Jan 24, 2021): 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?
Author
Owner

@catthehacker commented on GitHub (Jan 24, 2021):

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.

<!-- gh-comment-id:766341018 --> @catthehacker commented on GitHub (Jan 24, 2021): > 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.
Author
Owner

@jshwi commented on GitHub (Jan 25, 2021):

Thank you, @catthehacker. I appreciate now having a better understanding of this.

<!-- gh-comment-id:766522765 --> @jshwi commented on GitHub (Jan 25, 2021): Thank you, @catthehacker. I appreciate now having a better understanding of this.
Author
Owner

@joshmgross commented on GitHub (Jan 25, 2021):

👋 @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).

<!-- gh-comment-id:766960494 --> @joshmgross commented on GitHub (Jan 25, 2021): 👋 @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).
Author
Owner

@catthehacker commented on GitHub (Jan 26, 2021):

@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.

<!-- gh-comment-id:767362916 --> @catthehacker commented on GitHub (Jan 26, 2021): @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.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 26, 2021):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:786323029 --> @github-actions[bot] commented on GitHub (Feb 26, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@anthonykawa commented on GitHub (Feb 26, 2021):

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.

<!-- gh-comment-id:786343296 --> @anthonykawa commented on GitHub (Feb 26, 2021): 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.
Author
Owner

@catthehacker commented on GitHub (Feb 26, 2021):

Thanks a lot @anthonykawa. Will take a look at it soon when I'll get time to develop artefact support.

<!-- gh-comment-id:786507755 --> @catthehacker commented on GitHub (Feb 26, 2021): Thanks a lot @anthonykawa. Will take a look at it soon when I'll get time to develop artefact support.
Author
Owner

@github-actions[bot] commented on GitHub (Mar 29, 2021):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:808995288 --> @github-actions[bot] commented on GitHub (Mar 29, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@ivan4th commented on GitHub (Mar 29, 2021):

Needed for artifacts, please don't close

<!-- gh-comment-id:809469624 --> @ivan4th commented on GitHub (Mar 29, 2021): Needed for artifacts, please don't close
Author
Owner

@ChristopherHX commented on GitHub (May 2, 2021):

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).

<!-- gh-comment-id:830803259 --> @ChristopherHX commented on GitHub (May 2, 2021): I have built (this year) a whole `act` like clone which have a builtin [artifact](https://github.com/ChristopherHX/runner.server/blob/main/src/Runner.Server/Controllers/ArtifactController.cs) and [cache](https://github.com/ChristopherHX/runner.server/blob/main/src/Runner.Server/Controllers/CacheController.cs) server. [My clone](https://github.com/ChristopherHX/runner.server) 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).
Author
Owner

@chevdor commented on GitHub (Jun 4, 2021):

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...

<!-- gh-comment-id:854838927 --> @chevdor commented on GitHub (Jun 4, 2021): 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...
Author
Owner

@jgsqware commented on GitHub (Jul 1, 2021):

@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

<!-- gh-comment-id:872324923 --> @jgsqware commented on GitHub (Jul 1, 2021): @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
Author
Owner

@almed4 commented on GitHub (Jul 8, 2021):

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?

<!-- gh-comment-id:876664675 --> @almed4 commented on GitHub (Jul 8, 2021): 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?
Author
Owner

@Erriez commented on GitHub (Aug 16, 2021):

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?

<!-- gh-comment-id:899668271 --> @Erriez commented on GitHub (Aug 16, 2021): > 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?
Author
Owner

@catthehacker commented on GitHub (Aug 16, 2021):

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.

<!-- gh-comment-id:899692430 --> @catthehacker commented on GitHub (Aug 16, 2021): > 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.
Author
Owner

@Erriez commented on GitHub (Aug 16, 2021):

There is no plan to support that action at all.

It looks like some people tried to run a local server for caching.

What do you mean?

Two things:

  1. I'm looking for a method to share images between jobs: Build Docker image in job 1, test Docker image in job 2, deploy Docker image in job 3.
  2. Skip the build when the image is already build and unchanged. Currently, every build starts from scratch and downloads all dependencies which costs time. I also tried docker/build-push-action@v2 Local Cache with cache-from and cache-to without luck in Act.

Do you have a suggestion / hint?

<!-- gh-comment-id:899701025 --> @Erriez commented on GitHub (Aug 16, 2021): > There is no plan to support that action at all. It looks like some people tried to run a local server for caching. > What do you mean? Two things: 1. I'm looking for a method to share images between jobs: Build Docker image in job 1, test Docker image in job 2, deploy Docker image in job 3. 2. Skip the build when the image is already build and unchanged. Currently, every build starts from scratch and downloads all dependencies which costs time. I also tried [docker/build-push-action@v2 Local Cache](https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#local-cache) with `cache-from` and `cache-to` without luck in `Act`. Do you have a suggestion / hint?
Author
Owner

@catthehacker commented on GitHub (Aug 16, 2021):

It looks like some people tried to run a local server for caching artefacts.

Do you have a suggestion / hint?

There is nothing that needs to be done except that jobs need to depend on each other but it would be much easier to tell what is wrong if you showed your repo/workflow.
image

<!-- gh-comment-id:899708512 --> @catthehacker commented on GitHub (Aug 16, 2021): > It looks like some people tried to run a local server for ~~caching~~ artefacts. > Do you have a suggestion / hint? There is nothing that needs to be done except that jobs need to depend on each other but it would be much easier to tell what is wrong if you showed your repo/workflow. ![image](https://user-images.githubusercontent.com/31106839/129608847-834d4894-4df1-4eb1-887a-fd00c31ff5c5.png)
Author
Owner

@Erriez commented on GitHub (Aug 16, 2021):

Thanks for your quick reply. I'm optimizing Github Actions CI build/test/deployment flow for a full stack email server using multiple Docker containers, project Mailu.

Github Actions CI config file:
https://github.com/Mailu/Mailu/blob/master/.github/workflows/CI.yml

The goal is to build and test the Docker images locally before providing a PR. This Act project seems to be the right tool for us to do this and speed-up the development process.

This CI.yml flow uses actions/cache@v2 by default and works perfect on Github, but not locally with act as mentioned in this issue:

[CI/Build images] ⭐  Run Cache buildx layers
INFO[0001]   ☁  git clone 'https://github.com/actions/cache' # ref=v2 
[CI/Build images]   🐳  docker cp src=/home/a/.cache/act/actions-cache@v2/ dst=/var/run/act/actions/actions-cache@v2/
[CI/Build images]   🐳  docker exec cmd=[mkdir -p /var/run/act/actions/actions-cache@v2/] user=
[CI/Build images]   🐳  docker exec cmd=[node /var/run/act/actions/actions-cache@v2/dist/restore/index.js] user=
[CI/Build images]   ❓  ::save-state name=CACHE_KEY::Linux-buildx-3a96bf21701334370d6ffda25c4d7c5f6409ddf0
[CI/Build images]   💬  ::debug::Resolved Keys:
[CI/Build images]   💬  ::debug::["Linux-buildx-3a96bf21701334370d6ffda25c4d7c5f6409ddf0","Linux-buildx-"]
[CI/Build images]   💬  ::debug::Checking zstd --version
[CI/Build images]   💬  ::debug::*** zstd command line interface 64-bits v1.4.4, by Yann Collet ***
[CI/Build images]   💬  ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache.
[CI/Build images]   💬  ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache.
| [warning]getCacheEntry failed: Cache Service Url not found, unable to restore cache.
[CI/Build images]   ⚙  ::set-output:: cache-hit=false

It tries to contact the cache service via an API which is not available on a local machine. For this reason, there is never a cache hit and always rebuilds all images. It looks like @anthonykawa tried to create such server to upload/download images, but I could not get the up and running and hopefully he can answer the question how he used it.

When the build has been completed, it exports the created images to a tar file to pass it to the next test jobs. This is time consuming process, but required when containers are re-created from scratch at the start of each job. Alternatively, the images should be pushed to a registry, but is not preferred when the images are untested.

I've created a test case which is available here:
https://github.com/Erriez/act-testcase

Simply clone the project and run act multiple times. The image is rebuild from scratch at each run.

Q1) How can this optimized for act to skip the build when the image is not changed and already available as actions/cache@v2 cannot be used?

Q2) How can the build images used in a second test job using act?

<!-- gh-comment-id:899743548 --> @Erriez commented on GitHub (Aug 16, 2021): Thanks for your quick reply. I'm optimizing Github Actions CI build/test/deployment flow for a full stack email server using multiple Docker containers, project [Mailu](https://mailu.io). Github Actions CI config file: https://github.com/Mailu/Mailu/blob/master/.github/workflows/CI.yml The goal is to build and test the Docker images locally before providing a PR. This `Act` project seems to be the right tool for us to do this and speed-up the development process. This `CI.yml` flow uses `actions/cache@v2` by default and works perfect on Github, but not locally with `act` as mentioned in this issue: ``` [CI/Build images] ⭐ Run Cache buildx layers INFO[0001] ☁ git clone 'https://github.com/actions/cache' # ref=v2 [CI/Build images] 🐳 docker cp src=/home/a/.cache/act/actions-cache@v2/ dst=/var/run/act/actions/actions-cache@v2/ [CI/Build images] 🐳 docker exec cmd=[mkdir -p /var/run/act/actions/actions-cache@v2/] user= [CI/Build images] 🐳 docker exec cmd=[node /var/run/act/actions/actions-cache@v2/dist/restore/index.js] user= [CI/Build images] ❓ ::save-state name=CACHE_KEY::Linux-buildx-3a96bf21701334370d6ffda25c4d7c5f6409ddf0 [CI/Build images] 💬 ::debug::Resolved Keys: [CI/Build images] 💬 ::debug::["Linux-buildx-3a96bf21701334370d6ffda25c4d7c5f6409ddf0","Linux-buildx-"] [CI/Build images] 💬 ::debug::Checking zstd --version [CI/Build images] 💬 ::debug::*** zstd command line interface 64-bits v1.4.4, by Yann Collet *** [CI/Build images] 💬 ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache. [CI/Build images] 💬 ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache. | [warning]getCacheEntry failed: Cache Service Url not found, unable to restore cache. [CI/Build images] ⚙ ::set-output:: cache-hit=false ``` It tries to contact the cache service via an API which is not available on a local machine. For this reason, there is never a cache hit and always rebuilds all images. It looks like @anthonykawa tried to create such server to upload/download images, but I could not get the up and running and hopefully he can answer the question how he used it. When the build has been completed, it exports the created images to a `tar` file to pass it to the next test jobs. This is time consuming process, but required when containers are re-created from scratch at the start of each job. Alternatively, the images should be pushed to a registry, but is not preferred when the images are untested. I've created a test case which is available here: https://github.com/Erriez/act-testcase Simply clone the project and run `act` multiple times. The image is rebuild from scratch at each run. Q1) How can this optimized for `act` to skip the build when the image is not changed and already available as `actions/cache@v2` cannot be used? Q2) How can the build images used in a second `test` job using `act`?
Author
Owner

@catthehacker commented on GitHub (Aug 16, 2021):

Add if: ${{ !env.ACT }} to all steps that are actions/cache, run: docker save ... and run: docker load ...

Q1) How can this optimized for act to skip the build when the image is not changed and already available as actions/cache@v2 cannot be used?

Q2) How can the build images used in a second test job using act?

Because you are using buildx action that creates new builder for each run and each run cache is exclusive to that builder.
If the buildx builder is the same each run, cache will be re-used.

<!-- gh-comment-id:899759152 --> @catthehacker commented on GitHub (Aug 16, 2021): Add `if: ${{ !env.ACT }}` to all steps that are `actions/cache`, `run: docker save ...` and `run: docker load ...` > Q1) How can this optimized for `act` to skip the build when the image is not changed and already available as `actions/cache@v2` cannot be used? > > Q2) How can the build images used in a second `test` job using `act`? Because you are using buildx action that creates new builder for each run and each run cache is exclusive to that builder. If the buildx builder is the same each run, cache will be re-used.
Author
Owner

@Erriez commented on GitHub (Aug 16, 2021):

@catthehacker Thanks for your valuable reply.

Adding if: ${{ !env.ACT }} to the uses: actions/cache@v2 entries skips this unsupported action which save time on the timeout.

You're right: A cache build works fine for a normal docker build command. I was not aware of this.
I'll check how to configure the buildx builder to reuses the same cache every time. I'll investigate this further.

docker save and docker load can be used within the same job and works.
However, actions/cache@v2 was used to share the images between jobs. Is an alternative available (without pushing to a registry)? For example by using a volume of the act build container?

<!-- gh-comment-id:899773789 --> @Erriez commented on GitHub (Aug 16, 2021): @catthehacker Thanks for your valuable reply. Adding `if: ${{ !env.ACT }}` to the `uses: actions/cache@v2` entries skips this unsupported action which save time on the timeout. You're right: A cache build works fine for a _normal_ `docker build` command. I was not aware of this. I'll check how to configure the buildx builder to reuses the same cache every time. I'll investigate this further. `docker save` and `docker load` can be used within the same job and works. However, `actions/cache@v2` was used to share the images between jobs. Is an alternative available (without pushing to a registry)? For example by using a volume of the act build container?
Author
Owner

@catthehacker commented on GitHub (Aug 16, 2021):

act --env DOCKER_BUILDKIT=0 should work.

There is no need for any kind of volumes in act. All Docker work is saved either on host or in builder containers.

<!-- gh-comment-id:899784016 --> @catthehacker commented on GitHub (Aug 16, 2021): `act --env DOCKER_BUILDKIT=0` should work. There is no need for any kind of volumes in `act`. All Docker work is saved either on host or in builder containers.
Author
Owner

@Erriez commented on GitHub (Aug 17, 2021):

act --env DOCKER_BUILDKIT=0 should work.

Unfortunately it does not work.

@catthehacker I try to find an alternative for actions/cache: Do you have ideas for the following questions?

  1. Is there a possibility to share files between jobs with act? I need to pass build artifacts to the next job.
  2. Is there a possibility to share files between a container running with act and the host? For example to share a certificate required to login to a local registry?
<!-- gh-comment-id:900623827 --> @Erriez commented on GitHub (Aug 17, 2021): > act --env DOCKER_BUILDKIT=0 should work. Unfortunately it does not work. @catthehacker I try to find an alternative for `actions/cache`: Do you have ideas for the following questions? 1) Is there a possibility to share files between jobs with `act`? I need to pass build artifacts to the next job. 2) Is there a possibility to share files between a container running with `act` and the host? For example to share a certificate required to login to a local registry?
Author
Owner

@nschwermann commented on GitHub (Aug 29, 2021):

Also running into this issue. I have two jobs the first job generates files for second job and saves them using upload-artifact@v2 but I can't seem to get it to work in act

<!-- gh-comment-id:907859780 --> @nschwermann commented on GitHub (Aug 29, 2021): Also running into this issue. I have two jobs the first job generates files for second job and saves them using upload-artifact@v2 but I can't seem to get it to work in act
Author
Owner

@simonhkswan commented on GitHub (Sep 21, 2021):

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 did you have any more luck with this? I found if I used the server from @anthonykawa with in a simple Docker container

FROM node:16
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD [ "node", "index.js" ]

And ran

docker run -p 80:8080 --network bridge -d artifact-server

with ACTIONS_CACHE_URL=localhost/ (i'm not sure how much docker likes ':' placed in environment variables but we can just let it default to port 80.)

Then it would try to connect but get a 400

::debug::Resource Url: localhost/_apis/...
::debug::getCacheEntry - Attempt 1 of 2 failed with error: Failed request: (400)

... and now I'm stuck at this point.

<!-- gh-comment-id:923782708 --> @simonhkswan commented on GitHub (Sep 21, 2021): > 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 did you have any more luck with this? I found if I used the server from @anthonykawa with in a simple Docker container ```docker FROM node:16 WORKDIR /usr/src/app COPY package*.json ./ RUN npm install COPY . . EXPOSE 8080 CMD [ "node", "index.js" ] ``` And ran ``` docker run -p 80:8080 --network bridge -d artifact-server ``` with `ACTIONS_CACHE_URL=localhost/` (i'm not sure how much docker likes ':' placed in environment variables but we can just let it default to port 80.) Then it would try to connect but get a 400 ``` ::debug::Resource Url: localhost/_apis/... ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Failed request: (400) ``` ... and now I'm stuck at this point.
Author
Owner

@econchick commented on GitHub (Oct 6, 2021):

@simonhkswan @chevdor I got @anthonykawa 's server to work!

With the Dockerfile, I added ENV AUTH_KEY=foo (can be whatever). When running the docker image, I dropped the -d flag so I could see any logs.

Then in another terminal, I ran act like so:

$ act -j my_job \
  --env ACTIONS_CACHE_URL=http://localhost/ \
  --env ACTIONS_RUNTIME_URL=http://localhost/ \
  --env ACTIONS_RUNTIME_TOKEN=foo

where ACTIONS_RUNTIME_TOKEN is the same as the AUTH_KEY set in the dockerized server, and the http:// is needed for both URLs.

<!-- gh-comment-id:937019758 --> @econchick commented on GitHub (Oct 6, 2021): @simonhkswan @chevdor I got @anthonykawa 's server to work! With the Dockerfile, I added `ENV AUTH_KEY=foo` (can be whatever). When running the docker image, I dropped the `-d` flag so I could see any logs. Then in another terminal, I ran `act` like so: ```sh $ act -j my_job \ --env ACTIONS_CACHE_URL=http://localhost/ \ --env ACTIONS_RUNTIME_URL=http://localhost/ \ --env ACTIONS_RUNTIME_TOKEN=foo ``` where `ACTIONS_RUNTIME_TOKEN` is the same as the `AUTH_KEY` set in the dockerized server, and the `http://` is needed for both URLs.
Author
Owner

@ClientCrash commented on GitHub (Oct 7, 2021):

With the arguments act --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_RUNTIME_URL=http://localhost/
everything works fine until i reach the artifacts part.
Create Artifact Container - Attempt 1 of 5 failed with error: connect ECONNREFUSED 127.0.0.1:80
Do i have to run some kind of server or something? Is there a solution provided with act?

<!-- gh-comment-id:937544632 --> @ClientCrash commented on GitHub (Oct 7, 2021): With the arguments `act --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_RUNTIME_URL=http://localhost/` everything works fine until i reach the artifacts part. `Create Artifact Container - Attempt 1 of 5 failed with error: connect ECONNREFUSED 127.0.0.1:80` Do i have to run some kind of server or something? Is there a solution provided with act?
Author
Owner

@catthehacker commented on GitHub (Oct 7, 2021):

Do i have to run some kind of server or something? Is there a solution provided with act?

Please read the thread.

<!-- gh-comment-id:937598365 --> @catthehacker commented on GitHub (Oct 7, 2021): > Do i have to run some kind of server or something? Is there a solution provided with act? Please read the thread.
Author
Owner

@davetapley commented on GitHub (Oct 14, 2021):

It works! 🎉


I took @simonhkswan's sample Dockerfile 🙏🏻 and pushed to ghcr.io/jefuller/artifact-server:latest.

Then I added to docker-compose.yml:

  artifact-server:
    image: ghcr.io/jefuller/artifact-server:latest
    environment:
      AUTH_KEY: foo
    ports:
      - "8080:8080

The added (per @econchick 🙏🏻 ) to .actrc:

--env ACTIONS_CACHE_URL=http://localhost:8080/
--env ACTIONS_RUNTIME_URL=http://localhost:8080/
--env ACTIONS_RUNTIME_TOKEN=foo

Sample of upload:

[Main/Build dev]   💬  ::debug::URL is http://localhost:8080/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview&artifactName=dev
[Main/Build dev]   💬  ::debug::Artifact dev has been successfully uploaded, total size in bytes: 23217
| Finished uploading artifact dev. Reported size is 7573 bytes. There were 0 items that failed to upload
| Artifact dev has been successfully uploaded!
[Main/Build dev]   ✅  Success - actions/upload-artifact@v2

and download:

[Main/Deploy to dev] ⭐  Run actions/download-artifact@v2
[...]
[Main/Deploy to dev]   💬  ::debug::Artifact Url: http://localhost:8080/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview
| Directory structure has been setup for the artifact
[Main/Deploy to dev]   💬  ::debug::Download file concurrency is set to 2
| Total number of files that will be downloaded: 11
[...]
[Main/Deploy to dev]   ⚙  ::set-output:: download-path=/workspace/.ansible/files/web
| Artifact download has finished successfully
[Main/Deploy to dev]   ✅  Success - actions/download-artifact@v2
<!-- gh-comment-id:942854810 --> @davetapley commented on GitHub (Oct 14, 2021): It works! 🎉 --- I took @simonhkswan's sample `Dockerfile` 🙏🏻 and pushed to [`ghcr.io/jefuller/artifact-server:latest`](https://github.com/JEFuller/artifact-server/pkgs/container/artifact-server). Then I added to `docker-compose.yml`: ```yml artifact-server: image: ghcr.io/jefuller/artifact-server:latest environment: AUTH_KEY: foo ports: - "8080:8080 ``` The added (per @econchick 🙏🏻 ) to `.actrc`: ``` --env ACTIONS_CACHE_URL=http://localhost:8080/ --env ACTIONS_RUNTIME_URL=http://localhost:8080/ --env ACTIONS_RUNTIME_TOKEN=foo ``` --- Sample of upload: ``` [Main/Build dev] 💬 ::debug::URL is http://localhost:8080/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview&artifactName=dev [Main/Build dev] 💬 ::debug::Artifact dev has been successfully uploaded, total size in bytes: 23217 | Finished uploading artifact dev. Reported size is 7573 bytes. There were 0 items that failed to upload | Artifact dev has been successfully uploaded! [Main/Build dev] ✅ Success - actions/upload-artifact@v2 ``` and download: ``` [Main/Deploy to dev] ⭐ Run actions/download-artifact@v2 [...] [Main/Deploy to dev] 💬 ::debug::Artifact Url: http://localhost:8080/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview | Directory structure has been setup for the artifact [Main/Deploy to dev] 💬 ::debug::Download file concurrency is set to 2 | Total number of files that will be downloaded: 11 [...] [Main/Deploy to dev] ⚙ ::set-output:: download-path=/workspace/.ansible/files/web | Artifact download has finished successfully [Main/Deploy to dev] ✅ Success - actions/download-artifact@v2 ```
Author
Owner

@davetapley commented on GitHub (Oct 14, 2021):

Update since playing with ⬆️

If you run upload-artifact multiple times it will just keep 'adding' to the artifact.

One hacky workaround is to docker exec rm -r '/usr/src/app/1' in artifact-server,
but a better solution is to set GITHUB_RUN_ID (which I found here), e.g:

 act -j build-dev --env GITHUB_RUN_ID=$(date '+%s')

@catthehacker would you accept a PR to set that ⬆️ to a random (or incrementing) number each run?
I presume when running on GitHub Actions it changes each run.

<!-- gh-comment-id:942886180 --> @davetapley commented on GitHub (Oct 14, 2021): Update since playing with ⬆️ If you run `upload-artifact` multiple times it will just keep 'adding' to the artifact. One hacky workaround is to `docker exec` `rm -r '/usr/src/app/1'` in `artifact-server`, but a _better solution_ is to set `GITHUB_RUN_ID` (which I found [here](https://github.com/actions/toolkit/blob/fc005283374f1cea5e03ea1caf959cd9ff12fdc2/packages/artifact/src/internal/utils.ts#L215)), e.g: ``` act -j build-dev --env GITHUB_RUN_ID=$(date '+%s') ``` @catthehacker would you accept a PR to set that ⬆️ to a random (or incrementing) number each run? I _presume_ when running on GitHub Actions it changes each run.
Author
Owner

@catthehacker commented on GitHub (Oct 17, 2021):

It works as it should. If you need to change it, you can use the envvar

<!-- gh-comment-id:945185386 --> @catthehacker commented on GitHub (Oct 17, 2021): It works as it should. If you need to change it, you can use the envvar
Author
Owner

@sp-ricard-valverde commented on GitHub (Oct 29, 2021):

@simonhkswan @chevdor I got @anthonykawa 's server to work!

With the Dockerfile, I added ENV AUTH_KEY=foo (can be whatever). When running the docker image, I dropped the -d flag so I could see any logs.

Then in another terminal, I ran act like so:

$ act -j my_job \
  --env ACTIONS_CACHE_URL=http://localhost/ \
  --env ACTIONS_RUNTIME_URL=http://localhost/ \
  --env ACTIONS_RUNTIME_TOKEN=foo

where ACTIONS_RUNTIME_TOKEN is the same as the AUTH_KEY set in the dockerized server, and the http:// is needed for both URLs.

I belive @simonhkswan @chevdor are expecting the actions/cache@v2 to work with @anthonykawa server(by what I can see in their execution log request urls), but actually the actions that do work are actions/upload-artifact@v2 and actions/download-artifact@v2.

<!-- gh-comment-id:954556455 --> @sp-ricard-valverde commented on GitHub (Oct 29, 2021): > @simonhkswan @chevdor I got @anthonykawa 's server to work! > > With the Dockerfile, I added `ENV AUTH_KEY=foo` (can be whatever). When running the docker image, I dropped the `-d` flag so I could see any logs. > > Then in another terminal, I ran `act` like so: > > ```shell > $ act -j my_job \ > --env ACTIONS_CACHE_URL=http://localhost/ \ > --env ACTIONS_RUNTIME_URL=http://localhost/ \ > --env ACTIONS_RUNTIME_TOKEN=foo > ``` > > where `ACTIONS_RUNTIME_TOKEN` is the same as the `AUTH_KEY` set in the dockerized server, and the `http://` is needed for both URLs. I belive @simonhkswan @chevdor are expecting the `actions/cache@v2` to work with @anthonykawa server(by what I can see in their execution log request urls), but actually the actions that do work are `actions/upload-artifact@v2` and `actions/download-artifact@v2`.
Author
Owner

@catthehacker commented on GitHub (Oct 29, 2021):

Did someone get this up and running in combination with actions/cache@v2?

There is no plan to support that action at all.

https://github.com/nektos/act/issues/329#issuecomment-899692430

<!-- gh-comment-id:954595697 --> @catthehacker commented on GitHub (Oct 29, 2021): > > Did someone get this up and running in combination with `actions/cache@v2`? > > There is no plan to support that action at all. https://github.com/nektos/act/issues/329#issuecomment-899692430
Author
Owner

@BevanR commented on GitHub (Dec 7, 2021):

If you're following this thread for a solution to the actions/cache to develop GHA workflows locally so that you can get faster feedback when you test-run on your changes to GHA workflow yaml files, see https://github.com/nektos/act/issues/285#issuecomment-987550101

<!-- gh-comment-id:987551893 --> @BevanR commented on GitHub (Dec 7, 2021): If you're following this thread for a solution to the `actions/cache` to develop GHA workflows locally so that you can get faster feedback when you test-run on your changes to GHA workflow yaml files, see https://github.com/nektos/act/issues/285#issuecomment-987550101
Author
Owner

@RafalSkolasinski commented on GitHub (Jun 16, 2022):

Just read this thread, dummy question: what blocks us from just including anthonykawa's server to enable artifact feature by default in act?

<!-- gh-comment-id:1157964317 --> @RafalSkolasinski commented on GitHub (Jun 16, 2022): Just read this thread, dummy question: what blocks us from just including [anthonykawa](https://github.com/anthonykawa)'s server to enable artifact feature by default in act?
Author
Owner

@KnisterPeter commented on GitHub (Jun 16, 2022):

There is already a server implemented, it just needs to be enabled via flag. 😉

<!-- gh-comment-id:1158063200 --> @KnisterPeter commented on GitHub (Jun 16, 2022): There is already a server implemented, it just needs to be enabled via flag. 😉
Author
Owner

@luixo commented on GitHub (Jul 18, 2022):

If you are using nektos/act with actions/upload-artifact and actions/download-artifact, artifact server is already implemented in act (though it's not mentioned in this issue how to run it).

Just use --artifact-server-path option.

It is used like this: --artifact-server-path /tmp/artifacts (don't forget to mkdir /tmp/artifacts).

<!-- gh-comment-id:1187246629 --> @luixo commented on GitHub (Jul 18, 2022): If you are using `nektos/act` with `actions/upload-artifact` and `actions/download-artifact`, artifact server is already implemented in `act` (though it's not mentioned in this issue how to run it). **Just use `--artifact-server-path` option.** It is used like this: `--artifact-server-path /tmp/artifacts` (don't forget to `mkdir /tmp/artifacts`).
Author
Owner

@DrJume commented on GitHub (Oct 18, 2022):

By default actions/cache uses Azure Blob Storage hosted by GitHub. It is possible to self-host Azure Blob Storage with https://github.com/Azure/Azurite.

<!-- gh-comment-id:1282666112 --> @DrJume commented on GitHub (Oct 18, 2022): By default actions/cache uses Azure Blob Storage hosted by GitHub. It is possible to self-host Azure Blob Storage with https://github.com/Azure/Azurite.
Author
Owner

@rickmark commented on GitHub (Oct 31, 2022):

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.

This is great - I think we could probably even implement it in Go pretty quick and add it as an endpoint that is served directly by act locally to make common flows transparent (and eliminate the need of a container).

I might give that a try and submit a PR

<!-- gh-comment-id:1297570880 --> @rickmark commented on GitHub (Oct 31, 2022): > 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. This is great - I think we could probably even implement it in Go pretty quick and add it as an endpoint that is served directly by `act` locally to make common flows transparent (and eliminate the need of a container). I might give that a try and submit a PR
Author
Owner

@KnisterPeter commented on GitHub (Oct 31, 2022):

It's already implemented in act

<!-- gh-comment-id:1297572643 --> @KnisterPeter commented on GitHub (Oct 31, 2022): It's already implemented in act
Author
Owner

@rickmark commented on GitHub (Oct 31, 2022):

Wow - was working on a reusable workflow branch and somehow missed that this was being provided, excuse the noise

<!-- gh-comment-id:1297574525 --> @rickmark commented on GitHub (Oct 31, 2022): Wow - was working on a reusable workflow branch and somehow missed that this was being provided, excuse the noise
Author
Owner

@viotti commented on GitHub (Nov 8, 2022):

The solution provided by @davetapley works on macOS. Using the --artifact-server-path does not.

$ mkdir /tmp/artifacts
$ act --artifact-server-path /tmp/artifacts

… (snip) …

[🏗 Continuous Integration/test-integration   ]   💬  ::debug::Artifact Url: http://192.168.1.23:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview
| Create Artifact Container - Attempt 1 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567
| Create Artifact Container - Attempt 2 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567
| Create Artifact Container - Attempt 3 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567
| Create Artifact Container - Attempt 4 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567
| Create Artifact Container - Attempt 5 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567
[🏗 Continuous Integration/test-integration   ]   ❗  ::error::Create Artifact Container failed: connect EHOSTUNREACH 192.168.1.23:34567
[🏗 Continuous Integration/test-integration   ]   ❌  Failure - Main Upload coverage data
[🏗 Continuous Integration/test-integration   ] exitcode '1': failure
[🏗 Continuous Integration/test-integration   ] 🏁  Job failed

In the logs, 192.168.1.23 is the IP address of the en0 network interface. It seems that on macOS, the jobs' containers cannot reach the Go HTTP server. Probably due to virtualization that happens on that specific platform. Running Docker Desktop For Mac.

Firewall is off.

Screen Shot 2022-11-08 at 11 27 11

I've tried checking and clearing the Use the new Virtualization framework option on Docker Desktop, to no effect.

Screen Shot 2022-11-08 at 11 26 26
<!-- gh-comment-id:1307316143 --> @viotti commented on GitHub (Nov 8, 2022): The solution provided by @davetapley works on macOS. Using the `--artifact-server-path` does not. $ mkdir /tmp/artifacts $ act --artifact-server-path /tmp/artifacts … (snip) … [🏗 Continuous Integration/test-integration ] 💬 ::debug::Artifact Url: http://192.168.1.23:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview | Create Artifact Container - Attempt 1 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567 | Create Artifact Container - Attempt 2 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567 | Create Artifact Container - Attempt 3 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567 | Create Artifact Container - Attempt 4 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567 | Create Artifact Container - Attempt 5 of 5 failed with error: connect EHOSTUNREACH 192.168.1.23:34567 [🏗 Continuous Integration/test-integration ] ❗ ::error::Create Artifact Container failed: connect EHOSTUNREACH 192.168.1.23:34567 [🏗 Continuous Integration/test-integration ] ❌ Failure - Main Upload coverage data [🏗 Continuous Integration/test-integration ] exitcode '1': failure [🏗 Continuous Integration/test-integration ] 🏁 Job failed In the logs, 192.168.1.23 is the IP address of the `en0` network interface. It seems that on macOS, the jobs' containers cannot reach the Go HTTP server. Probably due to virtualization that happens on that specific platform. Running Docker Desktop For Mac. Firewall is off. <img width="780" alt="Screen Shot 2022-11-08 at 11 27 11" src="https://user-images.githubusercontent.com/1233439/200590661-2b83352b-a68c-48c4-8110-dce2396a4142.png"> I've tried checking and clearing the **Use the new Virtualization framework** option on Docker Desktop, to no effect. <img width="459" alt="Screen Shot 2022-11-08 at 11 26 26" src="https://user-images.githubusercontent.com/1233439/200590984-4e627857-003d-48e1-895c-b5fdc0226042.png">
Author
Owner

@ChristopherHX commented on GitHub (Nov 8, 2022):

It seems that on macOS, the jobs' containers cannot reach the Go HTTP server

This must have changed in recent docker / macOS. I was able to connect to the external wifi address on macOS10.14 and windows 11.
Once I had to reinstall docker on windows 10 to restore access to a local network address.

Maybe the artifact server needs to be a docker container in the same network as the job container to resolve this.

<!-- gh-comment-id:1307369770 --> @ChristopherHX commented on GitHub (Nov 8, 2022): > It seems that on macOS, the jobs' containers cannot reach the Go HTTP server This must have changed in recent docker / macOS. I was able to connect to the external wifi address on macOS10.14 and windows 11. Once I had to reinstall docker on windows 10 to restore access to a local network address. Maybe the artifact server needs to be a docker container in the same network as the job container to resolve this.
Author
Owner

@KnisterPeter commented on GitHub (Nov 8, 2022):

@viotti Can you please post your workflow here? That would make the issue more complete and as well probably more reproduceable.
The artifact server was implemented to stay on the host so it could write into the hosts file system. When we move it into it's own container, it would be good to use a bind mount into the host FS I think. That should be possible with a non-breaking change.

As this issue is closed and also the title is not true anymore, I think it would make sense to move it over into a new issue describing the current problem.

<!-- gh-comment-id:1307392070 --> @KnisterPeter commented on GitHub (Nov 8, 2022): @viotti Can you please post your workflow here? That would make the issue more complete and as well probably more reproduceable. The artifact server was implemented to stay on the host so it could write into the hosts file system. When we move it into it's own container, it would be good to use a bind mount into the host FS I think. That should be possible with a non-breaking change. As this issue is closed and also the title is not true anymore, I think it would make sense to move it over into a new issue describing the current problem.
Author
Owner

@viotti commented on GitHub (Nov 8, 2022):

@KnisterPeter sure. Here it goes.

name: 🏗 Continuous Integration

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

permissions:
  contents: read

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up Python 3.10
        uses: actions/setup-python@v4
        with: { python-version: '3.10' }

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install flake8
        env:
          PIP_ROOT_USER_ACTION: ignore

      - name: Lint with flake8
        run: python -m flake8 --count --show-source --statistics *.py */*.py */*/*.py

  test-unitary:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up Python 3.10
        uses: actions/setup-python@v4
        with: { python-version: '3.10' }

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install pytest coverage
        env:
          PIP_ROOT_USER_ACTION: ignore

      - name: Run unitary tests
        run: python -m coverage run -m pytest tests/unitary
        env:
          COVERAGE_FILE: '.coverage.unitary'

      - name: Upload coverage data
        uses: actions/upload-artifact@v2
        with:
          name: coverage-data
          path: '.coverage.*'

  test-integration:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up Python 3.10
        uses: actions/setup-python@v4
        with: { python-version: '3.10' }

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install pytest coverage
        env:
          PIP_ROOT_USER_ACTION: ignore

      - name: Run integration tests
        run: python -m coverage run -m pytest tests/integration
        env:
          COVERAGE_FILE: '.coverage.integration'

      - name: Upload coverage data
        uses: actions/upload-artifact@v2
        with:
          name: coverage-data
          path: '.coverage.*'

  coverage:
    runs-on: ubuntu-latest

    needs: [ test-unitary, test-integration ]

    steps:
      - uses: actions/checkout@v3

      - name: Set up Python 3.10
        uses: actions/setup-python@v4
        with: { python-version: '3.10' }

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install coverage[toml]
        env:
          PIP_ROOT_USER_ACTION: ignore

      - name: Download coverage data
        uses: actions/download-artifact@v2
        with:
          name: coverage-data

      - name: Combine coverage & fail if it's <100%.
        run: |
          python -m coverage combine
          python -m coverage report --fail-under=100  

@ChristopherHX I think the problem is the new M1/M2 chips, which are ARM. In this case the jobs will run within QEMU, since their images are x86. This might be causing networking issues. On macs with Intel chips the communication with the host probably works. This is just a guess though, I haven't tested to confirm.

<!-- gh-comment-id:1307594698 --> @viotti commented on GitHub (Nov 8, 2022): @KnisterPeter sure. Here it goes. ``` name: 🏗 Continuous Integration on: push: branches: [ master ] pull_request: branches: [ master ] permissions: contents: read jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python 3.10 uses: actions/setup-python@v4 with: { python-version: '3.10' } - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install flake8 env: PIP_ROOT_USER_ACTION: ignore - name: Lint with flake8 run: python -m flake8 --count --show-source --statistics *.py */*.py */*/*.py test-unitary: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python 3.10 uses: actions/setup-python@v4 with: { python-version: '3.10' } - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install pytest coverage env: PIP_ROOT_USER_ACTION: ignore - name: Run unitary tests run: python -m coverage run -m pytest tests/unitary env: COVERAGE_FILE: '.coverage.unitary' - name: Upload coverage data uses: actions/upload-artifact@v2 with: name: coverage-data path: '.coverage.*' test-integration: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python 3.10 uses: actions/setup-python@v4 with: { python-version: '3.10' } - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install pytest coverage env: PIP_ROOT_USER_ACTION: ignore - name: Run integration tests run: python -m coverage run -m pytest tests/integration env: COVERAGE_FILE: '.coverage.integration' - name: Upload coverage data uses: actions/upload-artifact@v2 with: name: coverage-data path: '.coverage.*' coverage: runs-on: ubuntu-latest needs: [ test-unitary, test-integration ] steps: - uses: actions/checkout@v3 - name: Set up Python 3.10 uses: actions/setup-python@v4 with: { python-version: '3.10' } - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install coverage[toml] env: PIP_ROOT_USER_ACTION: ignore - name: Download coverage data uses: actions/download-artifact@v2 with: name: coverage-data - name: Combine coverage & fail if it's <100%. run: | python -m coverage combine python -m coverage report --fail-under=100 ``` @ChristopherHX I think the problem is the new M1/M2 chips, which are ARM. In this case the jobs will run within QEMU, since their images are x86. This might be causing networking issues. On macs with Intel chips the communication with the host probably works. This is just a guess though, I haven't tested to confirm.
Author
Owner

@dahifi commented on GitHub (Nov 14, 2022):

Same issue with M1, trying to use actions/download-artifact@v2. Getting ACTIONS_RUNTIME_TOKEN missing. Running the artifact server switches fails as well, communication timeout.

Might have to spin up an Ubuntu box somewhere to workaround this.

<!-- gh-comment-id:1313967626 --> @dahifi commented on GitHub (Nov 14, 2022): Same issue with M1, trying to use actions/download-artifact@v2. Getting ACTIONS_RUNTIME_TOKEN missing. Running the artifact server switches fails as well, communication timeout. Might have to spin up an Ubuntu box somewhere to workaround this.
Author
Owner

@ChristopherHX commented on GitHub (Nov 14, 2022):

Just curios what happens if you use

ACTIONS_RUNTIME_URL=http://host.docker.internal:34567/ act --artifact-server-path out

On m1 macs with docker desktop together with enabling artifact server.
I don't have a m1/m2 mac hardware, only cirrus ci would allow me to test something on ci
Defining the env var ACTIONS_RUNTIME_URL allows you to customize the url, while artifact server is already enabled.

<!-- gh-comment-id:1313982624 --> @ChristopherHX commented on GitHub (Nov 14, 2022): Just curios what happens if you use ``` ACTIONS_RUNTIME_URL=http://host.docker.internal:34567/ act --artifact-server-path out ``` On m1 macs with docker desktop together with enabling artifact server. _I don't have a m1/m2 mac hardware, only cirrus ci would allow me to test something on ci_ Defining the env var `ACTIONS_RUNTIME_URL` allows you to customize the url, while artifact server is already enabled.
Author
Owner

@valk commented on GitHub (Nov 22, 2022):

davetapley Can you please share which docker-compose.yml did you use and how did you make it work for those like me?

<!-- gh-comment-id:1324211111 --> @valk commented on GitHub (Nov 22, 2022): [davetapley](https://github.com/davetapley) Can you please share which `docker-compose.yml` did you use and how did you make it work for those like me?
Author
Owner

@viotti commented on GitHub (Nov 28, 2022):

@ChristopherHX just ran

ACTIONS_RUNTIME_URL=http://host.docker.internal:34567/ act --artifact-server-path /tmp/artifacts

Same issue:

[🏗 Continuous Integration/run-integration-tests   ]   ✅  Success - Main Run integration tests
[🏗 Continuous Integration/run-integration-tests   ] ⭐ Run Main Base64 encode code coverage data
[🏗 Continuous Integration/run-integration-tests   ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5] user= workdir=
[🏗 Continuous Integration/run-integration-tests   ]   ✅  Success - Main Base64 encode code coverage data
[🏗 Continuous Integration/run-integration-tests   ] ⭐ Run Main Upload code coverage data
[🏗 Continuous Integration/run-integration-tests   ]   🐳  docker cp src=/Users/viotti/.cache/act/actions-upload-artifact@v3/ dst=/var/run/act/actions/actions-upload-artifact@v3/
[🏗 Continuous Integration/run-integration-tests   ]   🐳  docker exec cmd=[node /var/run/act/actions/actions-upload-artifact@v3/dist/index.js] user= workdir=
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::followSymbolicLinks 'true'
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::implicitDescendants 'true'
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::followSymbolicLinks 'true'
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::implicitDescendants 'true'
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::Search path '/Users/viotti/proj/integration.b64'
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::File:/Users/viotti/proj/integration.b64 was found using the provided searchPath
| With the provided path, there will be 1 file uploaded
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::Root artifact directory is /Users/viotti/proj
| Starting artifact upload
| For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging
| Artifact name is valid!
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::Artifact Url: http://host.docker.internal:34567/_apis/pipelines/workflows/1669643071/artifacts?api-version=6.0-preview
| Create Artifact Container - Attempt 1 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567
| Create Artifact Container - Attempt 2 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567
| Create Artifact Container - Attempt 3 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567
| Create Artifact Container - Attempt 4 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567
| Create Artifact Container - Attempt 5 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567
[🏗 Continuous Integration/run-integration-tests   ]   ❗  ::error::Create Artifact Container failed: connect ECONNREFUSED 192.168.65.2:34567
[🏗 Continuous Integration/run-integration-tests   ]   ❌  Failure - Main Upload code coverage data
[🏗 Continuous Integration/run-integration-tests   ] exitcode '1': failure
[🏗 Continuous Integration/run-integration-tests   ] 🏁  Job failed
<!-- gh-comment-id:1329186247 --> @viotti commented on GitHub (Nov 28, 2022): @ChristopherHX just ran ACTIONS_RUNTIME_URL=http://host.docker.internal:34567/ act --artifact-server-path /tmp/artifacts Same issue: ``` [🏗 Continuous Integration/run-integration-tests ] ✅ Success - Main Run integration tests [🏗 Continuous Integration/run-integration-tests ] ⭐ Run Main Base64 encode code coverage data [🏗 Continuous Integration/run-integration-tests ] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5] user= workdir= [🏗 Continuous Integration/run-integration-tests ] ✅ Success - Main Base64 encode code coverage data [🏗 Continuous Integration/run-integration-tests ] ⭐ Run Main Upload code coverage data [🏗 Continuous Integration/run-integration-tests ] 🐳 docker cp src=/Users/viotti/.cache/act/actions-upload-artifact@v3/ dst=/var/run/act/actions/actions-upload-artifact@v3/ [🏗 Continuous Integration/run-integration-tests ] 🐳 docker exec cmd=[node /var/run/act/actions/actions-upload-artifact@v3/dist/index.js] user= workdir= [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::followSymbolicLinks 'true' [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::implicitDescendants 'true' [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::omitBrokenSymbolicLinks 'true' [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::followSymbolicLinks 'true' [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::implicitDescendants 'true' [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::omitBrokenSymbolicLinks 'true' [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::Search path '/Users/viotti/proj/integration.b64' [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::File:/Users/viotti/proj/integration.b64 was found using the provided searchPath | With the provided path, there will be 1 file uploaded [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::Root artifact directory is /Users/viotti/proj | Starting artifact upload | For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging | Artifact name is valid! [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::Artifact Url: http://host.docker.internal:34567/_apis/pipelines/workflows/1669643071/artifacts?api-version=6.0-preview | Create Artifact Container - Attempt 1 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567 | Create Artifact Container - Attempt 2 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567 | Create Artifact Container - Attempt 3 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567 | Create Artifact Container - Attempt 4 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567 | Create Artifact Container - Attempt 5 of 5 failed with error: connect ECONNREFUSED 192.168.65.2:34567 [🏗 Continuous Integration/run-integration-tests ] ❗ ::error::Create Artifact Container failed: connect ECONNREFUSED 192.168.65.2:34567 [🏗 Continuous Integration/run-integration-tests ] ❌ Failure - Main Upload code coverage data [🏗 Continuous Integration/run-integration-tests ] exitcode '1': failure [🏗 Continuous Integration/run-integration-tests ] 🏁 Job failed ```
Author
Owner

@ChristopherHX commented on GitHub (Nov 28, 2022):

@viotti I see, docker changed the network stack in docker desktop macOS m1.

You get ECONNREFUSED instead of EHOSTUNREACH, different issue.

The problem is that the artifact server only listens to exactly one outbound ipv4 address, but docker is calling from another one.
In this case edit the code of act: github.com/nektos/act@7754ba7fcf/pkg/artifacts/server.go (L279)

ip := "0.0.0.0"

go build, then you have your act in the root folder.
I will create a PR, if it works.

<!-- gh-comment-id:1329215258 --> @ChristopherHX commented on GitHub (Nov 28, 2022): @viotti I see, docker changed the network stack in docker desktop macOS m1. You get `ECONNREFUSED` instead of `EHOSTUNREACH`, different issue. The problem is that the artifact server only listens to exactly one outbound ipv4 address, but docker is calling from another one. In this case edit the code of act: https://github.com/nektos/act/blob/7754ba7fcf3f80b76bb4d7cf1edbe5935c8a6bdc/pkg/artifacts/server.go#L279 ``` ip := "0.0.0.0" ``` `go build`, then you have your `act` in the root folder. I will create a PR, if it works.
Author
Owner

@viotti commented on GitHub (Nov 28, 2022):

@ChristopherHX indeed, that was an oversight on my part. I must admit I glossed over the error message and did not notice it had changed.

Anyways, I did as you asked, and everything worked. 👏 🎉

[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::Artifact Url: http://host.docker.internal:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::URL is http://host.docker.internal:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview&artifactName=code-coverage-data
[🏗 Continuous Integration/run-integration-tests   ]   💬  ::debug::Artifact code-coverage-data has been successfully uploaded, total size in bytes: 71935
| Artifact has been finalized. All files have been successfully uploaded!
| 
| The raw size of all the files that were specified for upload is 71935 bytes
| The size of all the files that were uploaded is 2457 bytes. This takes into account any gzip compression used to reduce the upload size, time and storage
| 
| Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads 
| 
| Artifact code-coverage-data has been successfully uploaded!
<!-- gh-comment-id:1329534796 --> @viotti commented on GitHub (Nov 28, 2022): @ChristopherHX indeed, that was an oversight on my part. I must admit I glossed over the error message and did not notice it had changed. Anyways, I did as you asked, and everything worked. 👏 🎉 ``` [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::Artifact Url: http://host.docker.internal:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::URL is http://host.docker.internal:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview&artifactName=code-coverage-data [🏗 Continuous Integration/run-integration-tests ] 💬 ::debug::Artifact code-coverage-data has been successfully uploaded, total size in bytes: 71935 | Artifact has been finalized. All files have been successfully uploaded! | | The raw size of all the files that were specified for upload is 71935 bytes | The size of all the files that were uploaded is 2457 bytes. This takes into account any gzip compression used to reduce the upload size, time and storage | | Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads | | Artifact code-coverage-data has been successfully uploaded! ```
Author
Owner

@Vaitheesh-SS commented on GitHub (Jan 22, 2023):

Hello!,

I'm trying to run a local test actions on my VM using nektos/act and I'm facing issues in reaching internet especially Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease Could not resolve 'archive.ubuntu.com through my Proxy configured on my Ubuntu VM. The docker containers spin from act is unable to inject the Proxy Env's which I defined in ~/.docker/config.json but this works well when creating containers using docker cli

HTTPS_PROXY=http://localhost:3128 HTTP_PROXY=http://localhost:3128

Tried with act -j deploy --env HTTP_PROXY=http://localhost:3128 --env HTTPS_PROXY=http://localhost:3128 - no luck !

<!-- gh-comment-id:1399415704 --> @Vaitheesh-SS commented on GitHub (Jan 22, 2023): Hello!, I'm trying to run a local test actions on my VM using nektos/act and I'm facing issues in reaching internet especially Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease Could not resolve 'archive.ubuntu.com through my Proxy configured on my Ubuntu VM. The docker containers spin from act is unable to inject the Proxy Env's which I defined in `~/.docker/config.json` but this works well when creating containers using docker cli `HTTPS_PROXY=http://localhost:3128 HTTP_PROXY=http://localhost:3128` Tried with `act -j deploy --env HTTP_PROXY=http://localhost:3128 --env HTTPS_PROXY=http://localhost:3128` - no luck !
Author
Owner

@TD5 commented on GitHub (Feb 17, 2023):

@viotti I see, docker changed the network stack in docker desktop macOS m1.

You get ECONNREFUSED instead of EHOSTUNREACH, different issue.

The problem is that the artifact server only listens to exactly one outbound ipv4 address, but docker is calling from another one. In this case edit the code of act:

github.com/nektos/act@7754ba7fcf/pkg/artifacts/server.go (L279)

ip := "0.0.0.0"

go build, then you have your act in the root folder. I will create a PR, if it works.

It worked for me by modifying addr here: github.com/nektos/act@be4a1477a5/pkg/artifacts/server.go (L290)

Did anything come of the plan to submit a PR for this?

<!-- gh-comment-id:1434741892 --> @TD5 commented on GitHub (Feb 17, 2023): > @viotti I see, docker changed the network stack in docker desktop macOS m1. > > You get `ECONNREFUSED` instead of `EHOSTUNREACH`, different issue. > > The problem is that the artifact server only listens to exactly one outbound ipv4 address, but docker is calling from another one. In this case edit the code of act: > > https://github.com/nektos/act/blob/7754ba7fcf3f80b76bb4d7cf1edbe5935c8a6bdc/pkg/artifacts/server.go#L279 > > ``` > ip := "0.0.0.0" > ``` > > `go build`, then you have your `act` in the root folder. I will create a PR, if it works. It worked for me by modifying `addr` here: https://github.com/nektos/act/blob/be4a1477a5b73b3e17f79891ec6147413acb4df7/pkg/artifacts/server.go#L290 Did anything come of the plan to submit a PR for this?
Author
Owner

@ChristopherHX commented on GitHub (Feb 17, 2023):

Did anything come of the plan to submit a PR for this?

Since then someone else added a cli flag to control this and you always have to override ACTIONS_RUNTIME_URL manually, so just add that flag.

So you can just use the latest release, [::0] is the ipv6 variant of 0.0.0.0.

ACTIONS_RUNTIME_URL=http://host.docker.internal:4322/ act --artifact-server-addr "[::0]" --artifact-server-port 4322 --artifact-server-path out
<!-- gh-comment-id:1434771829 --> @ChristopherHX commented on GitHub (Feb 17, 2023): > Did anything come of the plan to submit a PR for this? Since then someone else added a cli flag to control this and you always have to override ACTIONS_RUNTIME_URL manually, so just add that flag. So you can just use the latest release, `[::0]` is the ipv6 variant of `0.0.0.0`. ``` ACTIONS_RUNTIME_URL=http://host.docker.internal:4322/ act --artifact-server-addr "[::0]" --artifact-server-port 4322 --artifact-server-path out ```
Author
Owner

@fevrin commented on GitHub (Jan 19, 2024):

After some trial-and-error-and-head-scratching when the recommended --artifact-server-path /tmp/artifacts argument didn't work for me, I found that this doesn't work specifically with v4 or higher of either actions/upload-artifacts or actions/download-artifacts.

act's own test file here works but still uses v2 of both actions; specifying v4 or higher for actions/upload-artifacts results in the following output (same error as what I was seeing in my own workflow):

gh act --artifact-server-path /tmp/artifacts -W .github/workflows/artifacts.yaml
...
[Test that artifact uploads and downloads succeed/test-artifacts] ⭐ Run Main actions/upload-artifact@v4
[Test that artifact uploads and downloads succeed/test-artifacts]   🐳  docker cp src=/home/fevrin/.cache/act/actions-upload-artifact@v4/ dst=/var/run/act/actions/actions-upload-artifact@v4/
[Test that artifact uploads and downloads succeed/test-artifacts]   🐳  docker exec cmd=[node /var/run/act/actions/actions-upload-artifact@v4/dist/index.js] user= workdir=
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::followSymbolicLinks 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::implicitDescendants 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::followSymbolicLinks 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::implicitDescendants 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::matchDirectories 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::Search path '/home/fevrin/home/path/to/artifact/world.txt'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::File:/home/fevrin/home/path/to/artifact/world.txt was found using the provided searchPath
| With the provided path, there will be 1 file uploaded
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::Root artifact directory is /home/fevrin/home/path/to/artifact
| Artifact name is valid!
| Root directory input is valid!
[Test that artifact uploads and downloads succeed/test-artifacts]   ❗  ::error::Invalid token specified: Cannot read properties of undefined (reading 'replace')
[Test that artifact uploads and downloads succeed/test-artifacts]   ❌  Failure - Main actions/upload-artifact@v4
[Test that artifact uploads and downloads succeed/test-artifacts] exitcode '1': failure
[Test that artifact uploads and downloads succeed/test-artifacts] Cleaning up container for job test-artifacts
[Test that artifact uploads and downloads succeed/test-artifacts] 🏁  Job failed
Error: Job 'test-artifacts' failed

In my testing, I found that the latest releases of v3 for both actions seem to still work (v3.0.2 for download and v3.1.3 for upload), but per the changelog for those, it's clear that some changes will need to be made for act's support of v4 or higher:

The release of upload-artifact@v4 and download-artifact@v4 are major changes to the backend architecture of Artifacts. They have numerous performance and behavioral improvements.

ℹ️ However, this is a major update that includes breaking changes. Artifacts created with versions v3 and below are not compatible with the v4 actions. Uploads and downloads must use the same major actions versions. There are also key differences from previous versions that may require updates to your workflows.

https://github.com/actions/download-artifact/releases/tag/v4.0.0

I haven't looked into which changes would need to be made, but I just wanted to share this in case it's helpful for someone else in a similar spot.

<!-- gh-comment-id:1899914326 --> @fevrin commented on GitHub (Jan 19, 2024): After some trial-and-error-and-head-scratching when the recommended `--artifact-server-path /tmp/artifacts` argument didn't work for me, I found that this doesn't work specifically with v4 or higher of either `actions/upload-artifacts` or `actions/download-artifacts`. `act`'s own test file [here](https://github.com/nektos/act/blob/master/pkg/artifacts/testdata/upload-and-download/artifacts.yml) works but still uses v2 of both actions; specifying v4 or higher for `actions/upload-artifacts` results in the following output (same error as what I was seeing in my own workflow): ``` gh act --artifact-server-path /tmp/artifacts -W .github/workflows/artifacts.yaml ... [Test that artifact uploads and downloads succeed/test-artifacts] ⭐ Run Main actions/upload-artifact@v4 [Test that artifact uploads and downloads succeed/test-artifacts] 🐳 docker cp src=/home/fevrin/.cache/act/actions-upload-artifact@v4/ dst=/var/run/act/actions/actions-upload-artifact@v4/ [Test that artifact uploads and downloads succeed/test-artifacts] 🐳 docker exec cmd=[node /var/run/act/actions/actions-upload-artifact@v4/dist/index.js] user= workdir= [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::followSymbolicLinks 'true' [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::implicitDescendants 'true' [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::omitBrokenSymbolicLinks 'true' [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::followSymbolicLinks 'true' [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::implicitDescendants 'true' [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::matchDirectories 'true' [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::omitBrokenSymbolicLinks 'true' [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::Search path '/home/fevrin/home/path/to/artifact/world.txt' [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::File:/home/fevrin/home/path/to/artifact/world.txt was found using the provided searchPath | With the provided path, there will be 1 file uploaded [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::Root artifact directory is /home/fevrin/home/path/to/artifact | Artifact name is valid! | Root directory input is valid! [Test that artifact uploads and downloads succeed/test-artifacts] ❗ ::error::Invalid token specified: Cannot read properties of undefined (reading 'replace') [Test that artifact uploads and downloads succeed/test-artifacts] ❌ Failure - Main actions/upload-artifact@v4 [Test that artifact uploads and downloads succeed/test-artifacts] exitcode '1': failure [Test that artifact uploads and downloads succeed/test-artifacts] Cleaning up container for job test-artifacts [Test that artifact uploads and downloads succeed/test-artifacts] 🏁 Job failed Error: Job 'test-artifacts' failed ``` In my testing, I found that the latest releases of v3 for both actions seem to still work (v3.0.2 for `download` and v3.1.3 for `upload`), but per the changelog for those, it's clear that some changes will need to be made for `act`'s support of v4 or higher: > The release of upload-artifact@v4 and download-artifact@v4 are major changes to the backend architecture of Artifacts. They have numerous performance and behavioral improvements. > >ℹ️ However, this is a major update that includes breaking changes. Artifacts created with versions v3 and below are not compatible with the v4 actions. Uploads and downloads must use the same major actions versions. There are also key differences from previous versions that may require updates to your workflows. https://github.com/actions/download-artifact/releases/tag/v4.0.0 I haven't looked into which changes would need to be made, but I just wanted to share this in case it's helpful for someone else in a similar spot.
Author
Owner

@ChristopherHX commented on GitHub (Jan 19, 2024):

@fevrin Please have a look at https://github.com/nektos/act/issues/2135 regarding v4 development.

v4 is a complete rewrite, but simplifies the artifact management compared to v3 and earlier

<!-- gh-comment-id:1899924635 --> @ChristopherHX commented on GitHub (Jan 19, 2024): @fevrin Please have a look at https://github.com/nektos/act/issues/2135 regarding v4 development. v4 is a complete rewrite, but simplifies the artifact management compared to v3 and earlier
Author
Owner

@fevrin commented on GitHub (Jan 19, 2024):

@ChristopherHX nice, thanks for the pointer! I went ahead and subscribed to your issue 👍

I'll have to check into all those differences in v4 when I get a chance!

<!-- gh-comment-id:1899948254 --> @fevrin commented on GitHub (Jan 19, 2024): @ChristopherHX nice, thanks for the pointer! I went ahead and subscribed to your issue :+1: I'll have to check into all those differences in v4 when I get a chance!
Author
Owner

@VitusAcabado commented on GitHub (Jan 23, 2024):

I know this issue is closed but this is how I was able to run it using artifact-server mentioned by @davetapley :

docker pull ghcr.io/jefuller/artifact-server:latest
docker run -d --name artifact-server -p 8080:8080 --add-host host.docker.internal:host-gateway -e AUTH_KEY=foo ghcr.io/jefuller/artifact-server:latest
  • -d runs the container in detached mode; I prefer this so that the container runs in the background and I can continue using my terminal instance. You may omit this if you'd like.
  • --add-host host.docker.internal:host-gateway allows you to access the container via http://host.docker.internal on your local network

I then create a directory to store the artifact files on my local based on where I run the act command. For simplicity I made one called out

mkdir out

So when running act, these are my commands:

act --env ACTIONS_RUNTIME_URL=http://host.docker.internal:8080/ --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_CACHE_URL=http://host.docker.internal:8080/ --artifact-server-path out

Things to note:

  • value set for ACTIONS_RUNTIME_TOKEN == AUTH_KEY
  • value set for --artifact-server-path flag == the directory you created

For context I am running act on Docker Desktop and Ubuntu on WSL2. I wasn't able to use the built in Golang server that act has and it's probably due to docker networking on WSL2.

<!-- gh-comment-id:1905955589 --> @VitusAcabado commented on GitHub (Jan 23, 2024): I know this issue is closed but this is how I was able to run it using `artifact-server` mentioned by @davetapley : ```bash docker pull ghcr.io/jefuller/artifact-server:latest docker run -d --name artifact-server -p 8080:8080 --add-host host.docker.internal:host-gateway -e AUTH_KEY=foo ghcr.io/jefuller/artifact-server:latest ``` - `-d` runs the container in detached mode; I prefer this so that the container runs in the background and I can continue using my terminal instance. You may omit this if you'd like. - `--add-host host.docker.internal:host-gateway` allows you to access the container via `http://host.docker.internal` on your local network I then create a directory to store the artifact files on my local based on where I run the act command. For simplicity I made one called `out` ```bash mkdir out ``` So when running `act`, these are my commands: ```bash act --env ACTIONS_RUNTIME_URL=http://host.docker.internal:8080/ --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_CACHE_URL=http://host.docker.internal:8080/ --artifact-server-path out ``` Things to note: - value set for `ACTIONS_RUNTIME_TOKEN` == `AUTH_KEY` - value set for `--artifact-server-path` flag == the directory you created For context I am running `act` on Docker Desktop and Ubuntu on WSL2. I wasn't able to use the built in Golang server that `act` has and it's probably due to docker networking on WSL2.
Author
Owner

@Ngel-Castro commented on GitHub (Mar 25, 2024):

After some trial-and-error-and-head-scratching when the recommended --artifact-server-path /tmp/artifacts argument didn't work for me, I found that this doesn't work specifically with v4 or higher of either actions/upload-artifacts or actions/download-artifacts.

act's own test file here works but still uses v2 of both actions; specifying v4 or higher for actions/upload-artifacts results in the following output (same error as what I was seeing in my own workflow):

gh act --artifact-server-path /tmp/artifacts -W .github/workflows/artifacts.yaml
...
[Test that artifact uploads and downloads succeed/test-artifacts] ⭐ Run Main actions/upload-artifact@v4
[Test that artifact uploads and downloads succeed/test-artifacts]   🐳  docker cp src=/home/fevrin/.cache/act/actions-upload-artifact@v4/ dst=/var/run/act/actions/actions-upload-artifact@v4/
[Test that artifact uploads and downloads succeed/test-artifacts]   🐳  docker exec cmd=[node /var/run/act/actions/actions-upload-artifact@v4/dist/index.js] user= workdir=
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::followSymbolicLinks 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::implicitDescendants 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::followSymbolicLinks 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::implicitDescendants 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::matchDirectories 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::Search path '/home/fevrin/home/path/to/artifact/world.txt'
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::File:/home/fevrin/home/path/to/artifact/world.txt was found using the provided searchPath
| With the provided path, there will be 1 file uploaded
[Test that artifact uploads and downloads succeed/test-artifacts]   💬  ::debug::Root artifact directory is /home/fevrin/home/path/to/artifact
| Artifact name is valid!
| Root directory input is valid!
[Test that artifact uploads and downloads succeed/test-artifacts]   ❗  ::error::Invalid token specified: Cannot read properties of undefined (reading 'replace')
[Test that artifact uploads and downloads succeed/test-artifacts]   ❌  Failure - Main actions/upload-artifact@v4
[Test that artifact uploads and downloads succeed/test-artifacts] exitcode '1': failure
[Test that artifact uploads and downloads succeed/test-artifacts] Cleaning up container for job test-artifacts
[Test that artifact uploads and downloads succeed/test-artifacts] 🏁  Job failed
Error: Job 'test-artifacts' failed

In my testing, I found that the latest releases of v3 for both actions seem to still work (v3.0.2 for download and v3.1.3 for upload), but per the changelog for those, it's clear that some changes will need to be made for act's support of v4 or higher:

The release of upload-artifact@v4 and download-artifact@v4 are major changes to the backend architecture of Artifacts. They have numerous performance and behavioral improvements.
ℹ️ However, this is a major update that includes breaking changes. Artifacts created with versions v3 and below are not compatible with the v4 actions. Uploads and downloads must use the same major actions versions. There are also key differences from previous versions that may require updates to your workflows.

https://github.com/actions/download-artifact/releases/tag/v4.0.0

I haven't looked into which changes would need to be made, but I just wanted to share this in case it's helpful for someone else in a similar spot.

I was getting exact error and I was about to throw my computer out the window! downgrading the version from v4 to v3 did the magic!

<!-- gh-comment-id:2019032998 --> @Ngel-Castro commented on GitHub (Mar 25, 2024): > After some trial-and-error-and-head-scratching when the recommended `--artifact-server-path /tmp/artifacts` argument didn't work for me, I found that this doesn't work specifically with v4 or higher of either `actions/upload-artifacts` or `actions/download-artifacts`. > > `act`'s own test file [here](https://github.com/nektos/act/blob/master/pkg/artifacts/testdata/upload-and-download/artifacts.yml) works but still uses v2 of both actions; specifying v4 or higher for `actions/upload-artifacts` results in the following output (same error as what I was seeing in my own workflow): > > ``` > gh act --artifact-server-path /tmp/artifacts -W .github/workflows/artifacts.yaml > ... > [Test that artifact uploads and downloads succeed/test-artifacts] ⭐ Run Main actions/upload-artifact@v4 > [Test that artifact uploads and downloads succeed/test-artifacts] 🐳 docker cp src=/home/fevrin/.cache/act/actions-upload-artifact@v4/ dst=/var/run/act/actions/actions-upload-artifact@v4/ > [Test that artifact uploads and downloads succeed/test-artifacts] 🐳 docker exec cmd=[node /var/run/act/actions/actions-upload-artifact@v4/dist/index.js] user= workdir= > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::followSymbolicLinks 'true' > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::implicitDescendants 'true' > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::omitBrokenSymbolicLinks 'true' > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::followSymbolicLinks 'true' > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::implicitDescendants 'true' > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::matchDirectories 'true' > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::omitBrokenSymbolicLinks 'true' > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::Search path '/home/fevrin/home/path/to/artifact/world.txt' > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::File:/home/fevrin/home/path/to/artifact/world.txt was found using the provided searchPath > | With the provided path, there will be 1 file uploaded > [Test that artifact uploads and downloads succeed/test-artifacts] 💬 ::debug::Root artifact directory is /home/fevrin/home/path/to/artifact > | Artifact name is valid! > | Root directory input is valid! > [Test that artifact uploads and downloads succeed/test-artifacts] ❗ ::error::Invalid token specified: Cannot read properties of undefined (reading 'replace') > [Test that artifact uploads and downloads succeed/test-artifacts] ❌ Failure - Main actions/upload-artifact@v4 > [Test that artifact uploads and downloads succeed/test-artifacts] exitcode '1': failure > [Test that artifact uploads and downloads succeed/test-artifacts] Cleaning up container for job test-artifacts > [Test that artifact uploads and downloads succeed/test-artifacts] 🏁 Job failed > Error: Job 'test-artifacts' failed > ``` > > In my testing, I found that the latest releases of v3 for both actions seem to still work (v3.0.2 for `download` and v3.1.3 for `upload`), but per the changelog for those, it's clear that some changes will need to be made for `act`'s support of v4 or higher: > > > The release of upload-artifact@v4 and download-artifact@v4 are major changes to the backend architecture of Artifacts. They have numerous performance and behavioral improvements. > > ℹ️ However, this is a major update that includes breaking changes. Artifacts created with versions v3 and below are not compatible with the v4 actions. Uploads and downloads must use the same major actions versions. There are also key differences from previous versions that may require updates to your workflows. > > https://github.com/actions/download-artifact/releases/tag/v4.0.0 > > I haven't looked into which changes would need to be made, but I just wanted to share this in case it's helpful for someone else in a similar spot. I was getting exact error and I was about to throw my computer out the window! downgrading the version from v4 to v3 did the magic!
Author
Owner

@pbabinca commented on GitHub (Oct 10, 2024):

re:

[Test that artifact uploads and downloads succeed/test-artifacts] ::error::Invalid token specified: Cannot read properties of undefined (reading 'replace')

https://gitea.com/gitea/act_runner/issues/119 explains the issue with v4:

docker/build-push-action@v4 tries to parse the token as JWT and doesn't handle the error, so the job fails.

and it also suggests two solutions:

  1. Set the ACTIONS_RUNTIME_TOKEN to empty manually. This didn't work for me.
  2. Use master, since the bug has been fixed after v4 but there hasn't been an release since then. This worked for me.

Note: Gitea refers to docker/build-push-action. I'm not sure how actions/upload-artifact relates to that one.

<!-- gh-comment-id:2404698677 --> @pbabinca commented on GitHub (Oct 10, 2024): re: > [Test that artifact uploads and downloads succeed/test-artifacts] ❗ ::error::Invalid token specified: Cannot read properties of undefined (reading 'replace') https://gitea.com/gitea/act_runner/issues/119 explains the issue with v4: > docker/build-push-action@v4 tries to parse the token as JWT and doesn't handle the error, so the job fails. and it also suggests two solutions: 1. Set the ACTIONS_RUNTIME_TOKEN to empty manually. This didn't work for me. 2. Use `master`, since the bug has been fixed after v4 but there hasn't been an release since then. This worked for me. Note: Gitea refers to `docker/build-push-action`. I'm not sure how `actions/upload-artifact` relates to that one.
Author
Owner

@zatarain commented on GitHub (Oct 13, 2024):

Kudos for @VitusAcabado and @davetapley! Thank you so much 😊 I spent quite few hours with this issue before tried your approach.

The approach they mentioned about running a Docker 🐳 container 📦 with artifact server worked for me in Windows (using PowerShell even without my WSL2 environment).

I just renamed the host to artifacts.docker.internal and output folder ../artifacts because I use act in multiple repositories within the same folder and I didn't want to add another pattern to .gitignore file on each of those repositories.

Then I added following lines to my .actrc:

--env ACTIONS_RUNTIME_URL=http://artifacts.docker.internal:8080/
--env ACTIONS_RUNTIME_TOKEN=foo
--env ACTIONS_CACHE_URL=http://artifacts.docker.internal:8080/
--artifact-server-path ../artifacts

So, I ran the container as follow:

docker run \
  --name artifact-server \
  -d -p 8080:8080 \
  --add-host artifacts.docker.internal:host-gateway \
  -e AUTH_KEY=foo \
  ghcr.io/jefuller/artifact-server:latest

Just out of curiosity, is this issue closed because the actual problem is in actions/upload-artifact?

<!-- gh-comment-id:2408772918 --> @zatarain commented on GitHub (Oct 13, 2024): Kudos for @VitusAcabado and @davetapley! Thank you so much 😊 I spent quite few hours with this issue before tried your approach. The approach they mentioned about running a Docker 🐳 container 📦 with artifact server worked for me in Windows (using PowerShell even without my WSL2 environment). I just renamed the host to `artifacts.docker.internal` and output folder `../artifacts` because I use act in multiple repositories within the same folder and I didn't want to add another pattern to `.gitignore` file on each of those repositories. Then I added following lines to my `.actrc`: ``` --env ACTIONS_RUNTIME_URL=http://artifacts.docker.internal:8080/ --env ACTIONS_RUNTIME_TOKEN=foo --env ACTIONS_CACHE_URL=http://artifacts.docker.internal:8080/ --artifact-server-path ../artifacts ``` So, I ran the container as follow: ``` docker run \ --name artifact-server \ -d -p 8080:8080 \ --add-host artifacts.docker.internal:host-gateway \ -e AUTH_KEY=foo \ ghcr.io/jefuller/artifact-server:latest ``` Just out of curiosity, is this issue closed because the actual problem is in `actions/upload-artifact`?
Author
Owner

@youtux commented on GitHub (Oct 27, 2024):

hi, why is this issue closed? I'm still getting the error about the variable ACTIONS_RUNTIME_TOKEN not being present when trying to download an artifact:

| Downloading single artifact
[Main testing workflow/test-run     ]   ❗  ::error::Unable to download artifact(s): Unable to get the ACTIONS_RUNTIME_TOKEN env variable
[Main testing workflow/test-run     ]   ❌  Failure - Main Download artifact
[Main testing workflow/test-run     ] exitcode '1': failure

Is there a solution for this?

<!-- gh-comment-id:2440062014 --> @youtux commented on GitHub (Oct 27, 2024): hi, why is this issue closed? I'm still getting the error about the variable `ACTIONS_RUNTIME_TOKEN` not being present when trying to download an artifact: ``` | Downloading single artifact [Main testing workflow/test-run ] ❗ ::error::Unable to download artifact(s): Unable to get the ACTIONS_RUNTIME_TOKEN env variable [Main testing workflow/test-run ] ❌ Failure - Main Download artifact [Main testing workflow/test-run ] exitcode '1': failure ``` Is there a solution for this?
Author
Owner

@ChristopherHX commented on GitHub (Oct 27, 2024):

hi, why is this issue closed?

This feature exists if you tell act where to put the files, but we both probably agree why the hell is this disabled by default.

artifact v2-v3 fullsupport, v4 with known issues

See act --help
--artifact-server-path Defines the path where the artifact server stores uploads and retrieves downloads from. If not specified the artifact server will not start.

Depending on the setup of docker communication issues exists for m-series macs.

<!-- gh-comment-id:2440073849 --> @ChristopherHX commented on GitHub (Oct 27, 2024): > hi, why is this issue closed? This feature exists if you tell act where to put the files, but we both probably agree why the hell is this disabled by default. artifact v2-v3 fullsupport, v4 with known issues See `act --help` `--artifact-server-path` Defines the path where the artifact server stores uploads and retrieves downloads from. If not specified the artifact server will not start. Depending on the setup of docker communication issues exists for m-series macs.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#231
No description provided.