Repository navigation
Conversation
|
Set the environment variables and updated the message. |
|
|
||
| gh pr comment ${HEAD_PR} -F output.log | ||
| else | ||
| echo "Nothing was published. Either there is no version update or some error has occurred." |
There was a problem hiding this comment.
If errors occur, the CI workflow is green. Will anyone notice and fix the issue?
My preference would be to catch these errors and fail the workflow, but I leave the choice to the author and the reviewer of this PR the final saying. 👍
There was a problem hiding this comment.
Perhaps it's worth doing cargo publish --dry-run as part of PR CI? That probably catches the most likely failures, other than transients.
There was a problem hiding this comment.
Does that do something more interesting other than just building the crate (which we should do as a part of our normal CI)?
There was a problem hiding this comment.
Don't quote me on this but I believe it packages a .crate and attempts to build from that, which catches things like incorrect include/exclude in the manifest
There was a problem hiding this comment.
Should we comment on the PR if the publish failed for a reason other than whatever the "already published" message is?
There was a problem hiding this comment.
Don't quote me on this but I believe it packages a
.crateand attempts to build from that, which catches things like incorrectinclude/excludein the manifest
AFAIK this sounds about right (https://doc.rust-lang.org/cargo/commands/cargo-publish.html#publish-options is a bit light on specifics). In particular it'd check Cargo.toml manifest. (Also use cargo published --locked --dry-run.)
We might want to also cargo package --locked --list to list all the files that goes to the final published artifact eventually.
There was a problem hiding this comment.
My preference would be to catch these errors and fail the workflow
I share this sentiment, IMO we should fail hard here.
|
Making sure I review this soonish, probably still want our friendly local proto for the actual CI code. |
asked the things that produce inscrutable code for inscrutable code. fair play. |
|
|
||
| gh pr comment ${HEAD_PR} -F output.log | ||
| else | ||
| echo "Nothing was published. Either there is no version update or some error has occurred." |
There was a problem hiding this comment.
My preference would be to catch these errors and fail the workflow
I share this sentiment, IMO we should fail hard here.
|
I'm not sure how to reliably detect whether the publish failed because the version is already published, or because of something else. Both seems to return exit code 101. |
|
I guess that we could either:
|
Hm... I feel like (1) might be worth trying. (2) is essentially fragile to unstable cargo wording, (3) seems to swallow the errors we care about anyway... |
|
Ok, added the check. |
|
In particular my desire would be "I would prefer my PR is not automatically closed by GH's process if it has not actually gone off and published the crate." Even if that means something wildly unintuitive! I would be fine if I have to manually check and confirm that an "error" in the workflow is Actually Success, then close my own PR. I'm good with that. It seems we're trying to do something more clever than that, which is fine as long as the item doesn't leave "my desk" (open PRs) before it Actually Succeeds. |
|
I could make the adjustment of checking "already-merged" PRs more and more often than I already do, but I don't want to increase the neuroticism of my interactions with GitHub, for everyone's sake. |
There was a problem hiding this comment.
honestly my eyes glazed over a bit reading "bash-in-yaml"... I actually consider myself bash-proficient but for some reason this embedding just throws me, is it really just the lack of syntax highlighting or something...? ...but to the extent I understand this it seems good.
| echo "backtrace \`${VERSION}\` could not be published to crates.io" > comment.txt | ||
| printf "<details>\n<summary>Cargo publish log</summary>\n\n" >> comment.txt | ||
| printf '```\n' >> comment.txt | ||
| cat "${RUNNER_TEMP}/cargo-log.txt" >> comment.txt | ||
| printf '\n```\n' >> comment.txt | ||
| printf "</details>\n\n" >> comment.txt |
There was a problem hiding this comment.
me, to me: "could this be replaced by a heredoc?"
me, to me: "would that actually make it more legible?"
me, to me: "uhmmm... lol?"
|
We could move the publish from the post-merge workflow to the main CI workflow, near the publish toolstate step. Of course the danger there is that if publishing fails (even spuriously), it will cancel the whole bors merge. |
|
Hm. Technically we could say, if stdarch needs publishing it should rollup=never so if it fails main CI it's fine? |
|
I don't follow what would be the difference between the thing being rolled up or not 🤔 "it's fine", as in, at least it won't cancel the merge of other PRs? |
|
Yeah. But probably doesn't matter though, was just thinking. |
There was a problem hiding this comment.
The step itself looks good to me, thanks. I don't really have a preference for during-merge vs post-merge, as long as it works for @workingjubilee.
Any reason this couldn't be a separate script, so it gets shellchecked? As it now uses Do wish there was a way to easily shellcheck in yaml. |
|
Hm true, it could be in its own script. |
|
I was actually thinking of moving it to |
|
That'd work for me 🤷 |
|
After taking another look at it, I don't think it's worth it to rewrite the two lines of bash into Rust atm. |
|
I agree with @tgross35. Would it be okay to extract the bash into its own script without going RIIR-crazy? It's 45 lines, no? fwiw if I have to make an adjustment then I'm ultimately okay with making that adjustment. I'm expressing a staged preference not an inviolate one. I realize that may not have been clear. @rustbot author |
|
Makes sense, done! |
This comment has been minimized.
This comment has been minimized.
3300dc6 to
c657c93
Compare
Co-authored-by: Jubilee <workingjubilee@gmail.com>
|
Yeah, I would be very surprised if this works on the first try. I'd suggest merging this, then merging rust-lang/team#2941, and then trying to do a release from this PR (will need a backtrace submodule sync). |
View all comments
This PR implements crate publishing, which is required for rust-lang/backtrace-rs#778, and would be useful also for other use-cases in the future.
To keep things simple, I reused the existing post-merge workflow, and implemented the publishing in bash.
To make this work, we will also need to make changes in team: rust-lang/team#2941
I think that we could start by moving the publishing to
rust-lang/rust, while still keeping the submodule, and test whether the publishing works as expected. Then we can get rid of the submodule and inlinebacktraceintorust-lang/rust.CC @workingjubilee
I used a chatbot to generate the if condition line in bash (lol), and the
cargo metadatacommand.r? jieyouxu