rules_apko icon indicating copy to clipboard operation
rules_apko copied to clipboard

Included apko binary does not work

Open juanzolotoochin opened this issue 1 year ago • 3 comments

I'm trying to get started with rules_apko and I'm failing to produce the apko.lock.json file. I have this, which I've copied from the examples:


contents:
  keyring:
    - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub
  repositories:
    - https://packages.wolfi.dev/os
  packages:
    - wolfi-base

entrypoint:
  command: /bin/sh

archs:
  - aarch64
  - x86_64

Then to generate the lock file I run:

$ bazel run @rules_apko//apko lock ./bazel/apko/base_images/wolfi/apko.yaml

Workdir: /home/juan-munoz/gg/repo
/home/juan-munoz/.cache/bazel/_bazel_juan-munoz/5e2ab9bef16b62dfdad15ea9f3634c69/execroot/repo/bazel-out/k8-fastbuild/bin/external/rules_apko/apko/_apko_run.sh: 11: Bad substitution

IDK what I may be doing wrong. I can work around this by running:

bazel run @apko_linux_amd64//:apko -- lock $PWD/bazel/apko/base_images/wolfi/apko.yaml

I suspect there's something wrong with the shell wrapper:


#!#!/usr/bin/env sh

set -e
LAUNCHER_DIR="${PWD}"
if test "${BUILD_WORKING_DIRECTORY+x}"; then
  cd $BUILD_WORKING_DIRECTORY
fi

echo "Workdir: ${PWD}" >&2
${LAUNCHER_DIR}/external/apko_linux_amd64/apko "${@:1}"

juanzolotoochin avatar Feb 20 '24 17:02 juanzolotoochin

#!#!/usr/bin/env sh

Erm.. that's wrong.

anguslees avatar Apr 29 '24 05:04 anguslees

Looking at: https://github.com/chainguard-dev/rules_apko/blame/main/apko/private/apko_run.bzl#L29 I assume it's fixed.

Shebangs #!#! should be fixed as well (but it should cause the functional problems afaiu).

sfc-gh-ptabor avatar May 16 '24 17:05 sfc-gh-ptabor

Related: https://github.com/chainguard-dev/rules_apko/issues/65

Still happening on latest release for me.

jtszalay avatar Apr 08 '25 20:04 jtszalay