Bug 2052985 - feat: add build_signing transform and artifact signing specs - #237
Bug 2052985 - feat: add build_signing transform and artifact signing specs#237kryoseu wants to merge 1 commit into
Conversation
d1c2ace to
af00c41
Compare
bhearsum
left a comment
There was a problem hiding this comment.
I'm not certain how I feel about this. This is a forklift of existing gecko_taskgraph code into this repository, and it retains a lot of Gecko-isms. I don't want to let perfect by the enemy of good, but I would also prefer that we don't copy hacks into what we expect to be the long term home for this code.
I'm also not sure that I'm fond of the idea of putting the whole build_signing transform in here. That's a transform that is highly specialized, and unlikely to be generally useful, as it is very closely tied to a couple of specific kinds in gecko. A rename or possibly refactor of it might make me a little bit more comfortable with the idea.
One idea (which would also help in getting rid of some of the Gecko-isms) would be to not import this code as a transform, but pull out the core bits and have them called in transforms in both gecko and comm repositories. For example, the core bit of add_signed_routes is the inner-most for loop. Putting that in its own (pure) function would avoid the need for code here to know anything about the shippable attribute or enable-signing-routes.
I have some specific comments below, but I also think you may want to consider putting some of this code in comm instead of here. If you want a more immediate path forward, I strongly urge you to put the code you need into the comm repo for now.
| enable_signing_routes = job.pop("enable-signing-routes", True) | ||
|
|
||
| job["routes"] = [] | ||
| if dep_job.attributes.get("shippable") and enable_signing_routes: |
There was a problem hiding this comment.
shippable is a Gecko (and I guess comm) specific concept that doesn't belong here IMO.
| job["routes"] = [] | ||
| if dep_job.attributes.get("shippable") and enable_signing_routes: | ||
| for dep_route in dep_job.task.get("routes", []): | ||
| if not dep_route.startswith("index.gecko.v2"): |
There was a problem hiding this comment.
gecko in the index route is also Gecko specific. I'm not sure this would even work for comm in its current form?
|
|
||
|
|
||
| def is_partner_kind(kind): | ||
| if kind and kind.startswith(("release-partner", "release-eme-free")): |
There was a problem hiding this comment.
These are Gecko-isms that shouldn't live here (the same goes for names of other specific kinds).
| return True | ||
|
|
||
|
|
||
| def generate_specifications_of_artifacts_to_sign( |
There was a problem hiding this comment.
This function in particular I do not think should move here in its current form. It has...not aged well to say the least, and I would prefer not to prolong its life.
jcristau
left a comment
There was a problem hiding this comment.
Agree with Ben that this shouldn't be moved, or not as-is.
|
I think it's worth stepping back and discussing what actually is the thing we want to share across all projects here. When it comes to signing, the mechanism we use is the In gecko (and comm), the thing that makes task payloads conform to the schema is already in So instead of copy/pasting transforms, I think the question we want to ask is what logic would make sense to tease out of the various signing transforms (across gecko, comm, and even other repos) and place into |
af00c41 to
7486a9e
Compare
|
Thanks folks for the comments. Agreed the forklift is wrong, and ahal's framing especially. I've prototyped a different split and force-pushed it over the previous commit, so the diff here is now just the new approach. Please let me know if this is a better direction and what your thoughts are in general. The split: the library does only the mechanical part — insert a Plus scriptworker:
signed-route-prefix: 'index.comm.v2'
excluded-signing-formats: [gcp_prod_autograph_widevine, autograph_langpack]Just to be clear, my goal here is getting Two things I'd like your call on:
|
7486a9e to
968a3eb
Compare
|
The force-push was just a rebase onto 5.0.0 with no content change. So the pending questions above still stand. |
ahal
left a comment
There was a problem hiding this comment.
Thanks, this looks much better! It all seems reasonable to me to take into mozilla-taskgraph
| e.g. ``index.gecko.v2``) so no project-specific value is baked in here. A | ||
| project that configures no prefix simply gets no signed routes. | ||
| """ | ||
| route_prefix = config.graph_config["scriptworker"].get("signed-route-prefix") |
There was a problem hiding this comment.
Can this instead be derived from config.graph_config["trust-domain"]? Or are the projects where they don't follow the standard format?
If it's just gecko and comm that will be using this to start and they can both be derived, I'd say let's start with that and we can implement signed-route-prefix later when needed
|
|
||
|
|
||
| @transforms.add | ||
| def add_signed_routes(config, jobs): |
There was a problem hiding this comment.
nit: I'd prefer we call these variables task / tasks
| # whose formats are *emptied* by the exclusion is dropped; one that arrived | ||
| # with no formats is left alone, since notarization kinds rely on that. | ||
| excluded_formats = set( | ||
| config.graph_config["scriptworker"].get("excluded-signing-formats", []) |
There was a problem hiding this comment.
This will need to be added to GraphConfig schema (and signed-route-prefix above if we decide to keep that). The scriptworker namespace is a Gecko-ism, so instead you should add it to the schema that mozilla-taskgraph provides:
I'd like to follow the format that the shipitscript uses, e.g:
signing:
excluded-formats: ...
route-prefix: ... # if necessary
|
And to answer your questions:
It seems reasonable to me.. Though I was wondering if it would make more sense for this to be a per-task config? You could set it in
Yeah I think we'll want a transform on the gecko / comm side that does whatever filtering it needs to before these shared transforms are reached. If we really wanted to make the logic shared, there could be some task config that uses the |
This adds `transforms/build_signing.py` with `add_signed_routes` and `define_upstream_artifacts`. The index route prefix is derived from `graph_config["trust-domain"]`, following taskgraph's standard `index.<trust-domain>.v2.<project>` layout, instead of hardcoding `index.gecko.v2`. The set of artifacts to sign comes from a project-populated `task["signing-artifacts"]` key, validated by a schema, rather than from Firefox-specific product data. This is inert for Firefox, whose trust-domain is `gecko` and therefore derives exactly the prefix it hardcodes today. It is not inert for Thunderbird: its routes are `index.comm.v2.*`, which the hardcoded prefix silently dropped, so comm gains signed routes once its kinds adopt these transforms. Deciding which tasks deserve them stays with the project - filter in an earlier transform, or set `enable-signing-routes` to False - since `shippable` is a Gecko/comm concept that doesn't belong here. `signing-artifacts` is required rather than defaulted: a project that forgets to populate it would otherwise get an empty `upstream-artifacts`, that is, a signing task that signs nothing, with no error at graph time. Bug 2052985
968a3eb to
0268225
Compare
|
Thanks @ahal, appreciate the comments. I've pushed an update addressing all of the above:
On the exclusion: One consequence worth calling out: it's a no-op for Firefox but not for Thunderbird. comm's routes are Shippable gate: agreed, project-side. And |
Port the desktop and source build-signing transforms (add_signed_routes, define_upstream_artifacts) and the shared generate_specifications_of_artifacts_to_sign helper from gecko_taskgraph so they can be consumed by both Gecko and comm.
Android signing is left out from
generate_specifications_of_artifacts_to_sign. Consumers handle it before delegating here since it depends on gecko-specific scriptworker code (generate_beetmover_upstream_artifacts).