renovateforgejo

Use self-hosted Renovate with self-hosted Forgejo


I host current Forgejo version with the corresponding runner in Docker on Windows. Forgejo is exposed to Windows as localhost:3000. In Forgejo, the repository URL is http://localhost:3000/repo/repo.git. Now I want to test Renovate self-hosted with this repository, so I run a Forgejo job with this config:

jobs:
  renovate:
    runs-on: docker
    container:
      image: node:20
      options: --network forgejo_default
    steps:
      - name: Checkout
        uses: actions/checkout@v4.3.0

      - name: Install Renovate
        run: npm install -g renovate

      - name: Run Renovate
        env:
          LOG_LEVEL: debug
          RENOVATE_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
          RENOVATE_PLATFORM: gitea
          RENOVATE_ENDPOINT: http://host.docker.internal:3000/api/v1/
          RENOVATE_AUTODISCOVER: "true"
          RENOVATE_AUTODISCOVER_FILTER: "repo/*"
          RENOVATE_HOST_RULES: '[{"matchHost":"localhost","hostType":"gitea","url":"http://host.docker.internal:3000"}]'
        run: renovate

It does not matter what I try, it always fails because the local repository URL is localhost and it fails with:

DEBUG: Git function thrown (repository=org/repo)
       "err": {
         "task": {
           "commands": [
             "ls-remote",
             "--heads",
             "http://**redacted**@localhost:3000/repo/repo.git"
           ],
           "format": "utf-8",
           "parser": "[function]"
         },
         "message": "fatal: unable to access 'http://localhost:3000/repo/repo.git/': Failed to connect to localhost port 3000 after 0 ms: Couldn't connect to server\n"

Is there any way to make Renovate overwrite localhost to e.g. Forgejo or something that is accessible from within the renovate container?


Solution

  • Found the (obvious and simple answer) myself... I added an entry on local hosts file to point localhost to forgejo. Now it´s working!