-
Notifications
You must be signed in to change notification settings - Fork 314
Description
Summary
I ran into an issue where (due to a buildpack version difference) one buildpack was working and one wasn't. I figured out the problem eventually, but the core issue that made debugging harder than it had to be was that lifecycle currently shows the same output for empty args [] as it does for args that contain no characters [""].
$ pack inspect cutlass_image_basic_bash | grep -B2 web
Processes:
TYPE SHELL COMMAND ARGS
web (default) bash while true; do echo 'lol'; sleep 2; done
Note that there's nothing under the "args" section, and it collapses into the command.
Here's my original notes and investigation https://github.com/Malax/libcnb.rs/issues/49
Reproduction
Steps
Make a base buildpack:
cd /tmp
mkdir my_buildpack && cd my_buildpack
mkdir -p bin
cat > buildpack.toml <<EOM
api = "0.4"
[buildpack]
id = "ultra basic invoker"
version = "0.0.0"
name = "ultra basic invoker"
[[licenses]]
type = "MIT"
[[stacks]]
id = "heroku-20"
[metadata]
EOM
cat > bin/detect <<EOM
#!/usr/bin/env bash
exit 0
EOM
Write a build script with non-empty args
cat > bin/build <<EOM
#!/usr/bin/env bash
layers_dir=\$1
cat >> "\${layers_dir}/launch.toml" <<EOL
[[processes]]
type = "web"
command = "while true; do echo 'lol'; sleep 2; done"
args = [""] # Non-empty args
direct = false
EOL
EOM
chmod +x bin/build
chmod +x bin/detect
Build it:
pack build debug_pack_inspect_launch_args --path . -B heroku/buildpacks:20 --buildpack ./ -v
Produces:
$ pack inspect debug_pack_inspect_launch_args | grep -B2 web
Processes:
TYPE SHELL COMMAND ARGS
web (default) bash while true; do echo 'lol'; sleep 2; done
Modify to empty args in the launch:
cat > bin/build <<EOM
#!/usr/bin/env bash
layers_dir=\$1
cat >> "\${layers_dir}/launch.toml" <<EOL
[[processes]]
type = "web"
command = "while true; do echo 'lol'; sleep 2; done"
args = [] # EMPTY args
direct = false
EOL
EOM
Build it:
pack build debug_pack_inspect_launch_args --path . -B heroku/buildpacks:20 --buildpack ./ -v
Produces:
$ pack inspect debug_pack_inspect_launch_args | grep -B2 web
Processes:
TYPE SHELL COMMAND ARGS
web (default) bash while true; do echo 'lol'; sleep 2; done
So even though the image produced is not identical, the output of pack inspect is.
Current behavior
Pack inspect does shows identical output when there are no args versus when there are args with no characters.
Expected
I expected the two to produce an observable/inspectable difference in outputs because they are different (one executes, and the other does not).
I propose possibly adding arg count to the output such as:
Processes:
TYPE SHELL COMMAND ARGS (count = 0)
web (default) bash while true; do echo 'lol'; sleep 2; done
Or possibly showing non-visible args:
Processes:
TYPE SHELL COMMAND ARGS (count = 1)
web (default) bash while true; do echo 'lol'; sleep 2; done ""
Context
lifecycle version
Lifecycle:
Version: 0.11.4
platform version(s)
$ pack report
Pack:
Version: 0.20.0+git-66a4f32.build-2668
OS/Arch: darwin/amd64
Default Lifecycle Version: 0.11.3
Supported Platform APIs: 0.3, 0.4, 0.5, 0.6
Config:
(no config file found at /Users/rschneeman/.pack/config.toml)