Gitea actions setup: Cannot resolve "gitea" in Checkout repository

I have a setup running gitea an the runner via docker-compose. Gitea runs smoothly and I now want to use Actions as well.

When executing the step “Checkout repository” I run into an error:

fatal: unable to access ‘http://gitea:3000/abc/abc/’: Could not resolve host: gitea

If I login into the runner docker container I can ping gitea just fine.

If I do ‘curl http://gitea:3000’ it works as well.

Thats how far I get. Strange … would appreciate ideas how to fix that.

I do not know what exacly happens. My assumption is, that the runner initiates a new docker container on the gly which is not connected to the network I created (called ‘gitea’). I hear, that sb changed the config.yaml - however I cannot access this as I am running on portainer (where docker-compose files are located all over the place …). Is there an option for the docker-compose file like

  CONTAINER_NETWORK: gitea

to make the newly created containers part of the network?

Or is there an option to link the ./config.yaml to a better place than alongside the docker-compose.yml?

Thank you, HC

Thats how I solved it for now. I would appreciate any improvements :slight_smile:

  1. Created an external volume and included it in the docker-compose file
  2. Added volume mapping to a new dir called config_data
  3. Set the environment variable CONFIG_FILE: /config_data/config.yaml
  4. Added a config.yaml in the directory
runner:
    environment:
      CONFIG_FILE: /config_data/config.yaml
    volumes:
      - gitea_runner:/config_data 

 volumes:
  gitea_runner:
    external: true
container:
  network: 'gitea'

I have the same problem. I don’t really understand your solution, how does that solve the issue of the url resolving?

I am running the following docker-compose:

networks:
  gitea:
    external: false

services:
  gitea:
    image: gitea/gitea:1.22.6
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
     - "8880:3000"
     - "2221:22"

  runner:
    image: gitea/act_runner:nightly
    environment:
      CONFIG_FILE: /config.yaml
      GITEA_INSTANCE_URL: "http://gitea:3000"
      GITEA_RUNNER_REGISTRATION_TOKEN: "my-token"
      GITEA_RUNNER_NAME: "runner"
    restart: always
    networks:
      - gitea
    volumes:
      - ./runner/config.yaml:/config.yaml
      - ./runner/data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - gitea

Then in my pipeline:

name: Windows CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest  # Host runs on Ubuntu, but will use a Windows container

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Build Executable with pyinstaller-windows
        uses: docker://cdrx/pyinstaller-windows:latest
        with:
          entrypoint: |
            sh -c "pyinstaller --onefile run.py"

      - name: Archive Executable
        run: |
          mkdir -p artifacts
          mv dist/your_script.exe artifacts/

      - name: Upload Artifact
        uses: actions/upload-artifact@v3
        with:
          name: windows-executable
          path: artifacts/run.exe

I am running this on a QNAP NAS.