Skip to content

create a message format targeted at ci / build pipelines #14709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kurtbuilds opened this issue Oct 20, 2024 · 3 comments
Closed

create a message format targeted at ci / build pipelines #14709

kurtbuilds opened this issue Oct 20, 2024 · 3 comments
Labels
A-json-output Area: JSON message output C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-build S-triage Status: This issue is waiting on initial triage.

Comments

@kurtbuilds
Copy link

kurtbuilds commented Oct 20, 2024

Problem

Currently, it's surprisingly difficult to get the artifact built by cargo-build . (Prior discussion: #3757)

I have a custom build pipeline where it's helpful to both show human ANSI colored diagnostics (so if something goes wrong, I can see it easily in the logs), but also necessary to print the artifact path to stdout for the build pipeline to manage.

I built a very small wrapper tool (https://github.com/kurtbuilds/cargo_build_artifact) that runs cargo in json-diagnostic-rendered-ansi, and depending on the message that's output, sends diagnostics and errors to stderr, swallows other diagnostics, and emits a single line - the path of the built artifact - to stdout.

Curious if cargo team would support a PR to merge that functionality in under a new message-format - (maybe called human-with-build-artifacts to build on naming conventions already used?)

Proposed Solution

Create a new message-format (tentatively called human-with-build-artifacts) that outputs colored warnings and errors to stderr, and prints build artifact paths, one per line, to stdout.

@kurtbuilds kurtbuilds added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Oct 20, 2024
@epage epage added A-json-output Area: JSON message output Command-build labels Oct 21, 2024
@epage
Copy link
Contributor

epage commented Oct 21, 2024

For at least myself, this feels too specialized. This will work for you but there are slight variants that people might need to work with other use cases.

@weihanglo
Copy link
Member

I built a very small wrapper tool…

I am so happy that it actually works for people to customize their workflow!

Currently, it's surprisingly difficult to get the artifact built by cargo-build . (Prior discussion: #3757)

I would say a new message format is not an ideal solution to this. Possibly better solutions in my mind would be like a better build plan support, or a query interface for users to get metadata for a package.

@kurtbuilds
Copy link
Author

Ok!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-json-output Area: JSON message output C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-build S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants