Bug 2037926 - landoscript: introduce file-specific version_bump scopes#1448
Bug 2037926 - landoscript: introduce file-specific version_bump scopes#1448JohanLorenzo wants to merge 1 commit into
Conversation
I'd probably do 5 before merging anything to mozilla-taskgraph, if that gets picked up anywhere in the mean time we'd break production. |
jcristau
left a comment
There was a problem hiding this comment.
Not exactly sure how to change it but I'm not super happy with the way this makes scope validation functions more complex, this is critical code that would ideally remain as straightforward as possible.
| expected_scopes = {f"project:releng:lando:repo:{lando_repo}"} | ||
| expected_scopes.update(f"project:releng:lando:action:{a}" for a in actions if a != "version_bump") | ||
| if "version_bump" in actions and "project:releng:lando:action:version_bump" not in scopes: | ||
| expected_scopes.update(f"project:releng:lando:action:version_bump:file:{f}" for f in (version_bump_files or [])) |
There was a problem hiding this comment.
instead of this ugly (version_bump_files or []), consider having the caller pass an empty list, or adding and version_bump_files to the if?
There was a problem hiding this comment.
I agree; this is a case where more verbose/simpler code would be beneficial now that the logic is less than trivial. I think it also has a bug in it as currently written? (I don't see any way that project:releng:lando:action:version_bump is ever in expected_scopes?)
How about something like this?
def validate_scopes(scopes, lando_repo, actions, version_bump_files=[]):
expected_scopes = {f"project:releng:lando:repo:{lando_repo}"}
for action in actions:
if action == "version_bump":
if "project:releng:lando:action:version_bump" in scopes:
# It's superfluous to add this to the expected scopes, but a bit more clear/correct to do so? This block goes away when we stop supporting this legacy scope anyways.
expected_scopes.add("project:releng:lando:action:version_bump")
else:
expected_scopes.update(f"project:releng:lando:action:version_bump:file:{f}" for f in version_bump_files)
else:
expected_scopes.add(f"project:releng:lando:action:{action}")
There was a problem hiding this comment.
with one nit, the default for version_bump_files shouldn't be [] (use () instead).
There was a problem hiding this comment.
Thanks guys! Changes made. I also expanded the unit test suite to make sure we cover all known cases.
a38d90a to
f4793fe
Compare
f4793fe to
15e60b8
Compare
15e60b8 to
505b77c
Compare
For now, the general scope continues to work; file-specific scopes are required only when the general scope is absent.
Merge order
dev-landoscriptand verified (see below), awaiting merge tomasterversion_bumpgrantsvalidate_scopesVerification
Triggered a staging-xpi-manifest release promotion. The version_bump task ran with the legacy
project:releng:lando:action:version_bumpscope (backward compat), bumpedbrowser/extensions/newtab/manifest.jsonfrom153.1.0→153.6.0, and landed on staging-firefox-main:Bug 2037926