remove artifact kind from PendingMgsUpdate #8017
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PendingMgsUpdate
currently includes anArtifactHashId
, which is a combination ofArtifactKind
andArtifactHash
. We need the hash, but we don't need the kind. This choice dates from the first iteration ofPendingMgsUpdate
, when thekind
here specified which component was being updated. Now, that's specified by thedetails
field, which has other component-specific information, too. So we don't need thekind
and we can use anArtifactHash
directly rather thanArtifactHashId
.This is built on #8016 just to avoid conflicts.
Anticipating some related questions: we do still make other assumptions about some fields matching up. For example, the artifact referenced by this hash must be appropriate for the component being updated (SP vs. RoT vs. RoT bootloader), the board being updated (when it comes to the SP), the slot being updated (when it comes to RoT), the signing key (when it comes to RoT and RoT bootloader), etc. And updating to this artifact should result in version
artifact_version
being in the component's active slot. The executor checks / will double-check most of these. But it's the responsibility of the planner to set them correctly.The way I think about all this is that the planner is responsible for taking the high-level, normalized data (like the policy "we should be running release 14" and the TUF repo metadata that specifies which artifact is appropriate for any given component) and creating a
PendingMgsUpdate
. That structure is essentially denormalized and gives the executor all the information it needs to complete the update without having to consult any other sources.