chainguard-dev / rules_apko

Bazel rules for apko
https://apko.dev
Apache License 2.0
25 stars 16 forks source link

Included apko binary does not work #48

Open juanzolotoochin opened 9 months ago

juanzolotoochin commented 9 months ago

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}"
anguslees commented 6 months ago

!#!/usr/bin/env sh

Erm.. that's wrong.

sfc-gh-ptabor commented 6 months ago

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).