Skip to content
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

Split cargo-deny job into two non-matrix jobs #1670

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

EliahKagan
Copy link
Member

@EliahKagan EliahKagan commented Nov 12, 2024

This is the WASM de-matrixification that was intentionally omitted from #1668 so it could be considered separately (see also #1668 (review)).

This PR is intended to have only one commit, 38edb2c, and the changes are really +12 -9, not +1201 -742 as currently shown. The other commits are from #1668. This is currently a draft because I recommend against merging it until #1668 is merged, and it may also be a good idea to rebase this after #1668 is merged, which will make it easy to verify that merging this will only add one commit.

What this changes

Instead of conditionally applying continue-on-error: true at the job level to the advisories job, this splits cargo-deny into two job definitions, cargo-deny-advisories and cargo-deny, where neither has continue-on-error but cargo-deny-advisories is omitted as a dependency of the tests-pass job that makes jobs effectively required for PR auto-merge. This way, when there is an unaddressed advisory, the cargo-deny-advisories job unambiguously fails, even failing the workflow, but PRs can still auto-merge.

One implication of this is that, on Dependabot security update PRs, @dependabot merge and @dependabot squash and merge commands will only perform a merge if cargo deny check advisories reports no other outstanding advisories. This is because, when Dependabot is told to merge a PR, it only goes ahead with the merge if all checks pass (i.e. report a successful conclusion). This would be convenient for cases where, if the fix is not complete, further manual review is desired. It would otherwise be inconvenient, but then a usual PR auto-merge could be done instead (which is the more common practice here anyway).

Possible alternative

The main thing I can think of that would make this change unsuitable is if we actually just want to start treating cargo deny check advisories failures as hard errors and have them block merging. In that case, the current organization could be kept and the conditional continue-on-error could just be removed from it.

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the follow-up!

I hope with #1668 merged this one can be rebased and merged without trouble.

Instead of conditionally applying `continue-on-error: true` at the
job level to the `advisories` job, this splits `cargo-deny` into
two job definitions, `cargo-deny-advisories` and `cargo-deny`,
where *neither* has `continue-on-error` but `cargo-deny-advisories`
is omitted as a dependency of the `tests-pass` job that makes jobs
effectively required for PR auto-merge. This way, when there is an
unaddressed advisory, the `cargo-deny-advisories` job unambiguously
fails, even failing the workflow, but PRs can still auto-merge.

One implication of this is that, on Dependabot security update PRs,
`@dependabot merge` and `@dependabot squash and merge` commands
will only perform a merge if `cargo deny check advisories` reports
no other outstanding advisories. This is because, when Dependabot
is told to merge a PR, it only goes ahead with the merge if all
checks pass (i.e. report a successful conclusion). This would be
convenient for cases where, if the fix is not complete, further
manual review is desired. It would otherwise be inconvenient, but
then a usual PR auto-merge could be done instead (which is the more
common practice here anyway).
@EliahKagan EliahKagan marked this pull request as ready for review November 12, 2024 10:59
@EliahKagan
Copy link
Member Author

I've rebased this and it should be ready to go (once tests pass).

@Byron Byron enabled auto-merge November 12, 2024 11:20
@Byron Byron merged commit 0155aec into GitoxideLabs:main Nov 12, 2024
18 checks passed
@EliahKagan EliahKagan deleted the run-ci/cargo-deny branch November 12, 2024 17:48
@EliahKagan
Copy link
Member Author

EliahKagan commented Nov 12, 2024

For future reference, in case it ever changes: That Dependabot commands only merge when all checks pass, and not on the weaker condition of all required checks for auto-merge passing, seems to me to follow directly from the phrase "once your CI tests have passed" in the documentation, as well as to be the most intuitive behavior. After all, when people prefer the behavior of auto-merge (as we often would here), they can just use that. But this is subjective and some people consider it a bug that Dependabot does not ignore non-required checks. See dependabot/dependabot-core#7383. So this behavior may change some day. In any case, getting this Dependabot behavior was not the primary motivation for the changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants