Skip to content
Draft
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
49 changes: 26 additions & 23 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ clap-verbosity-flag = "3.0.4"
clap_complete = "4.5.59"
clap_complete_nushell = "4.5.9"
fuzzy-matcher = "0.3.7"
jsonschema = "0.30.0"
jsonschema = "0.37.4"
open = "5.3.2"
os_info = "3.12.0"
requestty = { version = "0.6.1", features = ["macros", "termion"] }
Expand Down Expand Up @@ -123,6 +123,7 @@ vendored-libgit2 = ["dep:git2", "git2/vendored-libgit2"]
rusty-hook = "0.11"

rstest.workspace = true
pretty_assertions.workspace = true

[build-dependencies]
git2 = { version = "0.20.0", default-features = false, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ build-full:
WITH DOCKER
RUN --secret BB_PASSWORD=github/registry bluebuild build --push -S sigstore -vv recipes/recipe.yml
END

switch:
FROM +test-base

Expand Down
14 changes: 14 additions & 0 deletions src/bin/bluebuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ use log::LevelFilter;
fn main() {
let args = BlueBuildArgs::parse();

miette::set_hook(Box::new(|_| {
Box::new(
miette::MietteHandlerOpts::new()
.terminal_links(true)
.context_lines(3)
.tab_width(2)
.break_words(false)
.wrap_lines(false)
.with_cause_chain()
.build(),
)
}))
.expect("Should set hook for miette");

Logger::new()
.filter_level(args.verbosity.log_level_filter())
.filter_modules([
Expand Down
18 changes: 5 additions & 13 deletions src/commands/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub struct ValidateCommand {
/// bluebuild repository.
pub recipe: PathBuf,

/// DEPRECATED
///
/// Display all errors that failed
/// validation of the recipe.
#[arg(short, long)]
Expand Down Expand Up @@ -104,21 +106,11 @@ impl BlueBuildCommand for ValidateCommand {
impl ValidateCommand {
async fn setup_validators(&mut self) -> Result<(), Report> {
let (rv, sv, mv, mslv) = tokio::try_join!(
SchemaValidator::builder()
.url(RECIPE_V1_SCHEMA_URL)
.all_errors(self.all_errors)
.build(),
SchemaValidator::builder()
.url(STAGE_V1_SCHEMA_URL)
.all_errors(self.all_errors)
.build(),
SchemaValidator::builder()
.url(MODULE_V1_SCHEMA_URL)
.all_errors(self.all_errors)
.build(),
SchemaValidator::builder().url(RECIPE_V1_SCHEMA_URL).build(),
SchemaValidator::builder().url(STAGE_V1_SCHEMA_URL).build(),
SchemaValidator::builder().url(MODULE_V1_SCHEMA_URL).build(),
SchemaValidator::builder()
.url(MODULE_STAGE_LIST_V1_SCHEMA_URL)
.all_errors(self.all_errors)
.build(),
)?;
self.recipe_validator = Some(rv);
Expand Down
14 changes: 13 additions & 1 deletion src/commands/validate/location.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
use jsonschema::paths::{LazyLocation, Location as JsonLocation};
use serde::Deserialize;

#[derive(Debug, Default, Clone, PartialEq, Eq)]
#[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Location(JsonLocation);

impl<'de> Deserialize<'de> for Location {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
String::deserialize(deserializer)?
.try_into()
.map_err(serde::de::Error::custom)
}
}

impl std::ops::Deref for Location {
type Target = JsonLocation;

Expand Down
Loading
Loading