-
Notifications
You must be signed in to change notification settings - Fork 29.1k
_downloadArtifacts
(Web SDK) uses content-aware hashing in post-submit
#174236
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
_downloadArtifacts
(Web SDK) uses content-aware hashing in post-submit
#174236
Conversation
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request updates the Web SDK artifact download process to use content-aware hashing instead of Git revisions. The changes introduce a new contentHash
variable and modify the download URL accordingly. My review identified several critical issues in the implementation that would cause compilation failures. Specifically, there are uninitialized variables and syntax errors in common.dart
, and a field naming inconsistency in environment.dart
that breaks the constructor. I have provided detailed comments and code suggestions to resolve these problems.
_downloadArtifacts
(Web SDK) to use Content-Aware Hashing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, assuming it works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Looks like this is not working. Example failure: Running `dart pub get` in 'engine/src/flutter/lib/web_ui'
Pipeline experienced the following failures:
"copy_artifacts": Could not download flutter-web-sdk.zip from cloud bucket at URL: https://storage.googleapis.com/flutter_archives_v2/flutter_infra_release/flutter/1dc06b550ced0908e59a43c06a26353b1aa2536a/flutter-web-sdk.zip. Response status code: 404
#0 CopyArtifactsStep._downloadArtifacts (file:///b/s/w/ir/cache/builder/engine/src/flutter/lib/web_ui/dev/steps/copy_artifacts_step.dart:64:7)
<asynchronous suspension>
#1 CopyArtifactsStep.run (file:///b/s/w/ir/cache/builder/engine/src/flutter/lib/web_ui/dev/steps/copy_artifacts_step.dart:96:37)
<asynchronous suspension>
#2 Pipeline.run (file:///b/s/w/ir/cache/builder/engine/src/flutter/lib/web_ui/dev/pipeline.dart:136:9)
<asynchronous suspension>
#3 TestCommand.run (file:///b/s/w/ir/cache/builder/engine/src/flutter/lib/web_ui/dev/test_runner.dart:407:7)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#5 main (file:///b/s/w/ir/cache/builder/engine/src/flutter/lib/web_ui/dev/felt.dart:41:26)
<asynchronous suspension>
Test pipeline failed. The content hash was I'm trying to figure out what previously running process was expected to have uploaded this, but did not. |
This is set: flutter/engine/src/flutter/ci/builders/linux_web_engine_build.json Lines 10 to 12 in 8632719
But I don't see where it is uploading |
Here is the original CL that added support for content-hashed uploads: if flags.get('upload_content_hash', False):
content_hash_url = api.repo_util.get_content_hash_url(
api, path.remote, api.repo_util.content_hash()
)
api.archives.upload_artifact(path.local, content_hash_url)
api.flutter_bcid.upload_provenance(path.local, content_hash_url) ... which makes sense. The value we care about comes from def content_hash(self):
"""Returns the content hash if present, or None
The content hash is a source-derived value that fingerprints the artifacts
with the engine source that produced it. By moving to a content hash, we
build less copies of the same engine source code and speed up CI.
See: https://github.com/flutter/flutter/blob/master/bin/internal/content_aware_hash.sh
"""
return self.m.properties.get('content_hash', None) ... but I don't see that property passed in anywhere here. |
_downloadArtifacts
(Web SDK) to use Content-Aware Hashing_downloadArtifacts
(Web SDK) uses content-aware hashing in post-submit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an alternative suggestion that might be simpler for detecting presubmit, but either way probably works.
@@ -57,7 +57,7 @@ class CopyArtifactsStep implements PipelineStep { | |||
}; | |||
final Uri url = Uri.https( | |||
'storage.googleapis.com', | |||
'${realmComponent}flutter_infra_release/flutter/$gitRevision/flutter-web-sdk.zip', | |||
'${realmComponent}flutter_infra_release/flutter/${isPostsubmit ? contentHash : gitRevision}/flutter-web-sdk.zip', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to just do realm == LuciRealm.Try ? gitRevision : contentHash
instead of reading the LUCI_PR
environment variable. It's probably equivalent functionally, so it's up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that's better.
I made it a negative so that, if you use this tool locally, it defaults to git revision instead of content hash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I'm reading the code, only LuciRealm.Try
will use gitRevision
. Does local development use LuciRealm.Try
or LuciRealm.Unknown
?
Basically:
realm == LuciRealm.Try ? gitRevision : contentHash
and
realm != LuciRealm.Try ? contentHash : gitRevision
are the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you probably want to do is realm == LuciRealm.Prod ? contentHash : gitRevision
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code path is never going to be exercised locally (and your actual local build will not ever be in GCS) so that point is moot.
I think the staging realm is postsubmit + bringup: true
so I think that should be contentHash as well. Hence, only the try realm should actually use gitRevision
right now, IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok that makes sense.
My comment was a response to:
I made it a negative so that, if you use this tool locally, it defaults to git revision instead of content hash.
So if that point is moot, please carry on 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Done as ${realm == LuciRealm.Try ? gitRevision : contentHash}
I am excited to land this, and find out if it works!11! |
Detected the If you add the The "Merge" button is also unlocked. To bypass presubmits as well as the tree status, press the GitHub "Add to Merge Queue". |
Skipping remaining presubmits, the one test that could have been impacted (in presubmit) has passed. On postsubmit, this might fail. If it does, I'll revert it. |
…mit (flutter#174236) Towards flutter#174225. Will need to get cherry-picked into 3.35 and 3.36.
…mit (flutter#174236) Towards flutter#174225. Will need to get cherry-picked into 3.35 and 3.36.
flutter/flutter@26bb33b...edd434a 2025-08-23 engine-flutter-autoroll@skia.org Roll Skia from 6f710e0b38f7 to 61169c1f6f7c (1 revision) (flutter/flutter#174325) 2025-08-23 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Z-ZaFQ7jAqJ1OrIBf... to XLSNQCsY1VkIthSjt... (flutter/flutter#174318) 2025-08-23 engine-flutter-autoroll@skia.org Roll Skia from ebb6051e8bb1 to 6f710e0b38f7 (1 revision) (flutter/flutter#174317) 2025-08-22 1961493+harryterkelsen@users.noreply.github.com [web] Expose rasterizers in Renderer (flutter/flutter#174308) 2025-08-22 jhy03261997@gmail.com Update some semantics flags updated to use enum (engine, framework, web) (flutter/flutter#170696) 2025-08-22 bkonyi@google.com [ Tool ] Don't emit artifact downloading messages when --machine is provided (flutter/flutter#174301) 2025-08-22 engine-flutter-autoroll@skia.org Roll Skia from cb15e1452399 to ebb6051e8bb1 (5 revisions) (flutter/flutter#174296) 2025-08-22 matanlurey@users.noreply.github.com `_downloadArtifacts` (Web SDK) uses content-aware hashing in post-submit (flutter/flutter#174236) 2025-08-22 jacksongardner@google.com Refactor text and runtime effect to separate skia and impeller implementations. (flutter/flutter#174219) 2025-08-22 engine-flutter-autoroll@skia.org Roll Packages from 58c02e0 to 092d832 (4 revisions) (flutter/flutter#174295) 2025-08-22 bkonyi@google.com [ Widget Preview ] Add support for DevTools configuration (flutter/flutter#174272) 2025-08-22 32538273+ValentinVignal@users.noreply.github.com Migrate more files to `WidgetStateProperty` (flutter/flutter#174268) 2025-08-22 bkonyi@google.com [ Tool ] Ensure `--dds-port=<port>` is respected when targeting web devices (flutter/flutter#174278) 2025-08-22 fluttergithubbot@gmail.com Marks Mac_ios ios_debug_workflow to be unflaky (flutter/flutter#174104) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Towards #174225.
Will need to get cherry-picked into 3.35 and 3.36.