Skip to content

Commit

Permalink
Allow indexing SP images on name instead of board
Browse files Browse the repository at this point in the history
Currently, we expect each SP image in the TUF repo to have a
unique board name. This prevents us from also packaging other
images for use in manufacturing. Relax this slightly by requiring
all SP images to have a unique `name` instead of a unique `board`.
We will still select by `board` via wicketd meaning the actual
runtime behavior should still be the same.
  • Loading branch information
Laura Abbott authored and labbott committed Oct 14, 2024
1 parent 6fb91c6 commit e8cdc33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions update-common/src/artifacts/update_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,14 @@ impl<'a> UpdatePlanBuilder<'a> {
data.extend_from_slice(&chunk);
}

// We purposely read out `name` instead of `board` here to
// allow for packaging multiple images for the same board
// in the TUF repo (specifically the manufacturing images)
// We will still select the image in wicketd via `board`
// as the only images we want to install via wicket are those
// with name == board.
let (artifact_id, board) =
read_hubris_board_from_archive(artifact_id, data.clone())?;
read_hubris_name_from_archive(artifact_id, data.clone())?;

let slot = match sp_map.entry(board) {
btree_map::Entry::Vacant(slot) => slot,
Expand Down Expand Up @@ -1012,7 +1018,7 @@ fn read_hubris_sign_from_archive(

// This function takes and returns `id` to avoid an unnecessary clone; `id` will
// be present in either the Ok tuple or the error.
fn read_hubris_board_from_archive(
fn read_hubris_name_from_archive(
id: ArtifactId,
data: Vec<u8>,
) -> Result<(ArtifactId, Board), RepositoryError> {
Expand All @@ -1028,7 +1034,7 @@ fn read_hubris_board_from_archive(
return Err(RepositoryError::ReadHubrisCaboose { id, error });
}
};
let board = match caboose.board() {
let board = match caboose.name() {
Ok(board) => board,
Err(error) => {
return Err(RepositoryError::ReadHubrisCabooseBoard { id, error });
Expand Down
4 changes: 4 additions & 0 deletions wicketd/src/update_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,10 @@ impl UpdateDriver {
})?
.into_inner();

// The sp_artifacts were built on the caboose `NAME`
// entry but we intentonally get via the `BORD` entry
// as that represents the only images we want to install
// via wicket
let Some(sp_artifact) = sp_artifacts.get(&caboose.board)
else {
return Err(
Expand Down

0 comments on commit e8cdc33

Please sign in to comment.