chainguard-dev / apko

Build OCI images from APK packages directly without Dockerfile
https://apko.dev
Apache License 2.0
1.17k stars 115 forks source link

`bash: applet not found` error when running apko image in GitLab CI #602

Closed Histalek closed 1 year ago

Histalek commented 1 year ago

Since 075d98787c0886d2aa0bf40bce2a9f1835321b68 there is a /bin/bash symlink to busybox installed, but busybox does not have the bash applet:

busybox output /work # busybox BusyBox v1.36.0 (1970-01-01 00:00:00 UTC) multi-call binary. BusyBox is copyrighted by many authors between 1998-2015. Licensed under GPLv2. See source distribution for detailed copyright notices. Usage: busybox [function [arguments]...] or: busybox --list[-full] or: busybox --install [-s] [DIR] or: function [arguments]... BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as. Currently defined functions: [, [[, add-shell, addgroup, adduser, adjtimex, arch, arping, ash, awk, base64, basename, bbconfig, bc, beep, bunzip2, bzcat, bzip2, cal, cat, chattr, chgrp, chmod, chown, chpasswd, chroot, chrt, cksum, clear, cmp, comm, cp, cpio, cryptpw, cut, date, dc, dd, delgroup, deluser, df, diff, dirname, dmesg, dnsdomainname, dos2unix, du, echo, ed, egrep, env, expand, expr, factor, fallocate, false, fgrep, find, findfs, flock, fold, free, fsync, fuser, getopt, getty, grep, groups, gunzip, gzip, hd, head, hexdump, hostid, hostname, id, inotifyd, install, ionice, iostat, ipcrm, ipcs, kill, killall, killall5, less, link, linux32, linux64, ln, logger, login, ls, lsattr, lsof, lzcat, lzma, lzop, lzopcat, md5sum, microcom, mkdir, mkfifo, mknod, mkpasswd, mktemp, more, mountpoint, mpstat, mv, nc, netcat, netstat, nice, nl, nmeter, nohup, nologin, nproc, nsenter, od, passwd, paste, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap, printenv, printf, ps, pstree, pwd, pwdx, rdev, readahead, readlink, realpath, remove-shell, renice, reset, resize, rev, rm, rmdir, run-parts, sed, seq, setpriv, setserial, setsid, sh, sha1sum, sha256sum, sha3sum, sha512sum, shred, shuf, sleep, sort, split, stat, strings, stty, su, sum, sync, sysctl, tac, tail, tar, tee, test, time, timeout, top, touch, tr, traceroute, traceroute6, tree, true, truncate, tsort, tty, ttysize, tunctl, uname, unexpand, uniq, unix2dos, unlink, unlzma, unlzop, unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, watch, wc, wget, which, who, whoami, xargs, xxd, xzcat, yes, zcat

This leads to the bash: applet not found error breaking gitlab-ci pipelines at any script step.

I assume that without the /bin/bash symlink, gitlab-ci somehow understands that there is no bash and therefore falls back to /bin/sh. Which should be why this was working before this change.

PS: /bin/bash is duplicated here which also doesn't seem right

jsiebens commented 1 year ago

Hi,

I have the same issue when trying to use apko in a Gitlab CI pipeline. But the docker image published on GHCR works just fine.

E.g. when using the following snippet from a Gitlab CI pipeline file:

apko:cgr:
  image: 
    name: cgr.dev/chainguard/apko
    entrypoint: [""]    
  script:
    - apko version

apko:ghcr:
  image: 
    name: ghcr.io/chainguard-dev/apko:v0.8.0
    entrypoint: [""]    
  script:
    - apko version

The first job fails with bash: applet not found while the second runs successfully. (see https://gitlab.com/jsiebens/melange-apko-ci/-/pipelines/853505564)

PS: the same issue applies to melange as well.

Histalek commented 1 year ago

i cannot replicate this with cgr.dev/chainguard/apko:0.8.0 or cgr.dev/chainguard/melange:0.3.2 anymore. Which makes sense as the images don't contain a /bin/bash symlink anymore.

THX for fixing!