From ad2e13f924fda5a39c4dc1c41debce99a2b1fe2d Mon Sep 17 00:00:00 2001 From: Bu5hm4nn Date: Sat, 21 Mar 2026 23:35:07 +0100 Subject: [PATCH] Add --add-host to resolve forgejo hostname in job containers The job containers cannot resolve 'forgejo' Docker hostname. Added 'options: --add-host=forgejo:10.100.0.2' to all container blocks. This adds an entry to /etc/hosts mapping forgejo to the reachable IP. --- .forgejo/workflows/ci.yaml | 9 +++------ .forgejo/workflows/deploy.yaml | 15 +++++---------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 835ca49..9447479 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -15,8 +15,7 @@ jobs: runs-on: docker container: image: catthehacker/ubuntu:act-latest - env: - GITHUB_SERVER_URL: ${{ vars.FORGEJO_URL || 'http://10.100.0.2:3000' }} + options: --add-host=forgejo:10.100.0.2 steps: - uses: actions/checkout@v4 - name: Set up Python @@ -36,8 +35,7 @@ jobs: runs-on: docker container: image: catthehacker/ubuntu:act-latest - env: - GITHUB_SERVER_URL: ${{ vars.FORGEJO_URL || 'http://10.100.0.2:3000' }} + options: --add-host=forgejo:10.100.0.2 steps: - uses: actions/checkout@v4 - name: Set up Python @@ -55,8 +53,7 @@ jobs: runs-on: docker container: image: catthehacker/ubuntu:act-latest - env: - GITHUB_SERVER_URL: ${{ vars.FORGEJO_URL || 'http://10.100.0.2:3000' }} + options: --add-host=forgejo:10.100.0.2 steps: - uses: actions/checkout@v4 - name: Set up Python diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml index 8a69b0e..451f9de 100644 --- a/.forgejo/workflows/deploy.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -8,15 +8,13 @@ on: env: REGISTRY: ${{ vars.REGISTRY || '10.100.0.2:3000' }} IMAGE_NAME: ${{ github.repository }} - FORGEJO_URL: ${{ vars.FORGEJO_URL || 'http://10.100.0.2:3000' }} jobs: lint: runs-on: docker container: image: catthehacker/ubuntu:act-latest - env: - GITHUB_SERVER_URL: ${{ env.FORGEJO_URL }} + options: --add-host=forgejo:10.100.0.2 steps: - uses: actions/checkout@v4 - name: Set up Python @@ -36,8 +34,7 @@ jobs: runs-on: docker container: image: catthehacker/ubuntu:act-latest - env: - GITHUB_SERVER_URL: ${{ env.FORGEJO_URL }} + options: --add-host=forgejo:10.100.0.2 steps: - uses: actions/checkout@v4 - name: Set up Python @@ -55,8 +52,7 @@ jobs: runs-on: docker container: image: catthehacker/ubuntu:act-latest - env: - GITHUB_SERVER_URL: ${{ env.FORGEJO_URL }} + options: --add-host=forgejo:10.100.0.2 steps: - uses: actions/checkout@v4 - name: Set up Python @@ -76,8 +72,7 @@ jobs: needs: [lint, test, type-check] container: image: catthehacker/ubuntu:act-latest - env: - GITHUB_SERVER_URL: ${{ env.FORGEJO_URL }} + options: --add-host=forgejo:10.100.0.2 steps: - uses: actions/checkout@v4 @@ -107,8 +102,8 @@ jobs: if: github.ref == 'refs/heads/main' container: image: catthehacker/ubuntu:act-latest + options: --add-host=forgejo:10.100.0.2 env: - GITHUB_SERVER_URL: ${{ env.FORGEJO_URL }} DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} DEPLOY_USER: ${{ secrets.DEPLOY_USER || 'deploy' }} DEPLOY_PORT: ${{ secrets.DEPLOY_PORT || '22' }}