bug: cache action is not working with IPv6 only forgejo runners #733

Closed
opened 2025-07-25 13:58:54 +00:00 by margau · 6 comments

Can you reproduce the bug on the Forgejo test instance?

No response

Description

When using the forgejo actions cache with IPv6 only runners (using docker in kubernetes), the cache restore returns getaddrinfo ENOTFOUND [2001:678:d50:4005::6adf], probably because it is interpreting the IPv6 address of the ACTION_CACHE_URL as hostname.

If i call ACTION_CACHE_URL using curl, it is accessible over http.

Issue was opened in actions/cache#2 initially.

Example run: https://codeberg.org/margau/forgejo-actions-cache-test/actions/runs/5
Example Repo: https://codeberg.org/margau/forgejo-actions-cache-test/
Runner Setup: https://margau.net/posts/2025-06-29-forgejo-runner-ipv6-kubernetes/

Forgejo Version

No response

Runner Version

v7.0.0

How are you running Forgejo?

Codeberg Instance

How are you running the Runner?

Helm Chart https://codeberg.org/wrenix/helm-charts/src/branch/main/forgejo-runner extended with IPv6 only docker configuration in an IPv6 only k8s cluster

Logs

No response

Workflow file

name: renovate

on:
  push:
  schedule:
    - cron: '42 * * * *'

jobs:
  forgejo:
    runs-on: docker
    container:
      image: codeberg.org/margau/buildenv-debian_base
    steps:
      - uses: https://code.forgejo.org/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
      - name: Restore renovate cache
        uses: https://code.forgejo.org/actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4
        with:
          path: |
            test.txt
          key: cache-test
      - run: apt-get update && apt-get install -y iproute2 curl
      - run: ip a
      - run: env
      - run: curl -v -L ${{ env.ACTIONS_CACHE_URL }} > /dev/null
      - run: ls -la
      - run: touch test.txt
      - name: Save renovate cache
        uses: https://code.forgejo.org/actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4
        with:
          path: |
            test.txt
          key: cache-test
### Can you reproduce the bug on the Forgejo test instance? _No response_ ### Description When using the forgejo actions cache with IPv6 only runners (using docker in kubernetes), the cache restore returns `getaddrinfo ENOTFOUND [2001:678:d50:4005::6adf]`, probably because it is interpreting the IPv6 address of the ACTION_CACHE_URL as hostname. If i call ACTION_CACHE_URL using curl, it is accessible over http. Issue was opened in https://code.forgejo.org/actions/cache/issues/2 initially. Example run: https://codeberg.org/margau/forgejo-actions-cache-test/actions/runs/5 Example Repo: https://codeberg.org/margau/forgejo-actions-cache-test/ Runner Setup: https://margau.net/posts/2025-06-29-forgejo-runner-ipv6-kubernetes/ ### Forgejo Version _No response_ ### Runner Version v7.0.0 ### How are you running Forgejo? Codeberg Instance ### How are you running the Runner? Helm Chart https://codeberg.org/wrenix/helm-charts/src/branch/main/forgejo-runner extended with IPv6 only docker configuration in an IPv6 only k8s cluster ### Logs _No response_ ### Workflow file ```yaml name: renovate on: push: schedule: - cron: '42 * * * *' jobs: forgejo: runs-on: docker container: image: codeberg.org/margau/buildenv-debian_base steps: - uses: https://code.forgejo.org/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Restore renovate cache uses: https://code.forgejo.org/actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4 with: path: | test.txt key: cache-test - run: apt-get update && apt-get install -y iproute2 curl - run: ip a - run: env - run: curl -v -L ${{ env.ACTIONS_CACHE_URL }} > /dev/null - run: ls -la - run: touch test.txt - name: Save renovate cache uses: https://code.forgejo.org/actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4 with: path: | test.txt key: cache-test ```
Contributor

@Kwonunn does that ring a bell? I figure it might be a problem with how the proxy cache URL is constructed but I did not look into it.

@Kwonunn does that ring a bell? I figure it might be a problem with how the proxy cache URL is constructed but I did not look into it.
Contributor

@Kwonunn gently ping

@Kwonunn gently ping
Author

Today, I looked a bit trough the code.

Theoretically, it should be handled correctly, if the "host"-field is an IPv6 address..

Node HTTP Lib: github.com/nodejs/node@a73b575304/lib/_http_agent.js (L419)

Actions HTTP Client Setting the host option: github.com/actions/toolkit@227b1ce741/packages/http-client/src/index.ts (L593)

However, I can reproduce it locally very simple:

const http = require('http');

console.log(http.request({'host':'[::1]'}))

returns

Error: getaddrinfo ENOTFOUND [::1]
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:122:26)
Emitted 'error' event on ClientRequest instance at:
    at emitErrorEvent (node:_http_client:106:11)
    at Socket.socketErrorListener (node:_http_client:574:5)
    at Socket.emit (node:events:507:28)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: '[::1]'
}

Node.js v24.5.0

Unfortunately, my nodejs experience is not that great, but I'd guess the issue is more likely on the node or actions-http-client side, and not in the forgejo runner.

Today, I looked a bit trough the code. Theoretically, it should be handled correctly, if the "host"-field is an IPv6 address.. Node HTTP Lib: https://github.com/nodejs/node/blob/a73b575304722a3682fbec3a5fb13b39c5791342/lib/_http_agent.js#L419 Actions HTTP Client Setting the host option: https://github.com/actions/toolkit/blob/227b1ce741a925ae9f5fdef91fd10415f2d0ca45/packages/http-client/src/index.ts#L593 However, I can reproduce it locally very simple: ``` const http = require('http'); console.log(http.request({'host':'[::1]'})) ``` returns ``` Error: getaddrinfo ENOTFOUND [::1] at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:122:26) Emitted 'error' event on ClientRequest instance at: at emitErrorEvent (node:_http_client:106:11) at Socket.socketErrorListener (node:_http_client:574:5) at Socket.emit (node:events:507:28) at emitErrorNT (node:internal/streams/destroy:170:8) at emitErrorCloseNT (node:internal/streams/destroy:129:3) at process.processTicksAndRejections (node:internal/process/task_queues:90:21) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: '[::1]' } Node.js v24.5.0 ``` Unfortunately, my nodejs experience is not that great, but I'd guess the issue is more likely on the node or actions-http-client side, and not in the forgejo runner.
Contributor

Since it is apparently an issue with https://github.com/actions/cache and the underlying JavaScript module. Could you file an issue there? It is quite possible that this action was never used in an IPv6 only environment and this was overlooked. I advise to only marginally reference Forgejo so that your issue is not dismissed right away as "not supported environment" 😁

Since it is apparently an issue with https://github.com/actions/cache and the underlying JavaScript module. Could you file an issue there? It is quite possible that this action was never used in an IPv6 only environment and this was overlooked. I advise to only marginally reference Forgejo so that your issue is not dismissed right away as "not supported environment" 😁
Contributor
https://margau.net/posts/2025-06-29-forgejo-runner-ipv6-kubernetes/ is a good read, kudos.
earl-warren changed title from bug: cache not working with IPv6 only forgejo runners to bug: cache action is not working with IPv6 only forgejo runners 2025-09-17 07:53:13 +00:00
Contributor

Since this is an issue with https://github.com/actions/cache, I'm closing this.

@margau if you think something needs to be done Forgejo side, please re-open and explain what you have in mind 🙏

Since this is an issue with https://github.com/actions/cache, I'm closing this. @margau if you think something needs to be done Forgejo side, please re-open and explain what you have in mind 🙏
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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
forgejo/runner#733
No description provided.