Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dind-rootless-latest need git as dependency #57

Closed
imlonghao opened this issue Jun 3, 2024 · 5 comments · Fixed by #66
Closed

dind-rootless-latest need git as dependency #57

imlonghao opened this issue Jun 3, 2024 · 5 comments · Fixed by #66
Labels
help wanted Extra attention is needed

Comments

@imlonghao
Copy link
Contributor

Hello,

I'm using vegardit/gitea-act-runner:dind-rootless-latest and trying to build a docker image.

Runner config

version: "3.8"
services:
  runner:
    image: vegardit/gitea-act-runner:dind-rootless-latest
    privileged: true
    environment:
      GITEA_INSTANCE_URL: https://git.**REDACTED**
      GITEA_RUNNER_REGISTRATION_TOKEN: **REDACTED**
      GITEA_RUNNER_NAME: **REDACTED**
      GITEA_RUNNER_MAX_PARALLEL_JOBS: 2
      ACT_CACHE_SERVER_HOST: **REDACTED**
      ACT_CACHE_SERVER_PORT: 22380
    ports:
      - 22380:22380
    volumes:
      - ./data:/data

Gitea action config

name: Build Server

on:
  push:
    branches:
      - main

jobs:
  docker:
    runs-on: ubuntu-latest
    container:
      image: catthehacker/ubuntu:act-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Fix Docker Permission
        uses: https://github.com/imlonghao/gitea-runner-docker-permission-fix@main
      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          registry: git.**REDACTED**
          username: imlonghao
          password: **REDACTED**
      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: git.**REDACTED**-server
          tags: |
            type=sha
            type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}            
      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          file: Dockerfile.server

I got this error on the Build and push phase

[command]/usr/bin/docker buildx version
github.com/docker/buildx 0.12.0-1 542e5d810e4a1a155684f5f3c5bd7e797632a12f
::endgroup::
[command]/usr/bin/docker buildx build --file Dockerfile.server --iidfile /tmp/docker-actions-toolkit-E6zD2Y/iidfile --secret id=GIT_AUTH_TOKEN,src=/tmp/docker-actions-toolkit-E6zD2Y/tmp-149-vIMXPDX5m5Bl --tag git.**REDACTED**-server:latest --tag git.**REDACTED**-server:sha-5c1d154 --metadata-file /tmp/docker-actions-toolkit-E6zD2Y/metadata-file --push https://git.**REDACTED**/imlonghao/**REDACTED**.git#**REDACTED**35d02e1754
#0 building with "default" instance using docker driver
#1 [internal] load git source https://git.**REDACTED**.git#**REDACTED**135d02e1754
#1 ERROR: failed to init repo at /data/.local/share/docker/fuse-overlayfs/5xrld60bvz69ds96yah8z4d6z/diff: exec: "git": executable file not found in $PATH
------
 > [internal] load git source https://git.**REDACTED**.git#**REDACTED**135d02e1754:
------
ERROR: failed to solve: failed to read dockerfile: failed to init repo at /data/.local/share/docker/fuse-overlayfs/5xrld60bvz69ds96yah8z4d6z/diff: exec: "git": executable file not found in $PATH
::error::buildx failed with: ERROR: failed to solve: failed to read dockerfile: failed to init repo at /data/.local/share/docker/fuse-overlayfs/5xrld60bvz69ds96yah8z4d6z/diff: exec: "git": executable file not found in $PATH

Patching the image with this Dockerfile works for me

FROM vegardit/gitea-act-runner:dind-rootless-latest
RUN sudo apt update && sudo apt install -y --no-install-recommends git && sudo rm -rf /var/lib/apt/lists/*

I suggest we can add git to

apt-get install --no-install-recommends -y binutils ca-certificates curl sudo tini

@sebthom
Copy link
Member

sebthom commented Jun 3, 2024

Interesting, I don't really understand why this is necessary. To my understanding all commands incl. git should be executed within the catthehacker/ubuntu:act-22.04 container and not on the host.

@imlonghao
Copy link
Contributor Author

Yeah, it's a little weird behavior.
I have another action worker running in vegardit/gitea-act-runner:latest image, which works fine without the git installed.
So I sometimes just keep restarting the action job until it got assign to this runner.

Copy link

github-actions bot commented Sep 2, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If the issue is still valid, please add a respective comment to prevent this issue from being closed automatically. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 2, 2024
@imlonghao
Copy link
Contributor Author

still an issue

@sebthom sebthom added help wanted Extra attention is needed and removed stale labels Sep 2, 2024
@LyleUbbenGeneByGene
Copy link

LyleUbbenGeneByGene commented Oct 13, 2024

Having something similar happen on the dind image:

name: Build and push container
on: [push]

jobs:
  release-image:
      runs-on: ubuntu-latest
      steps:
        - name: Checkout
          uses: actions/checkout@v4
          with:
            fetch-depth: 0 # all history for all branches and tags

        - name: Log in to the Container registry
          uses: docker/login-action@v3
          with:
            registry: http://xxx
            username: root
            password: ${{ secrets.GITEAROOT }}
    
        - name: Build and push
          uses: docker/build-push-action@v6
          with:
            file: ./a/Dockerfile
            push: true
            tags: |
              xxx/root/b:1.0.0.${{ github.run_id }}
              xxx/root/b:latest

worked recently but now has a

ERROR: failed to solve: failed to read dockerfile: failed to init repo at /var/lib/docker/overlay2/kcd6252t1mjm4xik53ozs8d30/diff: git stderr:
: exec: "git": executable file not found in $PATH
::group::Reference
default/default/b7bazlswz6loj7fmds4iinjbj
::endgroup::
::group::Check build summary support
Build summary is not yet supported on GHES
::endgroup::
::error::buildx failed with: : exec: "git": executable file not found in $PATH

error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

Successfully merging a pull request may close this issue.

3 participants