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

PHD: improve artifact store #529

Merged
merged 4 commits into from
Sep 27, 2023
Merged

Conversation

gjcolombo
Copy link
Contributor

Rework the PHD artifact store to reduce complexity and add some features:

  • Instead of specifying a single remote URI per downloadable artifact, have the
    artifact manifest specify a list of remote URI bases from which any
    downloadable artifact with the "remote server" source type can be obtained.
  • Instead of having separate tables for guest OS images and bootroms, create one
    table of artifacts whose kinds are distinguished by an enum.
  • Make the store remember whether it has previously verified the hash of an
    extant artifact. This substantially reduces runtime for runs that work with
    large disk images.
  • Add support for a "Propolis server" artifact type. The runner doesn't use this
    yet but will begin making use of this in a future PR. See PHD: want support for migration between distinct Propolis binaries #528.
  • Add support for Buildomat as an artifact source.

Update the PHD README and default artifact file to reflect these changes.

Also convert from PathBuf to camino::Utf8PathBuf in a few places to eliminate
some awkward type conversions.

Rework the PHD artifact store to reduce complexity and add some features:

- Instead of specifying a single remote URI per downloadable artifact, have the
  artifact manifest specify a list of remote URI bases from which any
  downloadable artifact with the "remote server" source type can be obtained.
- Instead of having separate tables for guest OS images and bootroms, create one
  table of artifacts whose kinds are distinguished by an enum.
- Make the store remember whether it has previously verified the hash of an
  extant artifact. This substantially reduces runtime for tests that work with
  large disk images.
- Add support for a "Propolis server" artifact type. The runner doesn't use this
  yet but will begin making use of this in a future PR.

Update the PHD README and default artifact file to reflect these changes.

Also convert from PathBuf to camino::Utf8PathBuf in a few places to eliminate
some awkward type conversions.
This is a slightly nicer way to avoid dropping the inner artifact store error
when a store lookup fails.
@gjcolombo gjcolombo requested a review from pfmooney September 23, 2023 20:07
# Remote artifacts are required to specify an expected SHA256 digest as a
# string.
[artifacts.alpine.source.remote_server]
sha256 = "alpine_digest"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the digest fields, maybe have fake data which at least resembles (in length) a sha256.

show me your war face

sha256 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'

Comment on lines 5 to 16
use crate::guest_os::GuestOsKind;

use super::{manifest::Manifest, ArtifactSource};
use anyhow::bail;
use camino::{Utf8Path, Utf8PathBuf};
use ring::digest::{Digest, SHA256};
use std::collections::BTreeMap;
use std::fs::File;
use std::io::{BufReader, Read, Seek, SeekFrom, Write};
use std::sync::Mutex;
use std::time::Duration;
use tracing::info;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small style nit: group the crate-local (crate:: and super::), std, and cargo imports together in their own sections to stay consistent the rest of the existing style?

@gjcolombo gjcolombo merged commit 2c26ecd into master Sep 27, 2023
10 checks passed
@gjcolombo gjcolombo deleted the gjcolombo/phd-artifact-rework branch September 27, 2023 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants