Add purgeHTML extractor to fix flakiness
What does this MR do?
This MR should help harden the purge-css-check
jobs and prevent flaky failures. It does this by adding the official HTML extractor, instead of using a default extractor that only looks for words in a file regardless of context.
How does this help?
In this failed pipeline one of the fixtures was generated with a csp-nonce
with content="p/..."
. This caused our default extractor to find the word "p" and fail because it was missing
https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/1316947507
By using the official HTML extractor, we will be significantly less vulnerable to false positives (that cause pipeline failures)
HTML Fixtures
These are the HTML fixtures of the failed job. You can use them to analyze what words PurgeCSS might have been finding which will rightfully ignore now.
Screenshots (strongly suggested)
How to test?
Since the startup_css
is only visible for a second, you can use this patch to force it to stay with ?startup_css_only=true
0001-Add-startup_css_only-condition.patch
Description | Screenshot |
---|---|
Project with ?startup_css_only=true
|
|
Dark mode with ?startup_css_only=true
|
Does this MR meet the acceptance criteria?
Conformity
-
I have included a changelog entry, or it's not needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed.