Skip to content

Ensure "complete" CI steps always run#4506

Closed
marcotc wants to merge 3 commits intomasterfrom
fix-checks
Closed

Ensure "complete" CI steps always run#4506
marcotc wants to merge 3 commits intomasterfrom
fix-checks

Conversation

@marcotc
Copy link
Member

@marcotc marcotc commented Mar 17, 2025

This PR ensures the last step of our CI workflows (normally called WORKFLOW NAME (complete)) always run, even when its dependency jobs have failed or been skipped.

This ensures that our mandatory branch protection checks will never be skipped by GitHub. Today when the "complete" job is skipped, the branch protection check considers it successful

Change log entry
No

Additional Notes:

How to test the change?

@marcotc marcotc added the dev/github Github repository maintenance and automation label Mar 17, 2025
@marcotc marcotc self-assigned this Mar 17, 2025
@marcotc marcotc requested a review from a team as a code owner March 17, 2025 19:15
@marcotc marcotc marked this pull request as draft March 17, 2025 19:25
@p-datadog
Copy link
Member

LGTM but I don't understand the GH stuff enough to checkmark

@pr-commenter
Copy link

pr-commenter bot commented Mar 17, 2025

Benchmarks

Benchmark execution time: 2025-03-18 08:32:12

Comparing candidate commit 4db2cc1 in PR branch fix-checks with baseline commit 874e602 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 31 metrics, 2 unstable metrics.

@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.69%. Comparing base (874e602) to head (4db2cc1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4506      +/-   ##
==========================================
- Coverage   97.70%   97.69%   -0.02%     
==========================================
  Files        1381     1381              
  Lines       83973    83973              
  Branches     4251     4251              
==========================================
- Hits        82046    82036      -10     
- Misses       1927     1937      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented Mar 17, 2025

Datadog Report

Branch report: fix-checks
Commit report: 4db2cc1
Test service: dd-trace-rb

✅ 0 Failed, 20632 Passed, 1370 Skipped, 3m 17.78s Total Time

@marcotc marcotc marked this pull request as ready for review March 17, 2025 20:23
Copy link
Member

@lloeki lloeki left a comment

Choose a reason for hiding this comment

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

Today when the "complete" job is skipped, the branch protection check considers it successful ‽

This is normal (and similar to rspec skipping tests?)

In GHA terms, "skipped" means "this step/workflow is not relevant".

e.g running system tests for doc changes makes no sense => skipped, ergo "successful".

This PR would transform a "skipped" UI display materialising the fact that the tests did not run (intentionally so) into a checkmark that looks like as if the tests did run when they actually didn't.

(Again, a skipped test is displayed differently than a passing one in a rspec suite)

even when its dependency jobs have failed

Also "(complete)" should not run when any dependent fail and thus properly result in the PR tests not passing / the PR being unmergeable. Is that the initial reason for this PR? That you'd like it to be red?

Marking this "request changes" to leave the opportunity to discuss, but I don't believe the change should be merged.

See:

@p-datadog
Copy link
Member

@lloeki My reading of the diff is that a skipped status would be changed to failing, not successful, thus there will not actually be a case when a skipped test would be marked as having been run and succeeded?

@lloeki
Copy link
Member

lloeki commented Apr 8, 2025

a skipped status would be changed to failing,

That would be a problem! It's like you have this rspec test:

it 'tests something' do
  skip "don't run this test in this case" if some_condition?
  
  # something only conditionally relevant...
end

You don't want that to fail the test suite, you want the test suite to pass (and tell you that bit has been skipped)

If you have a doubt, imagine that some_condition? is jruby? and the test case is something that is not relevant to JRuby.

In our case the system tests have no business running when there are only changes to, say, documentation files, ergo the running of it is skipped based on a path criteria, because they're simply irrelevant to run in that case, and so the overall result of the skip is to satisfy the branch protection status requirement check.

If "skip" implied "fail" then merges would be blocked by irrelevant checks.

@p-datadog
Copy link
Member

@lloeki According to PR description only the "summary" jobs would be changed to be always required, not e.g. the system tests ones. @marcotc please correct me if I misunderstood.

@lloeki
Copy link
Member

lloeki commented May 7, 2025

only the "summary" jobs would be changed to be always required

They are already required. The desc says that they are made to always run and never skipped:

This ensures that our mandatory branch protection checks will never be skipped by GitHub. Today when the "complete" job is skipped, the branch protection check considers it successful ‽

When system tests should run they must run.

Yet there are cases where they are useless to run: doc change, code change with no impact on system tests (e.g spec change, appraisal...), etc... Running them would just delay PR merging and waste workers.

That's the point of the path-based filter:

  • When systests are relevant to run they are required to run and pass.
  • When systests don't need to run they are irrelevant, hence skip.

A skip status on a "completed" synthetic job satisfies the required status check for merging, but most importantly a skip on this "completed" job is visually materialised to indicate it is expected to be skipped.

The PR comment says:
Today when the "complete" job is skipped, the branch protection check considers it successful ‽
And aims to address that by making it a green checkmark instead, when having it be skipped is the correct and intended behaviour. "The branch protection check consider[ing] it successful" is exactly what is desired: the result of system tests simply does not matter.

Again if you had a spec like:

it 'forks' do
  skip 'no fork in jruby' if RUBY_ENGINE == 'jruby'

  # ... whatever
end

And ran it under JRuby, you wouldn't mark this spec example as "green", "completed", or whatever: it would be a) tallied as "skipped" and b) ignored as far as the whole spec suite result is concerned (and so logically equivalent to "success" WRT that overall test suite result)

So I am wondering why do we want them green when they did not run? Maybe I missed something?

@lloeki
Copy link
Member

lloeki commented May 7, 2025

X-linking this one which is somewhat related: #4629 (comment)

@p-datadog
Copy link
Member

I think it's fine to either always run "complete" jobs or present them as "successful" when all of their dependencies are skipped (but none failed).

Do you have another suggestion for how to avoid the scenario of a PR having failed required jobs that don't prevent merging (via an intermediate job that is skipped)? Changing the ~5 "compete" jobs from "skipped" to "successful", seems like a very reasonable compromise if there aren't any better suggestions.

@TonyCTHsu
Copy link
Contributor

Obsolete with #4629

@TonyCTHsu TonyCTHsu closed this May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev/github Github repository maintenance and automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants