Skip to content

Commit 6570fc6

Browse files
authored
Revert "Add basic measurement checking via sprockets" (#8676)
This reverts commit f897585. See #8675 for context.
1 parent 5a60421 commit 6570fc6

File tree

42 files changed

+388
-862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+388
-862
lines changed

Cargo.lock

Lines changed: 150 additions & 232 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ slog-term = "2.9.1"
710710
smf = "0.2"
711711
socket2 = { version = "0.5", features = ["all"] }
712712
sp-sim = { path = "sp-sim" }
713-
sprockets-tls = { git = "https://github.com/oxidecomputer/sprockets.git", rev = "7b63ccb979288408fb772aa6d15f4a324497c754" }
713+
sprockets-tls = { git = "https://github.com/oxidecomputer/sprockets.git", rev = "6d31fa63217c6a51061dc4afa1ebe175a0021981" }
714714
sqlformat = "0.3.5"
715715
sqlparser = { version = "0.45.0", features = [ "visitor" ] }
716716
static_assertions = "1.1.0"

dev-tools/reconfigurator-cli/tests/output/cmds-mupdate-update-flow-stdout

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ INFO added artifact, name: internal-dns, kind: zone, version: 1.0.0, hash: ffbf1
3636
INFO added artifact, name: ntp, kind: zone, version: 1.0.0, hash: 67593d686ed04a1709f93972b71f4ebc148a9362120f65d239943e814a9a7439, length: 1681
3737
INFO added artifact, name: nexus, kind: zone, version: 1.0.0, hash: 0e32b4a3e5d3668bb1d6a16fb06b74dc60b973fa479dcee0aae3adbb52bf1388, length: 1682
3838
INFO added artifact, name: oximeter, kind: zone, version: 1.0.0, hash: 048d8fe8cdef5b175aad714d0f148aa80ce36c9114ac15ce9d02ed3d37877a77, length: 1682
39-
INFO added artifact, name: sp_corpus, kind: measurement_corpus, version: 1.0.0, hash: ac95be27f1d2ef747290b76b83a1e6b162f344451387477b04a0e74bc7be17a6, length: 11913
40-
INFO added artifact, name: rot_corpus, kind: measurement_corpus, version: 1.0.0, hash: 8a354560e17a992a46bc73a37556f0f9c090c570adaa85537ae5994b1986fd50, length: 11913
4139
INFO added artifact, name: fake-psc-sp, kind: psc_sp, version: 1.0.0, hash: f896cf5b19ca85864d470ad8587f980218bff3954e7f52bbd999699cd0f9635b, length: 744
4240
INFO added artifact, name: fake-psc-rot, kind: psc_rot_image_a, version: 1.0.0, hash: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b, length: 750
4341
INFO added artifact, name: fake-psc-rot, kind: psc_rot_image_b, version: 1.0.0, hash: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b, length: 750

dev-tools/reconfigurator-cli/tests/output/cmds-noop-image-source-stdout

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ INFO added artifact, name: internal-dns, kind: zone, version: 1.0.0, hash: ffbf1
5858
INFO added artifact, name: ntp, kind: zone, version: 1.0.0, hash: 67593d686ed04a1709f93972b71f4ebc148a9362120f65d239943e814a9a7439, length: 1681
5959
INFO added artifact, name: nexus, kind: zone, version: 1.0.0, hash: 0e32b4a3e5d3668bb1d6a16fb06b74dc60b973fa479dcee0aae3adbb52bf1388, length: 1682
6060
INFO added artifact, name: oximeter, kind: zone, version: 1.0.0, hash: 048d8fe8cdef5b175aad714d0f148aa80ce36c9114ac15ce9d02ed3d37877a77, length: 1682
61-
INFO added artifact, name: sp_corpus, kind: measurement_corpus, version: 1.0.0, hash: ac95be27f1d2ef747290b76b83a1e6b162f344451387477b04a0e74bc7be17a6, length: 11913
62-
INFO added artifact, name: rot_corpus, kind: measurement_corpus, version: 1.0.0, hash: 8a354560e17a992a46bc73a37556f0f9c090c570adaa85537ae5994b1986fd50, length: 11913
6361
INFO added artifact, name: fake-psc-sp, kind: psc_sp, version: 1.0.0, hash: f896cf5b19ca85864d470ad8587f980218bff3954e7f52bbd999699cd0f9635b, length: 744
6462
INFO added artifact, name: fake-psc-rot, kind: psc_rot_image_a, version: 1.0.0, hash: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b, length: 750
6563
INFO added artifact, name: fake-psc-rot, kind: psc_rot_image_b, version: 1.0.0, hash: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b, length: 750
@@ -122,8 +120,6 @@ INFO added artifact, name: internal-dns, kind: zone, version: 2.0.0, hash: de306
122120
INFO added artifact, name: ntp, kind: zone, version: 2.0.0, hash: d76e26198daed69cdae04490d7477f8c842e0dbe37d463eac0d0a8d3fb803095, length: 1682
123121
INFO added artifact, name: nexus, kind: zone, version: 2.0.0, hash: e9b7035f41848a987a798c15ac424cc91dd662b1af0920d58d8aa1ebad7467b6, length: 1683
124122
INFO added artifact, name: oximeter, kind: zone, version: 2.0.0, hash: 9f4bc56a15d5fd943fdac94309994b8fd73aa2be1ec61faf44bfcf2356c9dc23, length: 1683
125-
INFO added artifact, name: sp_corpus, kind: measurement_corpus, version: 2.0.0, hash: aa21cbeece8fa0097024edc347bc85bf2bc4b6cf0cc83eefd1a269856b3e10d1, length: 11914
126-
INFO added artifact, name: rot_corpus, kind: measurement_corpus, version: 2.0.0, hash: 79b9888b01b0cd1110f8733fc85f389c7cf64805c1342b960eb977747c21e016, length: 11914
127123
INFO added artifact, name: fake-psc-sp, kind: psc_sp, version: 2.0.0, hash: 7adf04de523865003dbf120cebddd5fcf5bad650640281b294197e6ca7016e47, length: 748
128124
INFO added artifact, name: fake-psc-rot, kind: psc_rot_image_a, version: 2.0.0, hash: 6d1c432647e9b9e4cf846ff5d17932d75cba49c0d3f23d24243238bc40bcfef5, length: 746
129125
INFO added artifact, name: fake-psc-rot, kind: psc_rot_image_b, version: 2.0.0, hash: 6d1c432647e9b9e4cf846ff5d17932d75cba49c0d3f23d24243238bc40bcfef5, length: 746

dev-tools/reconfigurator-cli/tests/output/cmds-target-release-stdout

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ INFO added artifact, name: internal-dns, kind: zone, version: 1.0.0, hash: ffbf1
5151
INFO added artifact, name: ntp, kind: zone, version: 1.0.0, hash: 67593d686ed04a1709f93972b71f4ebc148a9362120f65d239943e814a9a7439, length: 1681
5252
INFO added artifact, name: nexus, kind: zone, version: 1.0.0, hash: 0e32b4a3e5d3668bb1d6a16fb06b74dc60b973fa479dcee0aae3adbb52bf1388, length: 1682
5353
INFO added artifact, name: oximeter, kind: zone, version: 1.0.0, hash: 048d8fe8cdef5b175aad714d0f148aa80ce36c9114ac15ce9d02ed3d37877a77, length: 1682
54-
INFO added artifact, name: sp_corpus, kind: measurement_corpus, version: 1.0.0, hash: ac95be27f1d2ef747290b76b83a1e6b162f344451387477b04a0e74bc7be17a6, length: 11913
55-
INFO added artifact, name: rot_corpus, kind: measurement_corpus, version: 1.0.0, hash: 8a354560e17a992a46bc73a37556f0f9c090c570adaa85537ae5994b1986fd50, length: 11913
5654
INFO added artifact, name: fake-psc-sp, kind: psc_sp, version: 1.0.0, hash: f896cf5b19ca85864d470ad8587f980218bff3954e7f52bbd999699cd0f9635b, length: 744
5755
INFO added artifact, name: fake-psc-rot, kind: psc_rot_image_a, version: 1.0.0, hash: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b, length: 750
5856
INFO added artifact, name: fake-psc-rot, kind: psc_rot_image_b, version: 1.0.0, hash: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b, length: 750
@@ -91,8 +89,6 @@ target release (generation 2): 1.0.0 (system-update-v1.0.0.zip)
9189
artifact: 67593d686ed04a1709f93972b71f4ebc148a9362120f65d239943e814a9a7439 zone (ntp version 1.0.0)
9290
artifact: 0e32b4a3e5d3668bb1d6a16fb06b74dc60b973fa479dcee0aae3adbb52bf1388 zone (nexus version 1.0.0)
9391
artifact: 048d8fe8cdef5b175aad714d0f148aa80ce36c9114ac15ce9d02ed3d37877a77 zone (oximeter version 1.0.0)
94-
artifact: ac95be27f1d2ef747290b76b83a1e6b162f344451387477b04a0e74bc7be17a6 measurement_corpus (sp_corpus version 1.0.0)
95-
artifact: 8a354560e17a992a46bc73a37556f0f9c090c570adaa85537ae5994b1986fd50 measurement_corpus (rot_corpus version 1.0.0)
9692
artifact: f896cf5b19ca85864d470ad8587f980218bff3954e7f52bbd999699cd0f9635b psc_sp (fake-psc-sp version 1.0.0)
9793
artifact: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b psc_rot_image_a (fake-psc-rot version 1.0.0)
9894
artifact: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b psc_rot_image_b (fake-psc-rot version 1.0.0)
@@ -170,8 +166,6 @@ target release (generation 2): 1.0.0 (system-update-v1.0.0.zip)
170166
artifact: 67593d686ed04a1709f93972b71f4ebc148a9362120f65d239943e814a9a7439 zone (ntp version 1.0.0)
171167
artifact: 0e32b4a3e5d3668bb1d6a16fb06b74dc60b973fa479dcee0aae3adbb52bf1388 zone (nexus version 1.0.0)
172168
artifact: 048d8fe8cdef5b175aad714d0f148aa80ce36c9114ac15ce9d02ed3d37877a77 zone (oximeter version 1.0.0)
173-
artifact: ac95be27f1d2ef747290b76b83a1e6b162f344451387477b04a0e74bc7be17a6 measurement_corpus (sp_corpus version 1.0.0)
174-
artifact: 8a354560e17a992a46bc73a37556f0f9c090c570adaa85537ae5994b1986fd50 measurement_corpus (rot_corpus version 1.0.0)
175169
artifact: f896cf5b19ca85864d470ad8587f980218bff3954e7f52bbd999699cd0f9635b psc_sp (fake-psc-sp version 1.0.0)
176170
artifact: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b psc_rot_image_a (fake-psc-rot version 1.0.0)
177171
artifact: 179eb660ebc92e28b6748b6af03d9f998d6131319edd4654a1e948454c62551b psc_rot_image_b (fake-psc-rot version 1.0.0)

dev-tools/releng/src/hubris.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,6 @@ pub(crate) async fn fetch_hubris_artifacts(
3838

3939
fs::create_dir_all(&output_dir).await?;
4040

41-
// We need to remove our old downloaded corpus to make sure nothing else
42-
// gets added to the repo unexpectedly. This should only really be a
43-
// issue with local builds
44-
if std::fs::exists(&output_dir.join("measurement_corpus"))
45-
.context("failed to check `measurement_corpus`")?
46-
{
47-
std::fs::remove_dir_all(&output_dir.join("measurement_corpus"))
48-
.context("failed to remove `measurement_corpus")?;
49-
}
50-
fs::create_dir_all(&output_dir.join("measurement_corpus"))
51-
.await
52-
.context("Failed to create `measurement_corpus`")?;
53-
5441
// This could be parallelized with FuturesUnordered but in practice this
5542
// takes less time than OS builds.
5643

@@ -119,22 +106,6 @@ pub(crate) async fn fetch_hubris_artifacts(
119106
}
120107
}
121108
}
122-
if let Some(corpus) = hash_manifest.corpus {
123-
let hash = match corpus {
124-
Source::File(file) => file.hash,
125-
_ => anyhow::bail!(
126-
"Unexpected file type: should be a single file, not an RoT"
127-
),
128-
};
129-
let data =
130-
fetch_hash(&logger, base_url, &client, &hash).await?;
131-
fs::write(
132-
output_dir.join("measurement_corpus").join(hash),
133-
data,
134-
)
135-
.await
136-
.context("failed to write file {hash}")?;
137-
}
138109
}
139110
}
140111

@@ -189,9 +160,6 @@ async fn fetch_hash(
189160
struct Manifest {
190161
#[serde(rename = "artifact")]
191162
artifacts: HashMap<KnownArtifactKind, Vec<Artifact>>,
192-
// Add a default for backwards compatibility
193-
#[serde(rename = "measurement_corpus")]
194-
corpus: Option<Source>,
195163
}
196164

197165
#[derive(Deserialize)]

dev-tools/releng/src/tuf.rs

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,6 @@ pub(crate) async fn build_tuf_repo(
7272
}
7373
}
7474

75-
let mut measurement_corpus = vec![];
76-
77-
for entry in std::fs::read_dir(
78-
output_dir.join("hubris-staging").join("measurement_corpus"),
79-
)
80-
.context("failed to read `hubris-staging/measurement_corpus")?
81-
{
82-
let entry = entry?;
83-
measurement_corpus.push(DeserializedControlPlaneZoneSource::File {
84-
file_name: Some(format!(
85-
"{}.cbor",
86-
entry.file_name().into_string().unwrap()
87-
)),
88-
path: Utf8PathBuf::from_path_buf(entry.path()).unwrap(),
89-
});
90-
}
91-
92-
for entry in std::fs::read_dir(
93-
output_dir.join("hubris-production").join("measurement_corpus"),
94-
)
95-
.context("failed to read `hubris-production/measurement_corpus")?
96-
{
97-
let entry = entry?;
98-
measurement_corpus.push(DeserializedControlPlaneZoneSource::File {
99-
file_name: Some(format!(
100-
"{}.cbor",
101-
entry.file_name().into_string().unwrap()
102-
)),
103-
path: Utf8PathBuf::from_path_buf(entry.path()).unwrap(),
104-
});
105-
}
106-
10775
// Add the OS images.
10876
manifest.artifacts.insert(
10977
KnownArtifactKind::Host,
@@ -143,16 +111,12 @@ pub(crate) async fn build_tuf_repo(
143111
.join(format!("{}.tar.gz", package)),
144112
});
145113
}
146-
147114
manifest.artifacts.insert(
148115
KnownArtifactKind::ControlPlane,
149116
vec![DeserializedArtifactData {
150117
name: "control-plane".to_string(),
151118
version: artifact_version.clone(),
152-
source: DeserializedArtifactSource::CompositeControlPlane {
153-
zones,
154-
measurement_corpus,
155-
},
119+
source: DeserializedArtifactSource::CompositeControlPlane { zones },
156120
}],
157121
);
158122

installinator-common/src/progress.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ pub enum WriteError {
251251
#[source]
252252
error: Box<NestedEngineError<ControlPlaneZonesSpec>>,
253253
},
254-
#[error("error creating directory: {error}")]
255-
CreateDirError { error: std::io::Error },
256254
}
257255

258256
impl From<NestedEngineError<ControlPlaneZonesSpec>> for WriteError {
@@ -299,12 +297,6 @@ pub enum ControlPlaneZonesStepId {
299297
/// Writing the MUPdate override file.
300298
MupdateOverride,
301299

302-
/// Creating Measurement directory
303-
CreateMeasurementDir,
304-
305-
/// Writing a measurement corpus
306-
MeasurementCorpus { name: String },
307-
308300
/// Writing the zone manifest.
309301
ZoneManifest,
310302

installinator/src/write.rs

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -777,58 +777,6 @@ impl ControlPlaneZoneWriteContext<'_> {
777777
.register();
778778
}
779779

780-
engine
781-
.new_step(
782-
WriteComponent::ControlPlane,
783-
ControlPlaneZonesStepId::CreateMeasurementDir,
784-
"Creating measurement directory".to_string(),
785-
async move |_cx| {
786-
if !std::fs::exists(
787-
self.output_directory.join("measurements"),
788-
)
789-
.map_err(|error| WriteError::CreateDirError { error })?
790-
{
791-
std::fs::create_dir(
792-
self.output_directory.join("measurements"),
793-
)
794-
.map_err(|error| {
795-
WriteError::CreateDirError { error }
796-
})?;
797-
}
798-
StepSuccess::new(()).into()
799-
},
800-
)
801-
.register();
802-
803-
for (name, data) in &self.zones.measurement_corpus {
804-
let out_path =
805-
self.output_directory.join("measurements").join(name);
806-
transport = engine
807-
.new_step(
808-
WriteComponent::ControlPlane,
809-
ControlPlaneZonesStepId::MeasurementCorpus {
810-
name: name.clone(),
811-
},
812-
format!("Writing measurement corpus {name}"),
813-
async move |cx| {
814-
let transport = transport.into_value(cx.token()).await;
815-
write_artifact_impl(
816-
WriteComponent::ControlPlane,
817-
slot,
818-
data.clone().into(),
819-
&out_path,
820-
transport,
821-
&cx,
822-
)
823-
.await?;
824-
825-
StepSuccess::new(transport).into()
826-
},
827-
)
828-
.register();
829-
}
830-
831-
// XXX here is where we can write the corpus
832780
// `fsync()` the directory to ensure the directory entries for all the
833781
// files we just created are written to disk.
834782
let output_directory = self.output_directory.to_path_buf();
@@ -1179,12 +1127,10 @@ mod tests {
11791127
data1: Vec<Vec<u8>>,
11801128
#[strategy(prop::collection::vec(prop::collection::vec(any::<u8>(), 0..8192), 0..16))]
11811129
data2: Vec<Vec<u8>>,
1182-
#[strategy(prop::collection::vec(prop::collection::vec(any::<u8>(), 0..8192), 0..16))]
1183-
data3: Vec<Vec<u8>>,
11841130
#[strategy(WriteOps::strategy())] write_ops: WriteOps,
11851131
) {
11861132
with_test_runtime(async move {
1187-
proptest_write_artifact_impl(data1, data2, data3, write_ops)
1133+
proptest_write_artifact_impl(data1, data2, write_ops)
11881134
.await
11891135
.expect("test failed");
11901136
})
@@ -1263,7 +1209,6 @@ mod tests {
12631209
async fn proptest_write_artifact_impl(
12641210
data1: Vec<Vec<u8>>,
12651211
data2: Vec<Vec<u8>>,
1266-
data3: Vec<Vec<u8>>,
12671212
write_ops: WriteOps,
12681213
) -> Result<()> {
12691214
let logctx = test_setup_log("test_write_artifact");
@@ -1274,15 +1219,10 @@ mod tests {
12741219
let destination_control_plane =
12751220
tempdir_path.join("test-control-plane.bin");
12761221

1277-
let destination_corpus =
1278-
tempdir_path.join("measurements").join("test-corpus.bin");
1279-
12801222
let mut artifact_host: BufList =
12811223
data1.into_iter().map(Bytes::from).collect();
12821224
let mut artifact_control_plane: BufList =
12831225
data2.into_iter().map(Bytes::from).collect();
1284-
let mut artifact_corpus: BufList =
1285-
data3.into_iter().map(Bytes::from).collect();
12861226

12871227
let host_id = ArtifactHashId {
12881228
kind: ArtifactKind::HOST_PHASE_2,
@@ -1347,10 +1287,6 @@ mod tests {
13471287
destination_control_plane.file_name().unwrap().to_string(),
13481288
artifact_control_plane.iter().flatten().copied().collect(),
13491289
)],
1350-
measurement_corpus: vec![(
1351-
destination_corpus.file_name().unwrap().to_string(),
1352-
artifact_corpus.iter().flatten().copied().collect(),
1353-
)],
13541290
};
13551291

13561292
let mut writer = ArtifactWriter::new(
@@ -1482,30 +1418,6 @@ mod tests {
14821418
.copy_to_bytes(artifact_control_plane.num_bytes());
14831419
assert_eq!(buf, bytes, "bytes written to disk match");
14841420

1485-
// Read the corpus artifact from disk and ensure it is correct.
1486-
let mut file = tokio::fs::File::open(&destination_corpus)
1487-
.await
1488-
.with_context(|| {
1489-
format!(
1490-
"failed to open {destination_corpus} to verify contents"
1491-
)
1492-
})?;
1493-
let mut buf = Vec::with_capacity(artifact_corpus.num_bytes());
1494-
let read_num_bytes =
1495-
file.read_to_end(&mut buf).await.with_context(|| {
1496-
format!(
1497-
"failed to read {destination_control_plane} into memory"
1498-
)
1499-
})?;
1500-
assert_eq!(
1501-
read_num_bytes,
1502-
artifact_corpus.num_bytes(),
1503-
"read num_bytes matches"
1504-
);
1505-
1506-
let bytes = artifact_corpus.copy_to_bytes(artifact_corpus.num_bytes());
1507-
assert_eq!(buf, bytes, "bytes written to disk match");
1508-
15091421
logctx.cleanup_successful();
15101422
Ok(())
15111423
}

nexus/reconfigurator/planning/src/mgs_updates/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,7 @@ fn try_make_update_sp(
418418
| KnownArtifactKind::SwitchRot
419419
| KnownArtifactKind::GimletRotBootloader
420420
| KnownArtifactKind::PscRotBootloader
421-
| KnownArtifactKind::SwitchRotBootloader
422-
| KnownArtifactKind::MeasurementCorpus,
421+
| KnownArtifactKind::SwitchRotBootloader,
423422
) => false,
424423
}
425424
})

0 commit comments

Comments
 (0)