-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix SubResourceIntegrityTests to report all errors #15490
Conversation
This could happen if you have an invalid SHA which makes sense to me, If the intend to report all the errors at the end I never mind, but we could log a warning message for each during the test |
Yes, but it already does a console.log See example of multiple failing asserts here: https://github.com/OrchardCMS/OrchardCore/actions/runs/8248723901/job/22559650953?pr=14256 |
test/OrchardCore.Tests/Modules/OrchardCore.Resources/SubResourceIntegrityTests.cs
Outdated
Show resolved
Hide resolved
test/OrchardCore.Tests/Modules/OrchardCore.Resources/SubResourceIntegrityTests.cs
Outdated
Show resolved
Hide resolved
Can I push commit to your PR if you don't mind, then feel free to ignore it if you don't like it |
@Skrypt seems the SRI unit test helps you a lot for discovering invalid SHAs in your VueJS PR :) |
Yeah, but these are valid SHAs just not sha384 which cause issues. Maybe it could be more intelligent and do a split on the string to find which SHA to generate and compare with. |
Maybe but while we are using |
I forgot @Skrypt, recently we did an update on this, and now you can run the SRI test in your development machine. So, maybe no need to report all the errors because all the current resources are up to date. The issue raised in your PR because it's old IMHO For that I think there no changed needed and you could fix the SHA quickly without waiting for the CI to discover them Side note: Add |
Yeah, but it is really boring to need to do a commit per SHA failing as it is currently only reporting one failing assert at a time. Everyone that will merge latest dev on their PR and that need to add assets to a resource file will face this issue. Last night, I did almost 15 commits because CI was reporting one SHA failing at a time which doesn't make sense to me. Why then do we need to have a CI environment variable for this test to execute if it is mandatory for the CI to build? |
More on that. Maybe we need a small tool to refactor these files with proper SHA if the intent is to always only use SHA384. That be better than just rely on testing and copy/pasting SHA from the command line. |
This reverts commit 897a8b7.
This is useful for running the test in development, but in the CI build we should do it on every PR, @sebastienros your thoughts if you see a value for this PR |
99% of our commits won't change static assets that have this SHA. The 1% left should update the assets and the SHAs. This way it's only run as a safe-guard, on the CI. If you really want to run these locally, and download all the css/js/+minified files every time you run the tests then define the ENV on your machine, but other users won't be impacted. If that was just me we could even create a "Fact" that accepts a argument with an ENV name such that we could run these tests in a GH action with a CRON to not even run for all our PRs. But this could also be solved by have these tests in a separate assembly and pick which test assemblies we want to run and when. Maybe this would solve your problem, you could just select this assembly when you want to run it locally instead of setting an ENV. |
What if we target building such tests in the |
I see your point about downloading all the assets on CI every time. If we don't want to do this then we need something that can be triggered manually. I will just keep this test for myself for now. It is just easier than executing the tests 8 times to get a new hash to copy in the code. I think we should have something like the Po extractor tool that would execute from CI and create an issue automatically with complete log of failing hashes. Could be a Github action triggered manually. Could create a Github issue or not. But I definitely want to be able to execute this locally without needing to put another ENV variable locally. |
It was still fast though to download and test them all from CI. |
Closing as non-issue for CI. |
It gets really boring creating a commit per item failing.
I updated all of the assets for sha-5... something in the Vue 3 PR branch and everything fails.
Now this PR will report all of the assets that are failing including if the assets itself has a bad url.