heroku / libcnb.rs

A framework for writing Cloud Native Buildpacks in Rust
BSD 3-Clause "New" or "Revised" License
32 stars 6 forks source link

libcnb-cargo: Prevent stdout spam when not packaging for automation #600

Open edmorley opened 11 months ago

edmorley commented 11 months ago

After #575, the cargo libcnb package command now outputs the paths of all compiled buildpacks to stdout (with the rest of the output on stderr).

This is intended so that automation can fish out the buildpack names, and is used by eg: https://github.com/heroku/languages-github-actions

However, it gives a cluttered output for human users of cargo libcnb package, eg:

$ cargo libcnb package
🔍 Locating buildpacks...
📦 [1/1] Building heroku/python
Determining automatic cross-compile settings...
Building binaries (x86_64-unknown-linux-musl)...
    Finished dev [unoptimized] target(s) in 0.05s
Writing buildpack directory...
Successfully wrote buildpack directory: target/buildpack/x86_64-unknown-linux-musl/debug/heroku_python (7.66 MiB)
✨ Packaging successfully finished!

💡 To test your buildpack locally with pack, run:
pack build my-image-name \
  --buildpack /Users/emorley/src/buildpacks-python/target/buildpack/x86_64-unknown-linux-musl/debug/heroku_python \
  --path /path/to/application

/Users/emorley/src/buildpacks-python/target/buildpack/x86_64-unknown-linux-musl/debug/heroku_python

(ie: the very final line of the log output)

Perhaps we need a separate --machine-readable or some other output format control?

Malax commented 10 months ago

Minor: Ideally we'd use --message-format like Cargo itself does. Otherwise I think it's the right direction - you either need output for humans or machines - usually not both.