usimd / pi-gen-action

Action to build Raspberry Pi images using official pi-gen tool
MIT License
44 stars 9 forks source link

git not found #95

Closed builderjer closed 10 months ago

builderjer commented 10 months ago

Not sure if this goes here or in the actual pi-gen repo, but I will start here.

Describe the bug While building an image, it abruptly stops and says that git is not installed on this system.

To Reproduce Steps to reproduce the behavior: Work flow file

name: Build raspOVOS-headless
on:
  workflow_dispatch:

jobs:
  pi-gen-ovos:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
      - uses: usimd/pi-gen-action@v1
        id: build
        with:
          # Final image name.
          image-name: raspOVOS-headless-dev

          # List of stage name to execute in given order. Relative and absolute paths to
          # custom stage directories are allowed here. Note that by default pi-gen exports
          # images in stage2 (lite), stage4 and stage5. You probably want to hook in custom
          # stages before one of the exported stages. Otherwise, the action will make sure
          # any custom stage will include an image export directive.
          stage-list: stage0 stage1 stage2 ./stage-prep ./stage-splash ./stage-core ./stage-hivemind ./stage-skills ./stage-audio ./stage-speech ./stage-listener ./stage-ggwave ./stage-phal ./stage-finalize

          # Host name of the image.
          hostname: raspOvos

          # Default keyboard keymap.
          keyboard-keymap: us

          # Default keyboard layout.
          keyboard-layout: English (US)

          # Default locale of the system image.
          locale: en_US.UTF-8

          # Default wifi country
          wpa-country: US

          # Default timezone
          timezone: America/Denver

          # Name of the initial user account.
          username: ovos

          # Password of the intial user account, locked if empty.
          password: 'ovos'

          # Compression to apply on final image (either "none", "zip", "xz" or "gz").
          compression: zip

          # Compression level to be used. From 0 to 9 (refer to the tool man page for more
          # information on this. Usually 0 is no compression but very fast, up to 9 with the
          # best compression but very slow).
          compression-level: 6

          # Disable the renaming of the first user during the first boot. This make it so
          # 'username' stays activated. 'username' must be set for this to work. Please be
          # aware of the implied security risk of defining a default username and password
          # for your devices.
          disable-first-boot-user-rename: 1

          # Additional options to include in PIGEN_DOCKER_OPTS
          docker-opts: 'ARCHIVE_FILENAME="raspOVOS-headless-dev"'

          # Set whether a NOOBS image should be built as well. If enabled, the output
          # directory containing the NOOBS files will be saved as output variable
          # 'image-noobs-path'.
          enable-noobs: false

          # Enable SSH access to Pi.
          enable-ssh: 1

          # If this feature is enabled, the action will configure pi-gen to not export any
          # stage as image but the last one defined in property 'stage-list'. This is
          # helpful when building a single image flavor (in contrast to building a
          # lite/server and full-blown desktop image), since it speeds up the build process
          # significantly.
          export-last-stage-only: true

          # Comma or whitespace separated list of additional packages to install on host
          # before running pi-gen. Use this list to add any packages your custom stages may
          # require. Note that this is not affecting the final image. In order to add
          # additional packages, you need to add a respective 'XX-packages' file in your
          # custom stage.
          extra-host-dependencies: ''

          # Comma or whitespace separated list of additional modules to load on host before
          # running pi-gen. If your custom stage requires additional software or kernel
          # modules to be loaded, add them here. Note that this is not meant to configure
          # modules to be loaded in the target image.
          extra-host-modules: ''

          # Token to use for checking out pi-gen repo.
          github-token: ${{ github.token }}

          # Path where selected pi-gen ref will be checked out to. If the path does not yet
          # exist, it will be created (including its parents).
          pi-gen-dir: pi-gen

          # GitHub repository to fetch pi-gen from, must be a fork from RPi-Distro/pi-gen.

          pi-gen-repository: RPi-Distro/pi-gen

          # Release version of pi-gen to use. This can both be a branch or tag name known in
          # the pi-gen repository.
          pi-gen-version: arm64

          # The release version to build images against. Valid values are jessie, stretch,
          # buster, bullseye, and testing.
          release: bookworm

          # Setting to `1` will prevent pi-gen from dropping the "capabilities" feature.
          # Generating the root filesystem with capabilities enabled and running it from a
          # filesystem that does not support capabilities (like NFS) can cause issues. Only
          # enable this if you understand what it is.
          setfcap: ''

          # Use qcow2 images to reduce space and runtime requirements.
          use-qcow2: 1

          # Print all output from pi-gen.
          verbose-output: true

      - name: copy file via ssh password
        uses: appleboy/scp-action@master
        with:
          host: ovosimages.ziggyai.online
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          port: ${{ secrets.SSH_PORT }}
          source: "${{ steps.build.outputs.image-path }}"
          target: "raspbian/development"
          strip_components: 4

Expected behavior finish the build

Logs

  Warning: #9 writing image sha256:58779c163a82aca0867c81f3ad89dae9f4a29c40fe38e2429c3edcde803f6a14 done
  Warning: #9 naming to docker.io/library/pi-gen done
  Warning: #9 DONE 2.6s
  Warning: WARNING: buildx: git was not found in the system. Current commit information was not captured by the build
  Registering qemu-aarch64 for binfmt_misc...
  Warning: docker: invalid reference format: repository name must be lowercase.
  Warning: See 'docker run --help'.
  Warning: real 0m0.011s
  Warning: user 0m0.007s
  Warning: sys  0m0.007s
Error: pi-gen build failed with exit code 125
#9 naming to docker.io/library/pi-gen done
#9 DONE 2.6s
WARNING: buildx: git was not found in the system. Current commit information was not captured by the build
docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.
usimd commented 10 months ago

Just ran a manual integration test on latest master against current pi-gen and it passed the point you're referring to.

It's very likely you are running into an issue with your image name, see for instance https://stackoverflow.com/questions/48522615/docker-error-invalid-reference-format-repository-name-must-be-lowercase.

First assumption is that image-name actually must be in lower case. If that's the issue, we could add a respective check in the action's preparation steps.

builderjer commented 10 months ago

So I changed these lines in my config file

     - uses: usimd/pi-gen-action@master
        id: build
        with:
          # Final image name.
          image-name: rasp-ovos-headless-dev

And I still get the same error

I also tried with

    - uses: usimid/pi-gen-action@v1

and the same error

usimd commented 10 months ago

Ah, I see. You have an error in docker-opts, as you're not respecting Docker's CLI convention. docker-opts being translated as PIGEN_DOCKER_OPTS is appended to the Docker run call (or, well, actually it's being put somewhere in the middle: https://github.com/RPi-Distro/pi-gen/blob/master/build-docker.sh#L150). Since you're not passing your env as -e NAME=value, Docker considers this to be the image name.

I see you want to explicitly name the output image file. Still don't get why you're not simply adding a rename step after the pi-gen build. That way you wouldn't have stumbled over this.

builderjer commented 10 months ago

I forgot that I changed this here. I do actually rename this with pi-gen directly. Thankyou for your help and patience. Removing the docker-opts fixes this issue.