chainguard-dev / melange

build APKs from source code
Apache License 2.0
412 stars 95 forks source link

`--interactive` history population can cause failures / inability to use. #1327

Closed smoser closed 3 months ago

smoser commented 3 months ago

this is causing issues for me. :cry:

$ git remote -v | grep upstream
upstream        git@github.com:wolfi-dev/os (fetch)
upstream        git@github.com:wolfi-dev/os (push)

$ git checkout upstream/version-stream-envoy-1.30 
HEAD is now at 9669f2aac Merge branch 'main' into version-stream-envoy-1.30

$ make debug/envoy-1.30
...
2024/06/26 15:58:52 INFO
2024/06/26 15:58:52 WARN Target //source/exe:envoy-static failed to build
2024/06/26 15:58:52 WARN INFO: Elapsed time: 136.994s, Critical Path: 97.87s
2024/06/26 15:58:52 WARN INFO: 4559 processes: 2581 internal, 1976 linux-sandbox, 1 local, 1 worker.
2024/06/26 15:58:52 WARN FAILED: Build did NOT complete successfully
2024/06/26 15:58:52 WARN
2024/06/26 15:58:52 ERRO Step failed: exit status 1
/bin/sh -c set -e
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
export HISTFILE='~/.ash_history'
[ -d '/home/build' ] || mkdir -p '/home/build'
cd '/home/build'
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
mkdir -p .cache/bazel/_bazel_root

cd envoy
# The Python interpreter complains about being run as root, there's a flag to pass to disable that warning.
sed -i 's/envoy_dependencies_extra()/envoy_dependencies_extra(ignore_root_user_error=True)/g' WORKSPACE

./bazel/setup_clang.sh /usr
echo "build --config=libc++" >> user.bazelrc

bazel build --verbose_failures -c opt envoy

mkdir -p /home/build/melange-out/envoy-1.30/usr/bin/
mv bazel-bin/source/exe/envoy-static /home/build/melange-out/envoy-1.30/usr/bin/envoy

# We no longer need this cache dir, which has some writable files.
rm -rf ../.cache/bazel/_bazel_root

exit 0
2024/06/26 15:58:52 INFO Execing into pod "" to debug interactively. workdir=/home/build
2024/06/26 15:58:52 INFO Type 'exit 0' to continue the next pipeline step or 'exit 1' to abort.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
mkdir -p .cache/bazel/_bazel_root

cd envoy
# The Python interpreter complains about being run as root, theres a flag to pass to disable that warning.
sed: WORKSPACE: No such file or directory
/bin/sh: ./bazel/setup_clang.sh: not found
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
FATAL: Could not find system javabase. Ensure JAVA_HOME is set, or javac is on your PATH.
mv: cannot stat 'bazel-bin/source/exe/envoy-static': No such file or directory
/bin/sh: syntax error: unterminated quoted string
2024/06/26 15:58:52 ERRO ERROR: failed to build package. the build environment has been preserved:
2024/06/26 15:58:52 INFO   workspace dir: /home/user/tmp/melange-workspace-2325475361
2024/06/26 15:58:52 INFO   guest dir: /home/user/tmp/melange-guest-718052061
2024/06/26 15:58:52 INFO error during command execution: failed to build package: unable to run package envoy-1.30 pipeline: unable to run pipeline: failed to debug: exit status 2; original error: exit status 1
make: *** [Makefile:121: debug/envoy-1.30] Error 1

Originally posted by @smoser in https://github.com/chainguard-dev/melange/issues/1289#issuecomment-2192083178

jonjohnsonjr commented 3 months ago

Fixed by https://github.com/chainguard-dev/melange/pull/1328