Comments (7)
@dzuelke exec 1>&2
works well for Bash, but we expect buildpacks to be written in other languages too. I'm so sure that redirection is as easy or reliable. Any solution would need to be 100% reliable because any cruft in stderr would result in invalid TOML, and fail a build.
from spec.
In addition, we've seen with the previous generation of buildpacks, that many authors and others who interacted with buildpacks considered the use of stdout for conveying information problematic in practice. We've seen requests to move further away from using stdout, rather than closer, so we now have input in both directions.
from spec.
@jkutner but surely if you write a buildpack in another language, you wouldn't just puts
or whatever text, but run it through some kind of minimalist I/O wrapper, in order for things to be properly testable etc, right?
@nebhale I'm not sure I follow. I'm saying that stdout shouldn't be used for informational output, but stderr, which is standard Unix practice, and which is what almost all programs do. It's the reason you can do curl foo | bar
: data (in the case of bin/build
that'd be the TOML output) goes to stdout, and status/info/error/debug messaging (such as curl
's progress bar) to stderr.
from spec.
Sorry, I was sloppy with my terminology. What I mean to say is:
In addition, we've seen with the previous generation of buildpacks, that many authors and others who interacted with buildpacks considered the use of stdin/stdout for conveying programmatic input/output problematic in practice. We've seen requests to move further away from using stdin/stdout for programmatic input/output, rather than closer, so we now have design requests in both directions.
from spec.
Appreciate the feedback @dzuelke! Definitely want to make sure these interfaces are reasonable.
I'm saying that stdout shouldn't be used for informational output, but stderr, which is standard Unix practice, and which is what almost all programs do. It's the reason you can do curl foo | bar: data (in the case of bin/build that'd be the TOML output) goes to stdout, and status/info/error/debug messaging (such as curl's progress bar) to stderr.
I definitely agree with this practice for command line utilities on UNIX systems. That said, I'm not convinced that we should do this for /bin/build
.
Here are some disadvantages I can think of:
- The primary responsibility of
/bin/build
is to execute other CLI utilities. Preserving the separation of stdout and stderr from these utilities seems desirable on cloud platforms, where logs sent to stderr are sometimes formatted differently (e.g., bold or red) compared to logs sent to stdout. In practice, many language tools (e.g.,npm
,gem
) send logs to both stdout and stderr so they can split informational logs from diagnostic logs. Shouldn't we preserve that split? - The entire output of
/bin/build
cannot be sent to stdout, just the buildpack metadata. Sending just the contents oflaunch.toml
to stdout would split the output between stdout and disk (launch + cache layers). This seems less elegant to me than having just the launch and cache directories be the output. - We would prevent buildpack authors from using libraries that are hardcoded to output to stdout or output to stdout by accident. Such libraries could even silently corrupt the metadata. (Note: This can be completely avoided for languages that let you make the
dup2
syscall on Linux directly, like C or Go.) - We would make writing a buildpack in a less common language difficult for users who are not familiar with output redirection.
Do those reasons make sense to you? What benefits do you see for sending the metadata to stdout?
from spec.
I guess :) Thanks folks! It was just a minor nitpick really.
from spec.
@dzuelke #24 makes the build/detect interfaces match, so at least they are consistent 😄
from spec.
Related Issues (20)
- How to mount my own maven setting.xml HOT 2
- [RFC #0105] Buildpack API changes for run image extension (Dockerfiles phase 3) HOT 1
- SBOM- Cosign spec HOT 5
- Is it possible for an inline buildpack to add [[requires]] and [requires.metadata] to the build plan? HOT 1
- SBOM score HOT 2
- Regarding ENTRYPOINT Launcher HOT 4
- Lifecycle specification HOT 3
- [RFC #0111] Support insecure registries HOT 1
- Build Image ABI Compatibility
- Making builpack image extensions feature non-experimental HOT 14
- [RFC 0125] Lifecycle parallel export HOT 1
- Launcher CNB_PLATFORM_API failed to get platform API version HOT 6
- Support buildpack.toml targets for Buildpack API 0.10 HOT 1
- Platform Spec is ambiguous about usage of `extender` HOT 10
- Support run image rebase based on semver tags HOT 6
- Remove or clarify `io.buildpacks.base.id` (it's currently unused)
- Specification for `CNB_STACK_ID` changed when it was deprecated in Platform API 0.12 HOT 1
- Add a way for Buildpacks to enable verbose output HOT 5
- Buildpack API inconsistency around naming/data-type of `targets.distros.version` field in `buildpack.toml`
- Add more data to report.toml
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spec.