Skip to content

Commit 118a2da

Browse files
authored
use tufaceous ArtifactVersion for artifact versions (#7832)
Per [RFD 557], we're making artifact versions a freeform identifier (unlike system versions, which are still semver). Make this change. New TUF repo creation via `tufaceous assemble` still requires semver for artifact versions, to ensure compatibility with wicketd in v13. But there's an override for that available in tufaceous. [RFD 557]: https://rfd.shared.oxide.computer/rfd/0557
1 parent 67a8984 commit 118a2da

File tree

27 files changed

+510
-252
lines changed

27 files changed

+510
-252
lines changed

Cargo.lock

+24-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/wicketd-client/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ progenitor::generate_api!(
3333
replace = {
3434
AbortUpdateOptions = wicket_common::rack_update::AbortUpdateOptions,
3535
AllowedSourceIps = omicron_common::api::internal::shared::AllowedSourceIps,
36+
ArtifactId = omicron_common::update::ArtifactId,
3637
Baseboard = sled_hardware_types::Baseboard,
3738
BgpAuthKey = wicket_common::rack_setup::BgpAuthKey,
3839
BgpAuthKeyId = wicket_common::rack_setup::BgpAuthKeyId,

common/src/update.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ use schemars::{
1010
gen::SchemaGenerator,
1111
schema::{Schema, SchemaObject},
1212
};
13-
use semver::Version;
1413
use serde::{Deserialize, Serialize};
15-
use tufaceous_artifact::{Artifact, ArtifactKind};
14+
use tufaceous_artifact::{Artifact, ArtifactKind, ArtifactVersion};
1615

1716
/// An identifier for an artifact.
1817
///
@@ -35,7 +34,7 @@ pub struct ArtifactId {
3534
pub name: String,
3635

3736
/// The artifact's version.
38-
pub version: Version,
37+
pub version: ArtifactVersion,
3938

4039
/// The kind of artifact this is.
4140
pub kind: ArtifactKind,

dev-tools/reconfigurator-cli/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ slog-term.workspace = true
3939
slog.workspace = true
4040
swrite.workspace = true
4141
tabled.workspace = true
42+
tufaceous-artifact.workspace = true
4243
uuid.workspace = true
4344
omicron-workspace-hack.workspace = true
4445

dev-tools/reconfigurator-cli/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ use std::io::BufRead;
5252
use std::io::IsTerminal;
5353
use swrite::{SWrite, swriteln};
5454
use tabled::Tabled;
55+
use tufaceous_artifact::ArtifactVersion;
5556

5657
mod log_capture;
5758

@@ -463,7 +464,7 @@ enum ImageSourceArgs {
463464
/// the zone image comes from the `install` dataset
464465
InstallDataset,
465466
/// the zone image comes from a specific TUF repo artifact
466-
Artifact { version: semver::Version, hash: ArtifactHash },
467+
Artifact { version: ArtifactVersion, hash: ArtifactHash },
467468
}
468469

469470
impl From<ImageSourceArgs> for BlueprintZoneImageSource {

dev-tools/reconfigurator-cli/tests/input/cmds-set-zone-images.txt

+15-12
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,26 @@
22
load-example --nsleds 1 --ndisks-per-sled 3
33
blueprint-show 971eeb12-1830-4fa0-a699-98ea0164505c
44

5-
# Set a zone's image source to a specific artifact.
5+
# Set a couple zones' image sources to specific artifacts.
66
blueprint-edit 971eeb12-1830-4fa0-a699-98ea0164505c set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact 1.2.3 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
7-
blueprint-show 9766ca20-38d4-4380-b005-e7c43c797e7c
8-
blueprint-diff 971eeb12-1830-4fa0-a699-98ea0164505c 9766ca20-38d4-4380-b005-e7c43c797e7c
7+
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 72d12821-646d-4296-a081-ef5fb3a0ca24 artifact valid-non-semver 7b4281a6bd5946bb96b332c62afe289bef275e58b9ba031085f8827655f434b3
98

10-
# Set the zone's image source back to the install dataset.
11-
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 install-dataset
129
blueprint-show f714e6ea-e85a-4d7d-93c2-a018744fe176
13-
blueprint-diff 9766ca20-38d4-4380-b005-e7c43c797e7c f714e6ea-e85a-4d7d-93c2-a018744fe176
10+
blueprint-diff 971eeb12-1830-4fa0-a699-98ea0164505c f714e6ea-e85a-4d7d-93c2-a018744fe176
11+
12+
# Set these zones' image sources back to the install dataset.
13+
blueprint-edit f714e6ea-e85a-4d7d-93c2-a018744fe176 set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 install-dataset
14+
blueprint-edit bb128f06-a2e1-44c1-8874-4f789d0ff896 set-zone-image 72d12821-646d-4296-a081-ef5fb3a0ca24 install-dataset
15+
blueprint-show d9c572a1-a68c-4945-b1ec-5389bd588fe9
16+
blueprint-diff f714e6ea-e85a-4d7d-93c2-a018744fe176 d9c572a1-a68c-4945-b1ec-5389bd588fe9
1417

1518
# test help output
16-
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c help
17-
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image help
19+
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 help
20+
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 set-zone-image help
1821

1922
# test error case: no such zone id
20-
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 126f8db9-b966-45ec-bf89-fb7b41a04cc9 install-dataset
21-
# test error case: bad semver
22-
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact one e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
23+
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 set-zone-image 126f8db9-b966-45ec-bf89-fb7b41a04cc9 install-dataset
24+
# test error case: invalid version identifier
25+
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact 🫡 5d835e8666bd5cf65be66efbca6847b24e41fd85993448a211ad7be5fea559ab
2326
# test error case: bad hash
24-
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact 1.2.3 aaaa
27+
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact 1.2.3 aaaa

dev-tools/reconfigurator-cli/tests/output/cmd-set-zone-images-stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: invalid value 'one' for '<VERSION>': unexpected character 'o' while parsing major version number
1+
error: invalid value '🫡' for '<VERSION>': version contains invalid byte `\xf0` (allowed: ^[a-zA-Z0-9._+-]{1,63}$)
22

33
For more information, try '--help'.
44
error: invalid value 'aaaa' for '<HASH>': Invalid string length

0 commit comments

Comments
 (0)