Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use tufaceous ArtifactVersion for artifact versions #7832

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clients/wicketd-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ progenitor::generate_api!(
replace = {
AbortUpdateOptions = wicket_common::rack_update::AbortUpdateOptions,
AllowedSourceIps = omicron_common::api::internal::shared::AllowedSourceIps,
ArtifactId = omicron_common::update::ArtifactId,
Baseboard = sled_hardware_types::Baseboard,
BgpAuthKey = wicket_common::rack_setup::BgpAuthKey,
BgpAuthKeyId = wicket_common::rack_setup::BgpAuthKeyId,
Expand Down
5 changes: 2 additions & 3 deletions common/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ use schemars::{
gen::SchemaGenerator,
schema::{Schema, SchemaObject},
};
use semver::Version;
use serde::{Deserialize, Serialize};
use tufaceous_artifact::{Artifact, ArtifactKind};
use tufaceous_artifact::{Artifact, ArtifactKind, ArtifactVersion};

/// An identifier for an artifact.
///
Expand All @@ -35,7 +34,7 @@ pub struct ArtifactId {
pub name: String,

/// The artifact's version.
pub version: Version,
pub version: ArtifactVersion,

/// The kind of artifact this is.
pub kind: ArtifactKind,
Expand Down
1 change: 1 addition & 0 deletions dev-tools/reconfigurator-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ slog-term.workspace = true
slog.workspace = true
swrite.workspace = true
tabled.workspace = true
tufaceous-artifact.workspace = true
uuid.workspace = true
omicron-workspace-hack.workspace = true

Expand Down
3 changes: 2 additions & 1 deletion dev-tools/reconfigurator-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ use std::io::BufRead;
use std::io::IsTerminal;
use swrite::{SWrite, swriteln};
use tabled::Tabled;
use tufaceous_artifact::ArtifactVersion;

mod log_capture;

Expand Down Expand Up @@ -463,7 +464,7 @@ enum ImageSourceArgs {
/// the zone image comes from the `install` dataset
InstallDataset,
/// the zone image comes from a specific TUF repo artifact
Artifact { version: semver::Version, hash: ArtifactHash },
Artifact { version: ArtifactVersion, hash: ArtifactHash },
}

impl From<ImageSourceArgs> for BlueprintZoneImageSource {
Expand Down
27 changes: 15 additions & 12 deletions dev-tools/reconfigurator-cli/tests/input/cmds-set-zone-images.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@
load-example --nsleds 1 --ndisks-per-sled 3
blueprint-show 971eeb12-1830-4fa0-a699-98ea0164505c

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

# Set the zone's image source back to the install dataset.
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 install-dataset
blueprint-show f714e6ea-e85a-4d7d-93c2-a018744fe176
blueprint-diff 9766ca20-38d4-4380-b005-e7c43c797e7c f714e6ea-e85a-4d7d-93c2-a018744fe176
blueprint-diff 971eeb12-1830-4fa0-a699-98ea0164505c f714e6ea-e85a-4d7d-93c2-a018744fe176

# Set these zones' image sources back to the install dataset.
blueprint-edit f714e6ea-e85a-4d7d-93c2-a018744fe176 set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 install-dataset
blueprint-edit bb128f06-a2e1-44c1-8874-4f789d0ff896 set-zone-image 72d12821-646d-4296-a081-ef5fb3a0ca24 install-dataset
blueprint-show d9c572a1-a68c-4945-b1ec-5389bd588fe9
blueprint-diff f714e6ea-e85a-4d7d-93c2-a018744fe176 d9c572a1-a68c-4945-b1ec-5389bd588fe9

# test help output
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c help
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image help
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 help
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 set-zone-image help

# test error case: no such zone id
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 126f8db9-b966-45ec-bf89-fb7b41a04cc9 install-dataset
# test error case: bad semver
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact one e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 set-zone-image 126f8db9-b966-45ec-bf89-fb7b41a04cc9 install-dataset
# test error case: invalid version identifier
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact 🫡 5d835e8666bd5cf65be66efbca6847b24e41fd85993448a211ad7be5fea559ab
# test error case: bad hash
blueprint-edit 9766ca20-38d4-4380-b005-e7c43c797e7c set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact 1.2.3 aaaa
blueprint-edit d9c572a1-a68c-4945-b1ec-5389bd588fe9 set-zone-image 026f8db9-b966-45ec-bf89-fb7b41a04cc9 artifact 1.2.3 aaaa
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: invalid value 'one' for '<VERSION>': unexpected character 'o' while parsing major version number
error: invalid value '🫡' for '<VERSION>': version contains invalid byte `\xf0` (allowed: ^[a-zA-Z0-9._+-]{1,63}$)

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