From e5dbcf2da3b0ade34f9e1fe8f722bea126caf46c Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Sat, 22 Aug 2026 16:02:49 -0400 Subject: [PATCH] chore(jsonschema): Upgrade jsonschema --- Cargo.lock | 143 +++- Cargo.toml | 2 +- src/commands/validate.rs | 25 +- src/commands/validate/evaluation.rs | 252 ++++++ src/commands/validate/schema_validator.rs | 387 +++------ .../validate/schema_validator/error.rs | 14 +- src/commands/validate/yaml_span.rs | 44 +- test-files/recipes/module-list-pass.yml | 228 +++--- test-files/recipes/modules/chezmoi-fail.yml | 6 +- .../recipes/modules/default-flatpaks-fail.yml | 6 +- .../recipes/modules/default-flatpaks-pass.yml | 2 +- test-files/recipes/modules/script-fail.yml | 2 +- test-files/recipes/stage-list-fail.yml | 3 +- test-files/recipes/stage-list-pass.yml | 4 +- test-files/recipes/stage-pass.yml | 3 +- test-files/schema/import-v1.json | 26 +- test-files/schema/module-custom-v1.json | 219 ++++- test-files/schema/module-list-v1.json | 51 +- test-files/schema/module-stage-list-v1.json | 72 +- test-files/schema/module-v1.json | 229 +++--- test-files/schema/modules/akmods-latest.json | 316 +++++-- test-files/schema/modules/akmods-v1.json | 316 +++++-- test-files/schema/modules/apk-latest.json | 247 ++++++ test-files/schema/modules/apk-v1.json | 247 ++++++ test-files/schema/modules/apt-latest.json | 247 ++++++ test-files/schema/modules/apt-v1.json | 247 ++++++ test-files/schema/modules/bling-latest.json | 289 +++++-- test-files/schema/modules/bling-v1.json | 289 +++++-- test-files/schema/modules/brew-latest.json | 313 +++++-- test-files/schema/modules/brew-v1.json | 313 +++++-- test-files/schema/modules/chezmoi-latest.json | 319 ++++++-- test-files/schema/modules/chezmoi-v1.json | 319 ++++++-- .../schema/modules/containerfile-latest.json | 250 +++++- .../schema/modules/containerfile-v1.json | 250 +++++- test-files/schema/modules/copy-latest.json | 250 +++++- test-files/schema/modules/copy-v1.json | 250 +++++- .../modules/default-flatpaks-latest.json | 340 ++++++-- .../schema/modules/default-flatpaks-v1.json | 311 +++++-- .../schema/modules/default-flatpaks-v2.json | 273 +++++++ .../schema/modules/default-flatpaks.json | 12 + test-files/schema/modules/dnf-latest.json | 771 ++++++++++++++++++ test-files/schema/modules/dnf-v1.json | 771 ++++++++++++++++++ test-files/schema/modules/files-latest.json | 284 +++++-- test-files/schema/modules/files-v1.json | 284 +++++-- test-files/schema/modules/fonts-latest.json | 290 ++++++- test-files/schema/modules/fonts-v1.json | 290 ++++++- .../modules/gnome-extensions-latest.json | 265 +++++- .../schema/modules/gnome-extensions-v1.json | 265 +++++- .../modules/gschema-overrides-latest.json | 237 +++++- .../schema/modules/gschema-overrides-v1.json | 237 +++++- .../schema/modules/initramfs-latest.json | 210 +++++ test-files/schema/modules/initramfs-v1.json | 210 +++++ .../schema/modules/justfiles-latest.json | 252 +++++- test-files/schema/modules/justfiles-v1.json | 252 +++++- test-files/schema/modules/kargs-latest.json | 222 +++++ test-files/schema/modules/kargs-v1.json | 222 +++++ .../schema/modules/os-release-latest.json | 215 +++++ test-files/schema/modules/os-release-v1.json | 215 +++++ test-files/schema/modules/pacman-latest.json | 247 ++++++ test-files/schema/modules/pacman-v1.json | 247 ++++++ .../schema/modules/rpm-ostree-latest.json | 341 ++++++-- test-files/schema/modules/rpm-ostree-v1.json | 341 ++++++-- test-files/schema/modules/script-latest.json | 239 +++++- test-files/schema/modules/script-v1.json | 239 +++++- test-files/schema/modules/script-v2.json | 224 +++++ test-files/schema/modules/signing-latest.json | 223 ++++- test-files/schema/modules/signing-v1.json | 223 ++++- test-files/schema/modules/soar-latest.json | 225 +++++ test-files/schema/modules/soar-v1.json | 225 +++++ test-files/schema/modules/systemd-latest.json | 317 +++++-- test-files/schema/modules/systemd-v1.json | 317 +++++-- test-files/schema/modules/yafti-latest.json | 246 +++++- test-files/schema/modules/yafti-v1.json | 246 +++++- test-files/schema/modules/zypper-latest.json | 247 ++++++ test-files/schema/modules/zypper-v1.json | 247 ++++++ test-files/schema/recipe-v1.json | 217 +++-- test-files/schema/recipe-v2.json | 218 +++++ test-files/schema/recipe.json | 12 + test-files/schema/stage-list-v1.json | 51 +- test-files/schema/stage-v1.json | 112 +-- utils/src/constants.rs | 3 +- 81 files changed, 15209 insertions(+), 2406 deletions(-) create mode 100644 src/commands/validate/evaluation.rs create mode 100644 test-files/schema/modules/apk-latest.json create mode 100644 test-files/schema/modules/apk-v1.json create mode 100644 test-files/schema/modules/apt-latest.json create mode 100644 test-files/schema/modules/apt-v1.json create mode 100644 test-files/schema/modules/default-flatpaks-v2.json create mode 100644 test-files/schema/modules/default-flatpaks.json create mode 100644 test-files/schema/modules/dnf-latest.json create mode 100644 test-files/schema/modules/dnf-v1.json create mode 100644 test-files/schema/modules/initramfs-latest.json create mode 100644 test-files/schema/modules/initramfs-v1.json create mode 100644 test-files/schema/modules/kargs-latest.json create mode 100644 test-files/schema/modules/kargs-v1.json create mode 100644 test-files/schema/modules/os-release-latest.json create mode 100644 test-files/schema/modules/os-release-v1.json create mode 100644 test-files/schema/modules/pacman-latest.json create mode 100644 test-files/schema/modules/pacman-v1.json create mode 100644 test-files/schema/modules/script-v2.json create mode 100644 test-files/schema/modules/soar-latest.json create mode 100644 test-files/schema/modules/soar-v1.json create mode 100644 test-files/schema/modules/zypper-latest.json create mode 100644 test-files/schema/modules/zypper-v1.json create mode 100644 test-files/schema/recipe-v2.json create mode 100644 test-files/schema/recipe.json diff --git a/Cargo.lock b/Cargo.lock index 14e91f86..6ace2df5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1278,6 +1278,12 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b1e3a325bc115f096c8b77bbf027a7c2592230e70be2d985be950d3d5e60ebe" +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + [[package]] name = "decoded-char" version = "0.1.1" @@ -1629,9 +1635,9 @@ dependencies = [ [[package]] name = "fancy-regex" -version = "0.14.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e24cb5a94bcae1e5408b0effca5cd7172ea3c5755049c5f3af4cd283a165298" +checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f" dependencies = [ "bit-set", "regex-automata", @@ -1640,9 +1646,9 @@ dependencies = [ [[package]] name = "fancy-regex" -version = "0.16.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f" +checksum = "476de73bddf2ef8490aa4ee8f1cf40b430bf1d56c48c22080e5186952cd580e6" dependencies = [ "bit-set", "regex-automata", @@ -1701,9 +1707,9 @@ dependencies = [ [[package]] name = "fluent-uri" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1918b65d96df47d3591bed19c5cca17e3fa5d0707318e4b5ef2eae01764df7e5" +checksum = "bc74ac4d8359ae70623506d512209619e5cf8f347124910440dbc221714b328e" dependencies = [ "borrow-or-share", "ref-cast", @@ -1739,12 +1745,12 @@ dependencies = [ [[package]] name = "fraction" -version = "0.15.4" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076045bb43dac435333ed5f04caf35c7463631d0dae2deb2638d94dd0a5b872" +checksum = "33fee0259ffdc3d7bd64438b6b08437884d4df5700f9cb8a23b079c3958ae578" dependencies = [ - "lazy_static", "num", + "num-bigint", ] [[package]] @@ -1902,9 +1908,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 5.3.0", "wasip2", + "wasm-bindgen", ] [[package]] @@ -1993,6 +2001,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c0e8a181239723652be9062bb56ca5bf5f64011f73b623f6f4fc59086a228" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.14.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -2030,6 +2057,8 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ + "allocator-api2", + "equivalent", "foldhash 0.2.0", ] @@ -2145,6 +2174,7 @@ dependencies = [ "bytes", "futures-channel", "futures-core", + "h2", "http", "http-body", "httparse", @@ -2651,31 +2681,58 @@ dependencies = [ [[package]] name = "jsonschema" -version = "0.30.0" +version = "0.50.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b46a0365a611fbf1d2143104dcf910aada96fafd295bab16c60b802bf6fa1d" +checksum = "29b6bb4e22283b09119c671e57ac6a185e9a0c70c31585e56b729b626d877753" dependencies = [ "ahash 0.8.12", - "base64 0.22.1", "bytecount", + "data-encoding", "email_address", - "fancy-regex 0.14.0", + "fancy-regex 0.19.0", "fraction", + "getrandom 0.3.4", "idna", "itoa", + "jsonschema-regex", + "jsonschema-value", "num-cmp", "num-traits", - "once_cell", "percent-encoding", "referencing", "regex", - "regex-syntax", - "reqwest 0.12.28", + "reqwest 0.13.4", + "rustls", "serde", "serde_json", + "strum 0.28.0", + "unicode-general-category", "uuid-simd", ] +[[package]] +name = "jsonschema-regex" +version = "0.50.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497fbf3b1ca53b1e23a253f636e88e7a2031387388b8140199a0f240fcadf647" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "jsonschema-value" +version = "0.50.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84ca3f39446973a810fc90fc2645ada8c24284f6deb009c78b776813973887d" +dependencies = [ + "ahash 0.8.12", + "bytecount", + "fraction", + "num-cmp", + "num-traits", + "serde_json", +] + [[package]] name = "jsonwebtoken" version = "10.4.0" @@ -3012,6 +3069,12 @@ version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" +[[package]] +name = "micromap" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a86d3146ed3995b5913c414f6664344b9617457320782e64f0bb44afd49d74" + [[package]] name = "miette" version = "7.6.0" @@ -3521,8 +3584,8 @@ dependencies = [ "regex", "serde", "serde_json", - "strum", - "strum_macros", + "strum 0.27.2", + "strum_macros 0.27.2", "thiserror 2.0.20", ] @@ -3538,8 +3601,8 @@ dependencies = [ "regex", "serde", "serde_json", - "strum", - "strum_macros", + "strum 0.27.2", + "strum_macros 0.27.2", "thiserror 2.0.20", ] @@ -4324,13 +4387,16 @@ dependencies = [ [[package]] name = "referencing" -version = "0.30.0" +version = "0.50.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8eff4fa778b5c2a57e85c5f2fe3a709c52f0e60d23146e2151cbef5893f420e" +checksum = "7a0a32a2a2c2d7dd0ee54705b5fd641be73037271928f68e9b0e7205b71c9d30" dependencies = [ "ahash 0.8.12", "fluent-uri", - "once_cell", + "getrandom 0.3.4", + "hashbrown 0.17.1", + "itoa", + "micromap", "parking_lot", "percent-encoding", "serde_json", @@ -4463,8 +4529,10 @@ checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" dependencies = [ "base64 0.22.1", "bytes", + "futures-channel", "futures-core", "futures-util", + "h2", "http", "http-body", "http-body-util", @@ -5346,6 +5414,15 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros 0.28.0", +] + [[package]] name = "strum_macros" version = "0.27.2" @@ -5358,6 +5435,18 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "subtle" version = "2.6.1" @@ -5694,6 +5783,7 @@ dependencies = [ "bytes", "futures-core", "futures-sink", + "libc", "pin-project-lite", "tokio", ] @@ -5882,6 +5972,12 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + [[package]] name = "unicode-ident" version = "1.0.24" @@ -6025,7 +6121,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b082222b4f6619906941c17eb2297fff4c2fb96cb60164170522942a200bd8" dependencies = [ "outref", - "uuid", "vsimd", ] diff --git a/Cargo.toml b/Cargo.toml index 0d278ce7..7220258e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,7 +81,7 @@ clap-verbosity-flag = "=3.0.4" clap_complete = "=4.6.9" clap_complete_nushell = "=4.6.2" fuzzy-matcher = "=0.3.7" -jsonschema = "=0.30.0" +jsonschema = "=0.50.1" open = "=5.4.1" os_info = "=3.15.0" requestty = { version = "=0.6.3", features = ["macros", "termion"] } diff --git a/src/commands/validate.rs b/src/commands/validate.rs index 152e4812..d2a2121b 100644 --- a/src/commands/validate.rs +++ b/src/commands/validate.rs @@ -24,7 +24,7 @@ use serde_json::Value; use super::BlueBuildCommand; -mod location; +mod evaluation; mod schema_validator; mod yaml_span; @@ -41,6 +41,7 @@ pub struct ValidateCommand { /// validation of the recipe. #[arg(short, long)] #[builder(default)] + #[cfg(not(feature = "v1_0_0"))] pub all_errors: bool, #[clap(skip)] @@ -64,6 +65,11 @@ impl BlueBuildCommand for ValidateCommand { bail!("File {recipe_path_display} must exist"); } + #[cfg(not(feature = "v1_0_0"))] + if self.all_errors { + log::warn!("--all-errors is deprecated and no longer does anything"); + } + ASYNC_RUNTIME .block_on(self.setup_validators()) .wrap_err("Failed to setup validators")?; @@ -78,6 +84,7 @@ impl BlueBuildCommand for ValidateCommand { )?; let main_err = format!("Recipe {recipe_path_display} failed to validate"); + #[cfg(not(feature = "v1_0_0"))] if self.all_errors { return Err(miette!("{errors}").context(main_err)); } @@ -104,21 +111,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); diff --git a/src/commands/validate/evaluation.rs b/src/commands/validate/evaluation.rs new file mode 100644 index 00000000..ebac9f82 --- /dev/null +++ b/src/commands/validate/evaluation.rs @@ -0,0 +1,252 @@ +use std::{ + collections::{BTreeMap, BTreeSet}, + ops::Not, +}; + +use jsonschema::{ValidationError, error::ValidationErrorKind, paths::Location}; +use serde::{Deserialize, Deserializer}; + +#[cfg(not(test))] +use log::debug; + +#[cfg(test)] +use std::eprintln as debug; + +#[derive(Debug, Clone, Deserialize)] +pub struct EvaluationList { + pub details: Vec, +} + +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct EvaluationDetail { + pub valid: bool, + + #[serde(deserialize_with = "location")] + pub instance_location: Location, + + #[serde(deserialize_with = "location")] + pub schema_location: Location, + + #[serde(deserialize_with = "location")] + pub evaluation_path: Location, +} + +fn location<'de, D>(des: D) -> Result +where + D: Deserializer<'de>, +{ + let val = String::deserialize(des)?; + let mut split = val.split('/'); + split.next(); + Ok(split.fold(Location::new(), |loc, seg| loc.join(seg))) +} + +impl EvaluationList { + // pub fn filter_errors<'slice, 'error>( + // &self, + // errs: &'slice [&'slice ValidationError<'error>], + // ) -> Vec<&'slice ValidationError<'error>> { + // errs.iter().flat_map(|err| self.all_errs(err)).collect() + // } + + pub fn all_errs<'slice, 'error>( + &self, + err: &'slice ValidationError<'error>, + ) -> Vec<&'slice ValidationError<'error>> { + // debug!("Checking instance path: {}", err.instance_path()); + match err.kind() { + ValidationErrorKind::OneOfNotValid { context } + | ValidationErrorKind::AnyOf { context } => { + // debug!("Context size: {}", context.len()); + let indexes = self.find_closest_indexes(context, err); + // debug!("Closest indexes: {indexes:?}"); + indexes + .into_iter() + .flat_map(|index| { + // debug!("Checking index {index}"); + let errs = &context[index]; + // debug!("Error count: {}", errs.len()); + + errs.iter().flat_map(|err| self.all_errs(err)) + }) + .collect() + } + _ => vec![err], + } + } + + // fn flatten<'slice, 'error>( + // &self, + // errs: &'slice [ValidationError<'error>], + // out: &'slice mut Vec<&'slice ValidationError<'error>>, + // ) { + // for err in errs {} + // } + + // fn full_len(&self, err: &ValidationError<'_>) -> usize { + // match err.kind() { + // ValidationErrorKind::AnyOf { context } + // | ValidationErrorKind::OneOfNotValid { context } => context + // [self.find_closest_index(context)] + // .iter() + // .map(|err| self.full_len(err)) + // .sum(), + // _ => 1, + // } + // } + + fn find_closest_indexes( + &self, + context: &Vec>>, + parent: &ValidationError, + ) -> Vec { + // We must only enter this function if + assert!( + matches!( + parent.kind(), + ValidationErrorKind::AnyOf { .. } | ValidationErrorKind::OneOfNotValid { .. } + ), + "Must be evaluating anyOf or oneOf" + ); + + let scores = context + .iter() + .enumerate() + // Get the alternate const score and error count + .map(|(index, errs)| { + let eval_path = &parent.evaluation_path().join(index); + let details = self.matching_details(eval_path, parent.instance_path()); + dbg!(&details); + let total = details.len(); + let fail_count = details.iter().filter(|detail| !detail.valid).count(); + debug!("Instance path: {}", parent.instance_path()); + debug!("Eval path: {eval_path}"); + debug!("Total detail count: {total}"); + debug!("Total detail fail count: {fail_count}"); + debug!("Total error count: {}", errs.len()); + + let score = self.error_scoring(parent, errs); + + (index, score) + }) + // Push all indexes with the same score together + .fold( + BTreeMap::>::new(), + |mut acc, (index, score)| { + acc.entry(score) + .and_modify(|stack| { + stack.push(index); + }) + .or_insert_with(|| vec![index]); + acc + }, + ); + debug!("Scores for {}", parent.instance_path()); + debug!("{scores:#?}"); + + scores + .into_iter() + // Find the indexes with the lowest scores + .min_by(|(score1, _), (score2, _)| score1.cmp(score2)) + .map(|set| { + debug!( + "Found minimum for {} at {}", + parent.evaluation_path(), + parent.instance_path() + ); + debug!("{set:#?}"); + set.1 + }) + .inspect(|indexes| { + for index in indexes { + assert!( + *index < context.len(), + "Returned index must always be in the bounds of the context" + ); + } + }) + .unwrap_or_default() + } + + fn error_scoring(&self, parent: &ValidationError<'_>, errs: &[ValidationError<'_>]) -> usize { + assert!( + matches!( + parent.kind(), + ValidationErrorKind::AnyOf { .. } | ValidationErrorKind::OneOfNotValid { .. } + ), + "Must be evaluating anyOf or oneOf" + ); + let mut score = 0; + + for err in errs { + // debug!("Checking for alternative constant count for {err:#?}"); + // debug!("Instance path: {}", err.instance_path()); + // debug!("Evaluation path: {}", err.evaluation_path()); + + match err.kind() { + ValidationErrorKind::Constant { .. } => { + let details = self + .matching_details(parent.evaluation_path(), err.instance_path()) + .into_iter() + .filter(|detail| { + detail.evaluation_path.as_str().ends_with("/const") && detail.valid + }) + .collect::>(); + // debug!("Matching details:\n{details:#?}"); + if details.is_empty().not() { + score += details.len(); + } + } + ValidationErrorKind::AnyOf { context } + | ValidationErrorKind::OneOfNotValid { context } => { + score += self + .find_closest_indexes(context, err) + .into_iter() + .map(|index| self.error_scoring(err, &context[index])) + .sum::(); + } + _ => { + // score += 1; + // debug!("Isn't a kind to check against"); + } + } + } + score + } + + fn matching_details( + &self, + evaluation_path: &Location, + instance_path: &Location, + ) -> Vec<&EvaluationDetail> { + self.details + .iter() + .filter(|detail| { + detail + .evaluation_path + .as_str() + .starts_with(evaluation_path.as_str()) + && detail + .instance_location + .as_str() + .starts_with(instance_path.as_str()) + }) + .collect() + } + + // fn is_full_failure(&self, err: &ValidationError) -> bool { + // self.details + // .iter() + // .filter(|detail| &detail.instance_location == err.instance_path()) + // .filter(|detail| { + // &detail.schema_location == err.schema_path() + // && matches!( + // err.kind(), + // jsonschema::error::ValidationErrorKind::AnyOf { .. } + // | jsonschema::error::ValidationErrorKind::OneOfNotValid { .. } + // ) + // }) + // .all(|detail| !detail.valid) + // } +} diff --git a/src/commands/validate/schema_validator.rs b/src/commands/validate/schema_validator.rs index fac92b4c..1f22499d 100644 --- a/src/commands/validate/schema_validator.rs +++ b/src/commands/validate/schema_validator.rs @@ -1,32 +1,27 @@ use std::{ - collections::HashSet, + collections::{BTreeSet, HashSet}, path::Path, - sync::{Arc, LazyLock}, + slice::Iter, + sync::Arc, }; use blue_build_process_management::ASYNC_RUNTIME; -use blue_build_recipe::ModuleTypeVersion; -use blue_build_utils::constants::{ - CUSTOM_MODULE_SCHEMA, IMPORT_MODULE_SCHEMA, JSON_SCHEMA, STAGE_SCHEMA, -}; use bon::bon; use cached::cached; use colored::Colorize; -use indexmap::IndexMap; -use jsonschema::{BasicOutput, Retrieve, Uri, ValidationError, Validator}; -use miette::{Context, IntoDiagnostic, LabeledSpan, NamedSource}; -use regex::Regex; +use jsonschema::{Retrieve, Uri, ValidationError, Validator, error::ValidationErrorKind}; +use miette::{Context, IntoDiagnostic, LabeledSpan, NamedSource, Report, SourceSpan}; use serde_json::Value; -use super::{location::Location, yaml_span::YamlSpan}; +use crate::commands::validate::evaluation::EvaluationList; + +use super::yaml_span::YamlSpan; #[cfg(test)] use std::eprintln as trace; -#[cfg(test)] -use std::eprintln as warn; #[cfg(not(test))] -use log::{trace, warn}; +use log::trace; mod error; @@ -35,8 +30,8 @@ pub use error::*; #[derive(Debug, Clone)] pub struct SchemaValidator { validator: Arc, + // schema: Arc, url: &'static str, - all_errors: bool, } #[bon] @@ -45,12 +40,9 @@ impl SchemaValidator { pub async fn new( /// The URL of the schema to validate against url: &'static str, - /// Produce all errors found - #[builder(default)] - all_errors: bool, ) -> Result { tokio::spawn(async move { - let schema: Value = { + let schema: Arc = Arc::new({ #[cfg(not(test))] { reqwest::get(url) @@ -64,7 +56,7 @@ impl SchemaValidator { { serde_json::from_slice(std::fs::read_to_string(url)?.as_bytes())? } - }; + }); let validator = Arc::new( tokio::task::spawn_blocking({ let schema = schema.clone(); @@ -82,8 +74,8 @@ impl SchemaValidator { Ok(Self { validator, + // schema, url, - all_errors, }) }) .await @@ -115,11 +107,32 @@ impl SchemaValidator { .map_err(|e| SchemaValidateError::SerdeYaml(e, path.to_path_buf()))?; trace!("{recipe_path_display}:\n{file}"); - Ok(if self.all_errors { - process_basic_output(self.validator.apply(&instance).basic(), &spanner) - } else { - process_err(self.validator.iter_errors(&instance), &spanner) - }) + let eval = self.validator.evaluate(&instance); + let list: EvaluationList = serde_json::to_value(eval.list()) + // .inspect(|list| { + // dbg!(list); + // }) + .and_then(serde_json::from_value) + .unwrap(); + // dbg!(&list); + + let errors = self.validator.iter_errors(&instance).collect::>(); + let errors = errors + .iter() + .flat_map(|err| list.all_errs(err)) + .map(|err| { + ( + err.masked().to_string(), + spanner.get_span(err.instance_path()).unwrap(), + ) + }) + .collect::>(); + // dbg!(&errors); + let errors = errors + .into_iter() + .map(|(label, span)| LabeledSpan::new_primary_with_span(Some(label), span)) + .collect(); + Ok(errors) } fn spans_to_report( @@ -144,171 +157,6 @@ impl SchemaValidator { } } -fn process_basic_output(out: BasicOutput<'_>, spanner: &YamlSpan) -> Vec { - match out { - BasicOutput::Valid(_) => Vec::new(), - BasicOutput::Invalid(errors) => { - let errors = { - let mut e = errors.into_iter().collect::>(); - e.sort_by(|e1, e2| { - e1.instance_location() - .as_str() - .cmp(e2.instance_location().as_str()) - }); - e - }; - let errors: Vec<(Location, String)> = { - let e = errors - .into_iter() - .map(|e| { - ( - Location::from(e.instance_location()), - remove_json(&e.error_description().to_string()), - ) - }) - .collect::>(); - let mut e = e.into_iter().collect::>(); - e.sort_by(|e1, e2| e1.0.as_str().cmp(e2.0.as_str())); - e - }; - - let mut collection: IndexMap> = IndexMap::new(); - - for (instance_path, err) in errors { - collection - .entry(instance_path) - .and_modify(|errs| { - errs.push(format!("- {}", err.bold().red())); - }) - .or_insert_with(|| vec![format!("- {}", err.bold().red())]); - } - - collection - .into_iter() - .map(|(key, value)| { - LabeledSpan::new_with_span( - Some(value.into_iter().collect::>().join("\n")), - spanner.get_span(&key).unwrap(), - ) - }) - .collect() - } - } -} - -fn process_err<'a, I>(errors: I, spanner: &YamlSpan) -> Vec -where - I: Iterator>, -{ - errors - .flat_map(|err| process_anyof_error(&err).unwrap_or_else(|| vec![err])) - .map(|err| { - let masked_err = err.masked(); - LabeledSpan::new_primary_with_span( - Some(masked_err.to_string().bold().red().to_string()), - spanner - .get_span(&Location::from(err.instance_path)) - .unwrap(), - ) - }) - .collect() -} - -fn process_anyof_error(err: &ValidationError<'_>) -> Option>> { - trace!("to_processed_module_err({err:#?})"); - let ValidationError { - instance, - kind, - instance_path, - schema_path: _, - } = err; - - let mut path_iter = instance_path.into_iter(); - let uri = match (kind, path_iter.next_back(), path_iter.next_back()) { - ( - jsonschema::error::ValidationErrorKind::AnyOf, - Some(jsonschema::paths::LocationSegment::Index(_)), - Some(jsonschema::paths::LocationSegment::Property("modules")), - ) => { - trace!("FOUND MODULE ANYOF ERROR at {instance_path}"); - if instance.get("source").is_some() { - Uri::parse(CUSTOM_MODULE_SCHEMA.to_string()).ok()? - } else if instance.get("from-file").is_some() { - Uri::parse(IMPORT_MODULE_SCHEMA.to_string()).ok()? - } else { - let typ = instance.get("type").and_then(Value::as_str)?; - let typ = ModuleTypeVersion::from(typ); - trace!("Module type: {typ}"); - Uri::parse(format!( - "{JSON_SCHEMA}/modules/{}-{}.json", - typ.typ(), - typ.version().unwrap_or("latest") - )) - .ok()? - } - } - ( - jsonschema::error::ValidationErrorKind::AnyOf, - Some(jsonschema::paths::LocationSegment::Index(_)), - Some(jsonschema::paths::LocationSegment::Property("stages")), - ) => { - trace!("FOUND STAGE ANYOF ERROR at {instance_path}"); - - if instance.get("from-file").is_some() { - Uri::parse(IMPORT_MODULE_SCHEMA.to_string()).ok()? - } else { - Uri::parse(STAGE_SCHEMA.to_string()).ok()? - } - } - _ => return None, - }; - - trace!("Schema URI: {uri}"); - let schema = ASYNC_RUNTIME.block_on(cache_retrieve(&uri)).ok()?; - - let validator = jsonschema::options() - .with_retriever(ModuleSchemaRetriever) - .build(&schema) - .inspect_err(|e| warn!("{e:#?}")) - .ok()?; - - Some( - validator - .iter_errors(instance) - .flat_map(|err| process_anyof_error(&err).unwrap_or_else(|| vec![err])) - .map(|err| { - let mut err = err.to_owned(); - err.instance_path = instance_path - .into_iter() - .chain(&err.instance_path) - .collect(); - err - }) - .inspect(|errs| { - trace!("From error: {err:#?}\nTo error list: {errs:#?}"); - }) - .collect(), - ) -} - -fn remove_json(string: &S) -> String -where - S: ToString, -{ - static REGEX_OBJECT: LazyLock = LazyLock::new(|| Regex::new(r"^\{.*\}\s(.*)$").unwrap()); - static REGEX_ARRAY: LazyLock = LazyLock::new(|| Regex::new(r"^\[.*\]\s(.*)$").unwrap()); - - let string = string.to_string(); - - if REGEX_OBJECT.is_match(&string) { - REGEX_OBJECT.replace_all(string.trim(), "$1").into_owned() - } else if REGEX_ARRAY.is_match(&string) { - REGEX_ARRAY.replace_all(string.trim(), "$1").into_owned() - } else { - string - } -} - struct ModuleSchemaRetriever; impl Retrieve for ModuleSchemaRetriever { @@ -316,86 +164,87 @@ impl Retrieve for ModuleSchemaRetriever { &self, uri: &Uri, ) -> Result> { - Ok(ASYNC_RUNTIME.block_on(cache_retrieve(uri))?) - } -} - -#[cached( - key = "String", - convert = r#"{ format!("{uri}") }"#, - sync_writes = "by_key" -)] -async fn cache_retrieve(uri: &Uri) -> miette::Result { - let scheme = uri.scheme(); - let path = uri.path(); - - #[cfg(not(test))] - { - use blue_build_utils::constants::SCHEMA_BASE_URL; - - let uri = match scheme.as_str() { - "json-schema" => { - format!("{SCHEMA_BASE_URL}{path}") - } - "https" => uri.to_string(), - scheme => miette::bail!("Unknown scheme {scheme}"), - }; - let client = reqwest::Client::new(); - - log::debug!("Retrieving schema from {}", uri.bold().italic()); - tokio::spawn(blue_build_utils::retry_async( - 3, - std::time::Duration::from_secs(2), - async move || { - let response = client - .get(&*uri) - .timeout(std::time::Duration::from_secs(10)) - .send() - .await - .into_diagnostic() - .with_context(|| format!("Failed to retrieve schema from {uri}"))?; - let raw_output = response.bytes().await.into_diagnostic()?; - serde_json::from_slice(&raw_output) - .into_diagnostic() - .with_context(|| { - format!( - "Failed to parse json from {uri}, contents:\n{}", - String::from_utf8_lossy(&raw_output) - ) - }) - .inspect(|value| trace!("{}:\n{value}", uri.bold().italic())) - }, - )) - .await - .expect("Should join task") - } - - #[cfg(test)] - { - let uri = match scheme.as_str() { - "json-schema" | "https" => { - format!("test-files/schema/{path}") + #[cached( + key = "String", + convert = r#"{ format!("{uri}") }"#, + sync_writes = "by_key" + )] + async fn inner(uri: &Uri) -> miette::Result { + let scheme = uri.scheme(); + let path = uri.path(); + + #[cfg(not(test))] + { + use blue_build_utils::constants::SCHEMA_BASE_URL; + + let uri = match scheme.as_str() { + "json-schema" => { + format!("{SCHEMA_BASE_URL}{path}") + } + "https" => uri.to_string(), + scheme => miette::bail!("Unknown scheme {scheme}"), + }; + let client = reqwest::Client::new(); + + log::debug!("Retrieving schema from {}", uri.bold().italic()); + tokio::spawn(blue_build_utils::retry_async( + 3, + std::time::Duration::from_secs(2), + async move || { + let response = client + .get(&*uri) + .timeout(std::time::Duration::from_secs(10)) + .send() + .await + .into_diagnostic() + .with_context(|| format!("Failed to retrieve schema from {uri}"))?; + let raw_output = response.bytes().await.into_diagnostic()?; + serde_json::from_slice(&raw_output) + .into_diagnostic() + .with_context(|| { + format!( + "Failed to parse json from {uri}, contents:\n{}", + String::from_utf8_lossy(&raw_output) + ) + }) + .inspect(|value| trace!("{}:\n{value}", uri.bold().italic())) + }, + )) + .await + .expect("Should join task") } - _ => unreachable!(), - }; - async { - serde_json::from_slice( - std::fs::read_to_string(uri) + #[cfg(test)] + { + let uri = match scheme.as_str() { + "json-schema" | "https" => { + format!("test-files/schema/{path}") + } + _ => unreachable!(), + }; + + async { + serde_json::from_slice( + std::fs::read_to_string(uri) + .into_diagnostic() + .context("Failed retrieving sub-schema")? + .as_bytes(), + ) .into_diagnostic() - .context("Failed retrieving sub-schema")? - .as_bytes(), - ) - .into_diagnostic() - .context("Failed deserializing sub-schema") + .context("Failed deserializing sub-schema") + } + .await + } } - .await + + Ok(ASYNC_RUNTIME.block_on(inner(uri))?) } } #[cfg(test)] mod test { use blue_build_process_management::ASYNC_RUNTIME; + use pretty_assertions::assert_eq; use rstest::rstest; use super::*; @@ -468,7 +317,7 @@ mod test { )] #[case::script( "test-files/recipes/modules/script-pass.yml", - "test-files/schema/modules/script-v1.json" + "test-files/schema/modules/script-v2.json" )] #[case::signing( "test-files/recipes/modules/signing-pass.yml", @@ -534,7 +383,7 @@ mod test { #[case::chezmoi( "test-files/recipes/modules/chezmoi-fail.yml", "test-files/schema/modules/chezmoi-v1.json", - 3 + 4 )] #[case::containerfile( "test-files/recipes/modules/containerfile-fail.yml", @@ -583,7 +432,7 @@ mod test { )] #[case::script( "test-files/recipes/modules/script-fail.yml", - "test-files/schema/modules/script-v1.json", + "test-files/schema/modules/script-v2.json", 2 )] #[case::signing( @@ -609,19 +458,23 @@ mod test { let file_contents = Arc::new(std::fs::read_to_string(file).unwrap()); let result = validator.process_validation(file, file_contents); - dbg!(&result); + // dbg!(&result); assert!(result.is_err()); + let result = result.unwrap_err(); let SchemaValidateError::YamlValidate { src: _, labels, help: _, - } = result.unwrap_err() + } = &result else { panic!("Wrong error"); }; + let label_count = labels.len(); + + eprintln!("{:?}", result.into_report()); - assert_eq!(labels.len(), err_count); + assert_eq!(label_count, err_count); } } diff --git a/src/commands/validate/schema_validator/error.rs b/src/commands/validate/schema_validator/error.rs index 9b988c63..d9509306 100644 --- a/src/commands/validate/schema_validator/error.rs +++ b/src/commands/validate/schema_validator/error.rs @@ -1,7 +1,7 @@ use std::{path::PathBuf, sync::Arc}; use colored::Colorize; -use miette::{Diagnostic, LabeledSpan, NamedSource}; +use miette::{Diagnostic, LabeledSpan, NamedSource, Report}; use thiserror::Error; use crate::commands::validate::yaml_span::YamlSpanError; @@ -28,6 +28,12 @@ pub enum SchemaValidateBuilderError { JsonSchemaBuild(String, jsonschema::ValidationError<'static>), } +impl SchemaValidateBuilderError { + pub fn into_report(self) -> Report { + self.into() + } +} + #[derive(Error, Diagnostic, Debug)] pub enum SchemaValidateError { #[error("Failed to deserialize file {}", .1.display().to_string().bold().italic())] @@ -55,3 +61,9 @@ pub enum SchemaValidateError { #[diagnostic(transparent)] YamlSpan(#[from] YamlSpanError), } + +impl SchemaValidateError { + pub fn into_report(self) -> Report { + self.into() + } +} diff --git a/src/commands/validate/yaml_span.rs b/src/commands/validate/yaml_span.rs index 804f1872..96ee2a9b 100644 --- a/src/commands/validate/yaml_span.rs +++ b/src/commands/validate/yaml_span.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use bon::bon; -use jsonschema::paths::LocationSegment; +use jsonschema::paths::{Location, LocationSegment}; use miette::SourceSpan; use yaml_rust2::{ Event, @@ -10,14 +10,12 @@ use yaml_rust2::{ scanner::Marker, }; -#[cfg(not(test))] +// #[cfg(not(test))] use log::{debug, trace}; -#[cfg(test)] -use std::eprintln as trace; -#[cfg(test)] -use std::eprintln as debug; - -use super::location::Location; +// #[cfg(test)] +// use std::eprintln as trace; +// #[cfg(test)] +// use std::eprintln as debug; mod error; @@ -106,14 +104,14 @@ where document_start = true; } Event::MappingStart(_, _) if stream_start && document_start => { - break self.key(key)?.into(); + break self.key(&key)?.into(); } event => return Err(YamlSpanError::UnexpectedEvent(event.to_owned())), } }) } - fn key(&mut self, expected_key: LocationSegment<'_>) -> Result<(usize, usize), YamlSpanError> { + fn key(&mut self, expected_key: &LocationSegment<'_>) -> Result<(usize, usize), YamlSpanError> { trace!("Looking for location {expected_key:?}"); loop { @@ -122,13 +120,13 @@ where match (event, expected_key) { (Event::Scalar(key, _, _, _), LocationSegment::Property(expected_key)) - if key == expected_key => + if key == &**expected_key => { trace!("Found matching key '{key}'"); break self.value(); } (Event::Scalar(key, _, _, _), LocationSegment::Property(expected_key)) - if key != expected_key => + if key != &**expected_key => { trace!("Non-matching key '{key}'"); let (event, marker) = self.events.next().unwrap(); @@ -143,11 +141,11 @@ where (Event::Scalar(key, _, _, _), LocationSegment::Index(index)) => { return Err(YamlSpanError::ExpectIndexFoundKey { key: key.to_owned(), - index, + index: *index, }); } (Event::SequenceStart(_, _), LocationSegment::Index(index)) => { - break self.sequence(index, 0); + break self.sequence(*index, 0); } (Event::SequenceStart(_, _), _) => { self.skip_sequence(marker.index()); @@ -229,7 +227,7 @@ where let index = marker.index(); (index, self.skip_mapping(index) - index) } - Some(key) => self.key(key)?, + Some(key) => self.key(&key)?, } } Event::SequenceStart(_, _) if index > curr_index => { @@ -243,7 +241,7 @@ where let index = marker.index(); (index, self.skip_sequence(index) - index) } - Some(key) => self.key(key)?, + Some(key) => self.key(&key)?, } } event => unreachable!("{event:?}"), @@ -265,7 +263,7 @@ where }); } (Event::MappingStart(_, _), Some(LocationSegment::Property(key))) => { - self.key(LocationSegment::Property(key))? + self.key(&LocationSegment::Property(key))? } (Event::MappingStart(_, _), None) => { let index = marker.index(); @@ -287,16 +285,20 @@ where mod test { use std::sync::Arc; + use jsonschema::paths::Location; use miette::{LabeledSpan, miette}; use rstest::rstest; - use crate::commands::validate::location::Location; - use super::YamlSpan; const RECIPE: &str = include_str!("../../../test-files/recipes/recipe-pass.yml"); const RECIPE_INVALID: &str = include_str!("../../../test-files/recipes/recipe-fail.yml"); + fn build_location(path: &str) -> Location { + path.split('/') + .fold(Location::new(), |loc, segment| loc.join(segment)) + } + #[rstest] #[case("test: value", "", (0, 1))] #[case("test: value", "/test", (6, 5))] @@ -308,7 +310,7 @@ mod test { fn test_getspan(#[case] file: &str, #[case] path: &str, #[case] expected: (usize, usize)) { dbg!(path, expected); let file = Arc::new(file.to_owned()); - let location = Location::try_from(path).unwrap(); + let location = build_location(path); dbg!(&location); let collector = YamlSpan::builder().file(file.clone()).build().unwrap(); @@ -332,7 +334,7 @@ mod test { #[case(RECIPE, "/modules/13")] fn test_getspan_err(#[case] file: &str, #[case] path: &str) { let file = Arc::new(file.to_owned()); - let location = Location::try_from(path).unwrap(); + let location = build_location(path); dbg!(&location); let collector = YamlSpan::builder().file(file).build().unwrap(); diff --git a/test-files/recipes/module-list-pass.yml b/test-files/recipes/module-list-pass.yml index 5744cb9e..2b7002b2 100644 --- a/test-files/recipes/module-list-pass.yml +++ b/test-files/recipes/module-list-pass.yml @@ -1,120 +1,120 @@ --- # yaml-language-server: $schema=https://schema.blue-build.org/module-list-v1.json modules: -- type: akmods - base: main - install: - - openrgb -- type: bling - install: - - rpmfusion -- type: brew - auto-update: true - update-interval: "6h" - auto-upgrade: true - update-wait-after-boot: "10min" - upgrade-interval: "8h" - upgrade-wait-after-boot: "30min" - nofile-limits: true - brew-analytics: false -- type: chezmoi - repository: 'test-repo.git' - branch: 'main' - all-users: false - run-every: "1d" - wait-after-boot: "5m" - disable-init: false - disable-update: false - file-conflict-policy: replace -- type: containerfile - snippets: - - RUN echo "Hello!" - containerfiles: - - test -- type: copy - from: test-stage - src: /out/test - dest: /in/test -- type: default-flatpaks - notify: false - system: - repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo - repo-name: flathub - repo-title: test-user + - type: akmods + base: main install: - - test.org - remove: - - bad-test.org - user: - repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo - repo-name: flathub - repo-title: test-user + - openrgb + - type: bling + install: + - rpmfusion + - type: brew + auto-update: true + update-interval: "6h" + auto-upgrade: true + update-wait-after-boot: "10min" + upgrade-interval: "8h" + upgrade-wait-after-boot: "30min" + nofile-limits: true + brew-analytics: false + - type: chezmoi + repository: "test-repo.git" + branch: "main" + all-users: false + run-every: "1d" + wait-after-boot: "5m" + disable-init: false + disable-update: false + file-conflict-policy: replace + - type: containerfile + snippets: + - RUN echo "Hello!" + containerfiles: + - test + - type: copy + from: test-stage + src: /out/test + dest: /in/test + - type: default-flatpaks@v1 + notify: false + system: + repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo + repo-name: flathub + repo-title: test-user + install: + - test.org + remove: + - bad-test.org + user: + repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo + repo-name: flathub + repo-title: test-user + install: + - test.org + remove: + - bad-test.org + - type: files + files: + - source: test + destination: /usr + - type: fonts + fonts: + nerd-fonts: + - "JetbrainsMono" + google-fonts: + - "Test" + - type: gnome-extensions + install: + - test + uninstall: + - rmtest + - type: gschema-overrides + include: + - test + - type: justfiles + validate: true + include: + - ./justfile + - type: rpm-ostree + repos: + - test.repo + keys: + - test.key + optfix: + - test install: - - test.org + - test remove: - - bad-test.org -- type: files - files: - - source: test - destination: /usr -- type: fonts - fonts: - nerd-fonts: - - "JetbrainsMono" - google-fonts: - - "Test" -- type: gnome-extensions - install: - - test - uninstall: - - rmtest -- type: gschema-overrides - include: - - test -- type: justfiles - validate: true - include: - - ./justfile -- type: rpm-ostree - repos: - - test.repo - keys: - - test.key - optfix: - - test - install: - - test - remove: - - rmtest - replace: - - from-repo: updates - packages: - - replacetest -- type: script - snippets: - - rm -fr /* - scripts: - - test.sh -- type: signing -- type: systemd - system: - enabled: - - test.service - disabled: - - disable-test.service - masked: - - masked-test.service - unmasked: - - unmasked-test.service - user: - enabled: - - test.service - disabled: - - disable-test.service - masked: - - masked-test.service - unmasked: - - unmasked-test.service -- type: yafti - custom-flatpaks: - - PrettyTest: test.org + - rmtest + replace: + - from-repo: updates + packages: + - replacetest + - type: script + snippets: + - rm -fr /* + scripts: + - test.sh + - type: signing + - type: systemd + system: + enabled: + - test.service + disabled: + - disable-test.service + masked: + - masked-test.service + unmasked: + - unmasked-test.service + user: + enabled: + - test.service + disabled: + - disable-test.service + masked: + - masked-test.service + unmasked: + - unmasked-test.service + - type: yafti + custom-flatpaks: + - PrettyTest: test.org diff --git a/test-files/recipes/modules/chezmoi-fail.yml b/test-files/recipes/modules/chezmoi-fail.yml index dbaf6e03..8dcf5600 100644 --- a/test-files/recipes/modules/chezmoi-fail.yml +++ b/test-files/recipes/modules/chezmoi-fail.yml @@ -1,8 +1,8 @@ --- -# yaml-language-server: $schema=https://schema.blue-build.org/modules/chezmoi.json +# yaml-language-server: $schema=https://schema.blue-build.org/modules/chezmoi-v1.json type: chezmoi -repository: 'test-repo.git' -branch: 'main' +repository: "test-repo.git" +branch: "main" all-users: "true" run-every: "1d" wait-after-boot: "5m" diff --git a/test-files/recipes/modules/default-flatpaks-fail.yml b/test-files/recipes/modules/default-flatpaks-fail.yml index 7c240b84..e72eb879 100644 --- a/test-files/recipes/modules/default-flatpaks-fail.yml +++ b/test-files/recipes/modules/default-flatpaks-fail.yml @@ -1,7 +1,7 @@ --- -# yaml-language-server: $schema=https://schema.blue-build.org/modules/default-flatpaks.json -type: default-flatpaks -notify: 'false' +# yaml-language-server: $schema=https://schema.blue-build.org/modules/default-flatpaks-v1.json +type: default-flatpaks@v1 +notify: "false" system: repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo repo-name: diff --git a/test-files/recipes/modules/default-flatpaks-pass.yml b/test-files/recipes/modules/default-flatpaks-pass.yml index 38f8e28e..c50fae64 100644 --- a/test-files/recipes/modules/default-flatpaks-pass.yml +++ b/test-files/recipes/modules/default-flatpaks-pass.yml @@ -1,6 +1,6 @@ --- # yaml-language-server: $schema=https://schema.blue-build.org/modules/default-flatpaks.json -type: default-flatpaks +type: default-flatpaks@v1 notify: false system: repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo diff --git a/test-files/recipes/modules/script-fail.yml b/test-files/recipes/modules/script-fail.yml index 04b80cc7..6f038149 100644 --- a/test-files/recipes/modules/script-fail.yml +++ b/test-files/recipes/modules/script-fail.yml @@ -1,5 +1,5 @@ --- -# yaml-language-server: $schema=https://schema.blue-build.org/modules/script.json +# yaml-language-server: $schema=../../schema/modules/script-v2.json type: script snippets: rm -fr /* scripts: test.sh diff --git a/test-files/recipes/stage-list-fail.yml b/test-files/recipes/stage-list-fail.yml index 77190fa7..e583f759 100644 --- a/test-files/recipes/stage-list-fail.yml +++ b/test-files/recipes/stage-list-fail.yml @@ -1,6 +1,6 @@ --- # yaml-language-server: $schema=https://schema.blue-build.org/stage-list-v1.json -stages: +stages: - from: test name: - test @@ -8,4 +8,3 @@ stages: type: script snippets: - echo test - diff --git a/test-files/recipes/stage-list-pass.yml b/test-files/recipes/stage-list-pass.yml index a98dc209..7c4e203e 100644 --- a/test-files/recipes/stage-list-pass.yml +++ b/test-files/recipes/stage-list-pass.yml @@ -1,6 +1,6 @@ --- -# yaml-language-server: $schema=https://schema.blue-build.org/stage-list-v1.json -stages: +# yaml-language-server: $schema=../schema/stage-list-v1.json +stages: - from: test name: test modules: diff --git a/test-files/recipes/stage-pass.yml b/test-files/recipes/stage-pass.yml index 48a720a6..12e1c9f9 100644 --- a/test-files/recipes/stage-pass.yml +++ b/test-files/recipes/stage-pass.yml @@ -1,5 +1,6 @@ --- -# yaml-language-server: $schema=https://schema.blue-build.org/stage-v1.json +# yaml-language-server: $schema=https://oneof-fix.schema-e29.pages.dev/stage-v1.json +# yaml#-language-server: $schema=https://schema.blue-build.org/stage-v1.json from: test name: test modules: diff --git a/test-files/schema/import-v1.json b/test-files/schema/import-v1.json index ce17361f..2999143b 100644 --- a/test-files/schema/import-v1.json +++ b/test-files/schema/import-v1.json @@ -1,15 +1,15 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "import-v1.json", - "type": "object", - "properties": { - "from-file": { - "type": "string", - "description": "The path to another file containing module configuration to import here.\nhttps://blue-build.org/how-to/multiple-files/" - } - }, - "required": [ - "from-file" - ], - "additionalProperties": false + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "import-v1.json", + "type": "object", + "properties": { + "from-file": { + "type": "string", + "description": "The path to another file containing module configuration to import here.\nhttps://blue-build.org/how-to/multiple-files/" + } + }, + "required": [ + "from-file" + ], + "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/module-custom-v1.json b/test-files/schema/module-custom-v1.json index d2fa4053..f5bfd9e5 100644 --- a/test-files/schema/module-custom-v1.json +++ b/test-files/schema/module-custom-v1.json @@ -1,25 +1,202 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "module-custom-v1.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "This is not a built-in module." + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "module-custom-v1.json", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "This is not a built-in module." + }, + "source": { + "type": "string", + "description": "The image ref of the module repository (an OCI image) to pull the module from.\nIf this is a local module, set the value to 'local'.\nhttps://blue-build.org/reference/module/#source-optional" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + } }, - "source": { - "type": "string", - "description": "The image ref of the module repository (an OCI image) to pull the module from.\nIf this is a local module, set the value to 'local'.\nhttps://blue-build.org/reference/module/#source-optional" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "required": [ + "type", + "source" + ], + "additionalProperties": {}, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type", - "source" - ], - "additionalProperties": {} } \ No newline at end of file diff --git a/test-files/schema/module-list-v1.json b/test-files/schema/module-list-v1.json index 634bf4d5..bdea2b95 100644 --- a/test-files/schema/module-list-v1.json +++ b/test-files/schema/module-list-v1.json @@ -1,29 +1,30 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "module-list-v1.json", - "type": "object", - "properties": { - "modules": { - "type": "array", - "items": { - "$ref": "#/$defs/ModuleEntry" - }, - "description": "A list of [modules](https://blue-build.org/reference/module/) that is executed in order. Multiple of the same module can be included.\n\nEach item in this list should have at least a `type:` or be specified to be included from an external file in the `recipes/` directory with `from-file:`." - } - }, - "required": [ - "modules" - ], - "$defs": { - "ModuleEntry": { - "anyOf": [ - { - "$ref": "module-v1.json" - }, - { - "$ref": "import-v1.json" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "module-list-v1.json", + "type": "object", + "properties": { + "modules": { + "type": "array", + "items": { + "$ref": "#/$defs/ModuleEntry" + }, + "description": "A list of [modules](https://blue-build.org/reference/module/) that is executed in order. Multiple of the same module can be included.\n\nEach item in this list should have at least a `type:` or be specified to be included from an external file in the `recipes/` directory with `from-file:`." + } + }, + "required": [ + "modules" + ], + "additionalProperties": false, + "$defs": { + "ModuleEntry": { + "oneOf": [ + { + "$ref": "module-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] } - ] } - } } \ No newline at end of file diff --git a/test-files/schema/module-stage-list-v1.json b/test-files/schema/module-stage-list-v1.json index 1675db4f..0b4755ea 100644 --- a/test-files/schema/module-stage-list-v1.json +++ b/test-files/schema/module-stage-list-v1.json @@ -1,44 +1,44 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "module-stage-list-v1.json", - "type": "object", - "properties": { - "modules": { - "type": "array", - "items": { - "$ref": "#/$defs/ModuleEntry" - }, - "description": "A list of [modules](https://blue-build.org/reference/module/) that is executed in order. Multiple of the same module can be included.\n\nEach item in this list should have at least a `type:` or be specified to be included from an external file in the `recipes/` directory with `from-file:`." - }, - "stages": { - "type": "array", - "items": { - "$ref": "#/$defs/StageEntry" - }, - "description": "A list of [stages](https://blue-build.org/reference/stages/) that are executed before the build of the final image.\nThis is useful for compiling programs from source without polluting the final bootable image." - } - }, - "additionalProperties": false, - "$defs": { - "ModuleEntry": { - "anyOf": [ - { - "$ref": "module-v1.json" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "module-stage-list-v1.json", + "type": "object", + "properties": { + "modules": { + "type": "array", + "items": { + "$ref": "#/$defs/ModuleEntry" + }, + "description": "A list of [modules](https://blue-build.org/reference/module/) that is executed in order. Multiple of the same module can be included.\n\nEach item in this list should have at least a `type:` or be specified to be included from an external file in the `recipes/` directory with `from-file:`." }, - { - "$ref": "import-v1.json" + "stages": { + "type": "array", + "items": { + "$ref": "#/$defs/StageEntry" + }, + "description": "A list of [stages](https://blue-build.org/reference/stages/) that are executed before the build of the final image.\nThis is useful for compiling programs from source without polluting the final bootable image." } - ] }, - "StageEntry": { - "anyOf": [ - { - "$ref": "stage-v1.json" + "additionalProperties": false, + "$defs": { + "ModuleEntry": { + "oneOf": [ + { + "$ref": "module-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] }, - { - "$ref": "import-v1.json" + "StageEntry": { + "oneOf": [ + { + "$ref": "stage-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] } - ] } - } } \ No newline at end of file diff --git a/test-files/schema/module-v1.json b/test-files/schema/module-v1.json index e16fda55..394154db 100644 --- a/test-files/schema/module-v1.json +++ b/test-files/schema/module-v1.json @@ -1,143 +1,102 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "module-v1.json", - "anyOf": [ - { - "$ref": "#/$defs/RepoModule" - }, - { - "$ref": "#/$defs/CustomModule" - } - ], - "$defs": { - "RepoModule": { - "anyOf": [ - { - "$ref": "/modules/akmods-latest.json" - }, - { - "$ref": "/modules/akmods-v1.json" - }, - { - "$ref": "/modules/bling-latest.json" - }, - { - "$ref": "/modules/bling-v1.json" - }, - { - "$ref": "/modules/brew-latest.json" - }, - { - "$ref": "/modules/brew-v1.json" - }, - { - "$ref": "/modules/chezmoi-latest.json" - }, - { - "$ref": "/modules/chezmoi-v1.json" - }, + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "module-v1.json", + "oneOf": [ { - "$ref": "/modules/default-flatpaks-latest.json" + "$ref": "#/$defs/RepoModule" }, { - "$ref": "/modules/default-flatpaks-v1.json" - }, - { - "$ref": "/modules/files-latest.json" - }, - { - "$ref": "/modules/files-v1.json" - }, - { - "$ref": "/modules/fonts-latest.json" - }, - { - "$ref": "/modules/fonts-v1.json" - }, - { - "$ref": "/modules/gnome-extensions-latest.json" - }, - { - "$ref": "/modules/gnome-extensions-v1.json" - }, - { - "$ref": "/modules/gschema-overrides-latest.json" - }, - { - "$ref": "/modules/gschema-overrides-v1.json" - }, - { - "$ref": "/modules/justfiles-latest.json" - }, - { - "$ref": "/modules/justfiles-v1.json" - }, - { - "$ref": "/modules/rpm-ostree-latest.json" - }, - { - "$ref": "/modules/rpm-ostree-v1.json" - }, - { - "$ref": "/modules/script-latest.json" - }, - { - "$ref": "/modules/script-v1.json" - }, - { - "$ref": "/modules/signing-latest.json" - }, - { - "$ref": "/modules/signing-v1.json" - }, - { - "$ref": "/modules/systemd-latest.json" - }, - { - "$ref": "/modules/systemd-v1.json" - }, - { - "$ref": "/modules/yafti-latest.json" - }, - { - "$ref": "/modules/yafti-v1.json" - }, - { - "$ref": "/modules/containerfile-latest.json" - }, - { - "$ref": "/modules/containerfile-v1.json" - }, - { - "$ref": "/modules/copy-latest.json" - }, - { - "$ref": "/modules/copy-v1.json" + "$ref": "module-custom-v1.json" } - ] - }, - "CustomModule": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "This is not a built-in module." - }, - "source": { - "type": "string", - "description": "The image ref of the module repository (an OCI image) to pull the module from.\nIf this is a local module, set the value to 'local'.\nhttps://blue-build.org/reference/module/#source-optional" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + ], + "$defs": { + "RepoModule": { + "oneOf": [ + { + "$ref": "/modules/akmods-v1.json" + }, + { + "$ref": "/modules/apk-v1.json" + }, + { + "$ref": "/modules/apt-v1.json" + }, + { + "$ref": "/modules/bling-v1.json" + }, + { + "$ref": "/modules/brew-v1.json" + }, + { + "$ref": "/modules/chezmoi-v1.json" + }, + { + "$ref": "/modules/default-flatpaks-v1.json" + }, + { + "$ref": "/modules/default-flatpaks-v2.json" + }, + { + "$ref": "/modules/dnf-v1.json" + }, + { + "$ref": "/modules/files-v1.json" + }, + { + "$ref": "/modules/fonts-v1.json" + }, + { + "$ref": "/modules/gnome-extensions-v1.json" + }, + { + "$ref": "/modules/gschema-overrides-v1.json" + }, + { + "$ref": "/modules/initramfs-v1.json" + }, + { + "$ref": "/modules/justfiles-v1.json" + }, + { + "$ref": "/modules/kargs-v1.json" + }, + { + "$ref": "/modules/os-release-v1.json" + }, + { + "$ref": "/modules/pacman-v1.json" + }, + { + "$ref": "/modules/rpm-ostree-v1.json" + }, + { + "$ref": "/modules/script-v2.json" + }, + { + "$ref": "/modules/script-v1.json" + }, + { + "$ref": "/modules/signing-v1.json" + }, + { + "$ref": "/modules/soar-v1.json" + }, + { + "$ref": "/modules/systemd-v1.json" + }, + { + "$ref": "/modules/yafti-v1.json" + }, + { + "$ref": "/modules/zypper-v1.json" + }, + { + "$ref": "/modules/containerfile-v1.json" + }, + { + "$ref": "/modules/copy-v1.json" + } + ] } - }, - "required": [ - "type", - "source" - ], - "additionalProperties": {} } - } } \ No newline at end of file diff --git a/test-files/schema/modules/akmods-latest.json b/test-files/schema/modules/akmods-latest.json index f9aceb57..57231cf8 100644 --- a/test-files/schema/modules/akmods-latest.json +++ b/test-files/schema/modules/akmods-latest.json @@ -1,67 +1,273 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/akmods.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "akmods", - "description": "The akmods module is a tool used for managing and installing kernel modules built by Universal Blue.\nhttps://blue-build.org/reference/modules/akmods/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/akmods-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "akmods" + }, + { + "type": "string", + "const": "akmods@v1" + }, + { + "type": "string", + "const": "akmods@latest" + } + ], + "description": "The akmods module is a tool used for managing and installing kernel modules built by Universal Blue.\nhttps://blue-build.org/reference/modules/akmods/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "base": { + "anyOf": [ + { + "type": "string", + "const": "main" + }, + { + "type": "string", + "const": "asus" + }, + { + "type": "string", + "const": "fsync" + }, + { + "type": "string", + "const": "fsync-ba" + }, + { + "type": "string", + "const": "surface" + }, + { + "type": "string", + "const": "coreos-stable" + }, + { + "type": "string", + "const": "coreos-testing" + }, + { + "type": "string", + "const": "bazzite" + }, + { + "type": "string", + "const": "ogc" + } + ], + "default": "main", + "description": "The kernel your images uses.\n- main: stock Fedora kernel / main and nvidia images\n- asus: asus kernel / asus images\n- fsync: fsync kernel / not used in any Universal Blue images\n- fsync-ba: fsync kernel, stable version / not used in any Universal Blue images\n- surface: surface kernel / surface images\n- coreos-stable: stock CoreOS kernel / uCore stable images\n- coreos-testing: stock CoreOS Testing kernel / uCore testing images\n- bazzite: Bazzite's kernel / bazzite images" + }, + "install": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of akmods to install.\nSee all available akmods here: https://github.com/ublue-os/akmods#kmod-packages" + }, + "nvidia-driver": { + "anyOf": [ + { + "type": "string", + "const": "nvidia" + }, + { + "type": "string", + "const": "nvidia-open" + } + ], + "description": "Nvidia driver to install\n- nvidia : for the old nvidia propietary driver, compatible with Maxwell and newer cards (but not Blackwell)\n- nvidia-open : for the new kernel-open driver, to be used in Turing and newer cards" + } }, - "base": { - "anyOf": [ - { - "type": "string", - "const": "main" + "required": [ + "type", + "install" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } }, - { - "type": "string", - "const": "asus" + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] }, - { - "type": "string", - "const": "fsync" + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false }, - { - "type": "string", - "const": "fsync-ba" + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false }, - { - "type": "string", - "const": "surface" + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false }, - { - "type": "string", - "const": "coreos-stable" + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false }, - { - "type": "string", - "const": "coreos-testing" + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] }, - { - "type": "string", - "const": "bazzite" + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - ], - "default": "main", - "description": "The kernel your images uses.\n- main: stock Fedora kernel / main and nvidia images\n- asus: asus kernel / asus images\n- fsync: fsync kernel / not used in any Universal Blue images\n- fsync-ba: fsync kernel, stable version / not used in any Universal Blue images\n- surface: surface kernel / surface images\n- coreos-stable: stock CoreOS kernel / uCore stable images\n- coreos-testing: stock CoreOS Testing kernel / uCore testing images\n- bazzite: Bazzite's kernel / bazzite images" - }, - "install": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of akmods to install.\nSee all available akmods here: https://github.com/ublue-os/akmods#kmod-packages" } - }, - "required": [ - "type", - "install" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/akmods-v1.json b/test-files/schema/modules/akmods-v1.json index f9aceb57..5fd0c58a 100644 --- a/test-files/schema/modules/akmods-v1.json +++ b/test-files/schema/modules/akmods-v1.json @@ -1,67 +1,273 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/akmods.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "akmods", - "description": "The akmods module is a tool used for managing and installing kernel modules built by Universal Blue.\nhttps://blue-build.org/reference/modules/akmods/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/akmods-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "akmods" + }, + { + "type": "string", + "const": "akmods@v1" + }, + { + "type": "string", + "const": "akmods@latest" + } + ], + "description": "The akmods module is a tool used for managing and installing kernel modules built by Universal Blue.\nhttps://blue-build.org/reference/modules/akmods/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "base": { + "anyOf": [ + { + "type": "string", + "const": "main" + }, + { + "type": "string", + "const": "asus" + }, + { + "type": "string", + "const": "fsync" + }, + { + "type": "string", + "const": "fsync-ba" + }, + { + "type": "string", + "const": "surface" + }, + { + "type": "string", + "const": "coreos-stable" + }, + { + "type": "string", + "const": "coreos-testing" + }, + { + "type": "string", + "const": "bazzite" + }, + { + "type": "string", + "const": "ogc" + } + ], + "default": "main", + "description": "The kernel your images uses.\n- main: stock Fedora kernel / main and nvidia images\n- asus: asus kernel / asus images\n- fsync: fsync kernel / not used in any Universal Blue images\n- fsync-ba: fsync kernel, stable version / not used in any Universal Blue images\n- surface: surface kernel / surface images\n- coreos-stable: stock CoreOS kernel / uCore stable images\n- coreos-testing: stock CoreOS Testing kernel / uCore testing images\n- bazzite: Bazzite's kernel / bazzite images" + }, + "install": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of akmods to install.\nSee all available akmods here: https://github.com/ublue-os/akmods#kmod-packages" + }, + "nvidia-driver": { + "anyOf": [ + { + "type": "string", + "const": "nvidia" + }, + { + "type": "string", + "const": "nvidia-open" + } + ], + "description": "Nvidia driver to install\n- nvidia : for the old nvidia propietary driver, compatible with Maxwell and newer cards (but not Blackwell)\n- nvidia-open : for the new kernel-open driver, to be used in Turing and newer cards" + } }, - "base": { - "anyOf": [ - { - "type": "string", - "const": "main" + "required": [ + "type", + "install" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } }, - { - "type": "string", - "const": "asus" + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] }, - { - "type": "string", - "const": "fsync" + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false }, - { - "type": "string", - "const": "fsync-ba" + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false }, - { - "type": "string", - "const": "surface" + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false }, - { - "type": "string", - "const": "coreos-stable" + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false }, - { - "type": "string", - "const": "coreos-testing" + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] }, - { - "type": "string", - "const": "bazzite" + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - ], - "default": "main", - "description": "The kernel your images uses.\n- main: stock Fedora kernel / main and nvidia images\n- asus: asus kernel / asus images\n- fsync: fsync kernel / not used in any Universal Blue images\n- fsync-ba: fsync kernel, stable version / not used in any Universal Blue images\n- surface: surface kernel / surface images\n- coreos-stable: stock CoreOS kernel / uCore stable images\n- coreos-testing: stock CoreOS Testing kernel / uCore testing images\n- bazzite: Bazzite's kernel / bazzite images" - }, - "install": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of akmods to install.\nSee all available akmods here: https://github.com/ublue-os/akmods#kmod-packages" } - }, - "required": [ - "type", - "install" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/apk-latest.json b/test-files/schema/modules/apk-latest.json new file mode 100644 index 00000000..f2735d55 --- /dev/null +++ b/test-files/schema/modules/apk-latest.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/apk-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "apk" + }, + { + "type": "string", + "const": "apk@v1" + }, + { + "type": "string", + "const": "apk@latest" + } + ], + "description": "The apk module offers pseudo-declarative package and repository management using apk.\nhttps://blue-build.org/reference/modules/apk/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "remove": { + "$ref": "#/$defs/ApkRemove", + "description": "Configuration of packages removal." + }, + "install": { + "$ref": "#/$defs/ApkInstall", + "description": "Configuration of packages install." + } + }, + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "ApkRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to remove." + } + }, + "required": [ + "packages" + ] + }, + "ApkInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to install." + } + }, + "required": [ + "packages" + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/apk-v1.json b/test-files/schema/modules/apk-v1.json new file mode 100644 index 00000000..17a91762 --- /dev/null +++ b/test-files/schema/modules/apk-v1.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/apk-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "apk" + }, + { + "type": "string", + "const": "apk@v1" + }, + { + "type": "string", + "const": "apk@latest" + } + ], + "description": "The apk module offers pseudo-declarative package and repository management using apk.\nhttps://blue-build.org/reference/modules/apk/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "remove": { + "$ref": "#/$defs/ApkRemove", + "description": "Configuration of packages removal." + }, + "install": { + "$ref": "#/$defs/ApkInstall", + "description": "Configuration of packages install." + } + }, + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "ApkRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to remove." + } + }, + "required": [ + "packages" + ] + }, + "ApkInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to install." + } + }, + "required": [ + "packages" + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/apt-latest.json b/test-files/schema/modules/apt-latest.json new file mode 100644 index 00000000..f377e26e --- /dev/null +++ b/test-files/schema/modules/apt-latest.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/apt-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "apt" + }, + { + "type": "string", + "const": "apt@v1" + }, + { + "type": "string", + "const": "apt@latest" + } + ], + "description": "The apt module offers pseudo-declarative package and repository management using apt.\nhttps://blue-build.org/reference/modules/apt/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "remove": { + "$ref": "#/$defs/AptRemove", + "description": "Configuration of packages removal." + }, + "install": { + "$ref": "#/$defs/AptInstall", + "description": "Configuration of packages install." + } + }, + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "AptRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to remove." + } + }, + "required": [ + "packages" + ] + }, + "AptInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to install." + } + }, + "required": [ + "packages" + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/apt-v1.json b/test-files/schema/modules/apt-v1.json new file mode 100644 index 00000000..b7b2f94a --- /dev/null +++ b/test-files/schema/modules/apt-v1.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/apt-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "apt" + }, + { + "type": "string", + "const": "apt@v1" + }, + { + "type": "string", + "const": "apt@latest" + } + ], + "description": "The apt module offers pseudo-declarative package and repository management using apt.\nhttps://blue-build.org/reference/modules/apt/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "remove": { + "$ref": "#/$defs/AptRemove", + "description": "Configuration of packages removal." + }, + "install": { + "$ref": "#/$defs/AptInstall", + "description": "Configuration of packages install." + } + }, + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "AptRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to remove." + } + }, + "required": [ + "packages" + ] + }, + "AptInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to install." + } + }, + "required": [ + "packages" + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/bling-latest.json b/test-files/schema/modules/bling-latest.json index fefd57b2..4ffe0eba 100644 --- a/test-files/schema/modules/bling-latest.json +++ b/test-files/schema/modules/bling-latest.json @@ -1,54 +1,243 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/bling.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "bling", - "description": "The bling module can be used to pull in small \"bling\" into your image. \nhttps://blue-build.org/reference/modules/bling/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/bling-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "bling" + }, + { + "type": "string", + "const": "bling@v1" + }, + { + "type": "string", + "const": "bling@latest" + } + ], + "description": "The bling module can be used to pull in small \"bling\" into your image.\nhttps://blue-build.org/reference/modules/bling/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "install": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string", + "const": "rpmfusion" + }, + { + "type": "string", + "const": "negativo17" + }, + { + "type": "string", + "const": "ublue-update" + }, + { + "type": "string", + "const": "1password" + }, + { + "type": "string", + "const": "dconf-update-service" + }, + { + "type": "string", + "const": "gnome-vrr" + } + ] + }, + "description": "List of bling submodules to run / things to install onto your system." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "install": { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string", - "const": "rpmfusion" - }, - { - "type": "string", - "const": "negativo17" - }, - { - "type": "string", - "const": "ublue-update" - }, - { - "type": "string", - "const": "1password" - }, - { - "type": "string", - "const": "dconf-update-service" - }, - { - "type": "string", - "const": "gnome-vrr" - } - ] - }, - "description": "List of bling submodules to run / things to install onto your system." + "required": [ + "type", + "install" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type", - "install" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/bling-v1.json b/test-files/schema/modules/bling-v1.json index fefd57b2..1d9e2f7f 100644 --- a/test-files/schema/modules/bling-v1.json +++ b/test-files/schema/modules/bling-v1.json @@ -1,54 +1,243 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/bling.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "bling", - "description": "The bling module can be used to pull in small \"bling\" into your image. \nhttps://blue-build.org/reference/modules/bling/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/bling-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "bling" + }, + { + "type": "string", + "const": "bling@v1" + }, + { + "type": "string", + "const": "bling@latest" + } + ], + "description": "The bling module can be used to pull in small \"bling\" into your image.\nhttps://blue-build.org/reference/modules/bling/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "install": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string", + "const": "rpmfusion" + }, + { + "type": "string", + "const": "negativo17" + }, + { + "type": "string", + "const": "ublue-update" + }, + { + "type": "string", + "const": "1password" + }, + { + "type": "string", + "const": "dconf-update-service" + }, + { + "type": "string", + "const": "gnome-vrr" + } + ] + }, + "description": "List of bling submodules to run / things to install onto your system." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "install": { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string", - "const": "rpmfusion" - }, - { - "type": "string", - "const": "negativo17" - }, - { - "type": "string", - "const": "ublue-update" - }, - { - "type": "string", - "const": "1password" - }, - { - "type": "string", - "const": "dconf-update-service" - }, - { - "type": "string", - "const": "gnome-vrr" - } - ] - }, - "description": "List of bling submodules to run / things to install onto your system." + "required": [ + "type", + "install" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type", - "install" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/brew-latest.json b/test-files/schema/modules/brew-latest.json index d2e759e4..ea7dde7c 100644 --- a/test-files/schema/modules/brew-latest.json +++ b/test-files/schema/modules/brew-latest.json @@ -1,61 +1,260 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/brew.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "brew", - "description": "The brew module installs Homebrew / Linuxbrew at build time and ensures the package manager remains up-to-date.\nhttps://blue-build.org/reference/modules/brew/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/brew-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "brew" + }, + { + "type": "string", + "const": "brew@v1" + }, + { + "type": "string", + "const": "brew@latest" + } + ], + "description": "The brew module installs Homebrew / Linuxbrew at build time and ensures the package manager remains up-to-date.\nhttps://blue-build.org/reference/modules/brew/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "auto-update": { + "type": "boolean", + "default": true, + "description": "Whether to auto-update the Brew binary using a systemd service." + }, + "update-interval": { + "type": "string", + "default": "6h", + "description": "Defines how often the Brew update service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "update-wait-after-boot": { + "type": "string", + "default": "10min", + "description": "Time delay after system boot before the first Brew update runs. The string is passed directly to `OnBootSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "auto-upgrade": { + "type": "boolean", + "default": true, + "description": "Whether to auto-upgrade all installed Brew packages using a systemd service." + }, + "upgrade-interval": { + "type": "string", + "default": "8h", + "description": "Defines how often the Brew upgrade service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "upgrade-wait-after-boot": { + "type": "string", + "default": "30min", + "description": "Time delay after system boot before the first Brew package upgrade runs. The string is passed directly to `OnBootSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "nofile-limits": { + "type": "boolean", + "default": false, + "description": "Whether to increase nofile limits (limits for number of open files) for Brew installations.\nWhen set to true, it increases the nofile limits to prevent certain \"I/O heavy\" Brew packages from failing due to \"too many open files\" error.\nHowever, it's important to note that increasing nofile limits can have potential security implications for malicious applications which would try to abuse storage I/O.\nDefaults to false for security purposes.\n\nhttps://serverfault.com/questions/577437/what-is-the-impact-of-increasing-nofile-limits-in-etc-security-limits-conf" + }, + "brew-analytics": { + "type": "boolean", + "default": true, + "description": "Whether to enable Brew analytics.\nThe Homebrew project uses analytics to anonymously collect the information about Brew usage & your system in order to improve the experience of Brew users." + }, + "direct-pull": { + "type": "boolean", + "default": true, + "description": "Whether to skip ublue's cache and directly install from Homebrew using the official installer.\nUblue provides a tarball cache of a Homebrew installation." + }, + "installer-commit": { + "type": "string", + "default": "HEAD", + "description": "The commit to use when directly pulling the Homebrew install script.\nDefaults to \"HEAD\"." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "auto-update": { - "type": "boolean", - "default": true, - "description": "Whether to auto-update the Brew binary using a systemd service." - }, - "update-interval": { - "type": "string", - "default": "6h", - "description": "Defines how often the Brew update service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." - }, - "update-wait-after-boot": { - "type": "string", - "default": "10min", - "description": "Time delay after system boot before the first Brew update runs. The string is passed directly to `OnBootSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." - }, - "auto-upgrade": { - "type": "boolean", - "default": true, - "description": "Whether to auto-upgrade all installed Brew packages using a systemd service." - }, - "upgrade-interval": { - "type": "string", - "default": "8h", - "description": "Defines how often the Brew upgrade service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." - }, - "upgrade-wait-after-boot": { - "type": "string", - "default": "30min", - "description": "Time delay after system boot before the first Brew package upgrade runs. The string is passed directly to `OnBootSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." - }, - "nofile-limits": { - "type": "boolean", - "default": false, - "description": "Whether to increase nofile limits (limits for number of open files) for Brew installations.\nWhen set to true, it increases the nofile limits to prevent certain \"I/O heavy\" Brew packages from failing due to \"too many open files\" error.\nHowever, it's important to note that increasing nofile limits can have potential security implications for malicious applications which would try to abuse storage I/O.\nDefaults to false for security purposes.\n\nhttps://serverfault.com/questions/577437/what-is-the-impact-of-increasing-nofile-limits-in-etc-security-limits-conf" - }, - "brew-analytics": { - "type": "boolean", - "default": true, - "description": "Whether to enable Brew analytics. \nThe Homebrew project uses analytics to anonymously collect the information about Brew usage & your system in order to improve the experience of Brew users." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/brew-v1.json b/test-files/schema/modules/brew-v1.json index d2e759e4..ec795e94 100644 --- a/test-files/schema/modules/brew-v1.json +++ b/test-files/schema/modules/brew-v1.json @@ -1,61 +1,260 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/brew.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "brew", - "description": "The brew module installs Homebrew / Linuxbrew at build time and ensures the package manager remains up-to-date.\nhttps://blue-build.org/reference/modules/brew/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/brew-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "brew" + }, + { + "type": "string", + "const": "brew@v1" + }, + { + "type": "string", + "const": "brew@latest" + } + ], + "description": "The brew module installs Homebrew / Linuxbrew at build time and ensures the package manager remains up-to-date.\nhttps://blue-build.org/reference/modules/brew/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "auto-update": { + "type": "boolean", + "default": true, + "description": "Whether to auto-update the Brew binary using a systemd service." + }, + "update-interval": { + "type": "string", + "default": "6h", + "description": "Defines how often the Brew update service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "update-wait-after-boot": { + "type": "string", + "default": "10min", + "description": "Time delay after system boot before the first Brew update runs. The string is passed directly to `OnBootSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "auto-upgrade": { + "type": "boolean", + "default": true, + "description": "Whether to auto-upgrade all installed Brew packages using a systemd service." + }, + "upgrade-interval": { + "type": "string", + "default": "8h", + "description": "Defines how often the Brew upgrade service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "upgrade-wait-after-boot": { + "type": "string", + "default": "30min", + "description": "Time delay after system boot before the first Brew package upgrade runs. The string is passed directly to `OnBootSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "nofile-limits": { + "type": "boolean", + "default": false, + "description": "Whether to increase nofile limits (limits for number of open files) for Brew installations.\nWhen set to true, it increases the nofile limits to prevent certain \"I/O heavy\" Brew packages from failing due to \"too many open files\" error.\nHowever, it's important to note that increasing nofile limits can have potential security implications for malicious applications which would try to abuse storage I/O.\nDefaults to false for security purposes.\n\nhttps://serverfault.com/questions/577437/what-is-the-impact-of-increasing-nofile-limits-in-etc-security-limits-conf" + }, + "brew-analytics": { + "type": "boolean", + "default": true, + "description": "Whether to enable Brew analytics.\nThe Homebrew project uses analytics to anonymously collect the information about Brew usage & your system in order to improve the experience of Brew users." + }, + "direct-pull": { + "type": "boolean", + "default": true, + "description": "Whether to skip ublue's cache and directly install from Homebrew using the official installer.\nUblue provides a tarball cache of a Homebrew installation." + }, + "installer-commit": { + "type": "string", + "default": "HEAD", + "description": "The commit to use when directly pulling the Homebrew install script.\nDefaults to \"HEAD\"." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "auto-update": { - "type": "boolean", - "default": true, - "description": "Whether to auto-update the Brew binary using a systemd service." - }, - "update-interval": { - "type": "string", - "default": "6h", - "description": "Defines how often the Brew update service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." - }, - "update-wait-after-boot": { - "type": "string", - "default": "10min", - "description": "Time delay after system boot before the first Brew update runs. The string is passed directly to `OnBootSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." - }, - "auto-upgrade": { - "type": "boolean", - "default": true, - "description": "Whether to auto-upgrade all installed Brew packages using a systemd service." - }, - "upgrade-interval": { - "type": "string", - "default": "8h", - "description": "Defines how often the Brew upgrade service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." - }, - "upgrade-wait-after-boot": { - "type": "string", - "default": "30min", - "description": "Time delay after system boot before the first Brew package upgrade runs. The string is passed directly to `OnBootSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." - }, - "nofile-limits": { - "type": "boolean", - "default": false, - "description": "Whether to increase nofile limits (limits for number of open files) for Brew installations.\nWhen set to true, it increases the nofile limits to prevent certain \"I/O heavy\" Brew packages from failing due to \"too many open files\" error.\nHowever, it's important to note that increasing nofile limits can have potential security implications for malicious applications which would try to abuse storage I/O.\nDefaults to false for security purposes.\n\nhttps://serverfault.com/questions/577437/what-is-the-impact-of-increasing-nofile-limits-in-etc-security-limits-conf" - }, - "brew-analytics": { - "type": "boolean", - "default": true, - "description": "Whether to enable Brew analytics. \nThe Homebrew project uses analytics to anonymously collect the information about Brew usage & your system in order to improve the experience of Brew users." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/chezmoi-latest.json b/test-files/schema/modules/chezmoi-latest.json index 0c8da213..c46c580b 100644 --- a/test-files/schema/modules/chezmoi-latest.json +++ b/test-files/schema/modules/chezmoi-latest.json @@ -1,70 +1,259 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/chezmoi.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "chezmoi", - "description": "The chezmoi module installs the latest chezmoi release at build time, along with services to clone a dotfile repository and keep it up-to-date.\nhttps://blue-build.org/reference/modules/chezmoi/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "repository": { - "type": "string", - "description": "Git repository to initialize." - }, - "branch": { - "type": "string", - "default": "", - "description": "Git branch of the chezmoi repository." - }, - "all-users": { - "type": "boolean", - "default": true, - "description": "Whether to enable the modules services globally for all users, if false users need to enable services manually." - }, - "run-every": { - "type": "string", - "default": "1d", - "description": "Dotfiles will be updated with this interval." - }, - "wait-after-boot": { - "type": "string", - "default": "5m", - "description": "Dotfile updates will wait this long after a boot before running." - }, - "disable-init": { - "type": "boolean", - "default": false, - "description": "Disable the service that initializes `repository` on users that are logged in or have linger enabled UI." - }, - "disable-update": { - "type": "boolean", - "default": false, - "description": "Disable the timer that updates chezmoi with the set interval." + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/chezmoi-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "chezmoi" + }, + { + "type": "string", + "const": "chezmoi@v1" + }, + { + "type": "string", + "const": "chezmoi@latest" + } + ], + "description": "The chezmoi module installs the latest chezmoi release at build time, along with services to clone a dotfile repository and keep it up-to-date.\nhttps://blue-build.org/reference/modules/chezmoi/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "repository": { + "type": "string", + "description": "Git repository to initialize." + }, + "branch": { + "type": "string", + "default": "", + "description": "Git branch of the chezmoi repository." + }, + "all-users": { + "type": "boolean", + "default": true, + "description": "Whether to enable the modules services globally for all users, if false users need to enable services manually." + }, + "run-every": { + "type": "string", + "default": "1d", + "description": "Dotfiles will be updated with this interval." + }, + "wait-after-boot": { + "type": "string", + "default": "5m", + "description": "Dotfile updates will wait this long after a boot before running." + }, + "disable-init": { + "type": "boolean", + "default": false, + "description": "Disable the service that initializes `repository` on users that are logged in or have linger enabled UI." + }, + "disable-update": { + "type": "boolean", + "default": false, + "description": "Disable the timer that updates chezmoi with the set interval." + }, + "file-conflict-policy": { + "anyOf": [ + { + "type": "string", + "const": "skip" + }, + { + "type": "string", + "const": "replace" + } + ], + "default": "skip", + "description": "What to do when file different that exists on your repo is has been changed or exists locally. Accepts \"skip\" or \"replace\"." + } }, - "file-conflict-policy": { - "anyOf": [ - { - "type": "string", - "const": "skip" - }, - { - "type": "string", - "const": "replace" + "required": [ + "type", + "repository" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - ], - "default": "skip", - "description": "What to do when file different that exists on your repo is has been changed or exists locally. Accepts \"skip\" or \"replace\"." } - }, - "required": [ - "type", - "repository" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/chezmoi-v1.json b/test-files/schema/modules/chezmoi-v1.json index 0c8da213..5d31c27e 100644 --- a/test-files/schema/modules/chezmoi-v1.json +++ b/test-files/schema/modules/chezmoi-v1.json @@ -1,70 +1,259 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/chezmoi.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "chezmoi", - "description": "The chezmoi module installs the latest chezmoi release at build time, along with services to clone a dotfile repository and keep it up-to-date.\nhttps://blue-build.org/reference/modules/chezmoi/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "repository": { - "type": "string", - "description": "Git repository to initialize." - }, - "branch": { - "type": "string", - "default": "", - "description": "Git branch of the chezmoi repository." - }, - "all-users": { - "type": "boolean", - "default": true, - "description": "Whether to enable the modules services globally for all users, if false users need to enable services manually." - }, - "run-every": { - "type": "string", - "default": "1d", - "description": "Dotfiles will be updated with this interval." - }, - "wait-after-boot": { - "type": "string", - "default": "5m", - "description": "Dotfile updates will wait this long after a boot before running." - }, - "disable-init": { - "type": "boolean", - "default": false, - "description": "Disable the service that initializes `repository` on users that are logged in or have linger enabled UI." - }, - "disable-update": { - "type": "boolean", - "default": false, - "description": "Disable the timer that updates chezmoi with the set interval." + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/chezmoi-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "chezmoi" + }, + { + "type": "string", + "const": "chezmoi@v1" + }, + { + "type": "string", + "const": "chezmoi@latest" + } + ], + "description": "The chezmoi module installs the latest chezmoi release at build time, along with services to clone a dotfile repository and keep it up-to-date.\nhttps://blue-build.org/reference/modules/chezmoi/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "repository": { + "type": "string", + "description": "Git repository to initialize." + }, + "branch": { + "type": "string", + "default": "", + "description": "Git branch of the chezmoi repository." + }, + "all-users": { + "type": "boolean", + "default": true, + "description": "Whether to enable the modules services globally for all users, if false users need to enable services manually." + }, + "run-every": { + "type": "string", + "default": "1d", + "description": "Dotfiles will be updated with this interval." + }, + "wait-after-boot": { + "type": "string", + "default": "5m", + "description": "Dotfile updates will wait this long after a boot before running." + }, + "disable-init": { + "type": "boolean", + "default": false, + "description": "Disable the service that initializes `repository` on users that are logged in or have linger enabled UI." + }, + "disable-update": { + "type": "boolean", + "default": false, + "description": "Disable the timer that updates chezmoi with the set interval." + }, + "file-conflict-policy": { + "anyOf": [ + { + "type": "string", + "const": "skip" + }, + { + "type": "string", + "const": "replace" + } + ], + "default": "skip", + "description": "What to do when file different that exists on your repo is has been changed or exists locally. Accepts \"skip\" or \"replace\"." + } }, - "file-conflict-policy": { - "anyOf": [ - { - "type": "string", - "const": "skip" - }, - { - "type": "string", - "const": "replace" + "required": [ + "type", + "repository" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - ], - "default": "skip", - "description": "What to do when file different that exists on your repo is has been changed or exists locally. Accepts \"skip\" or \"replace\"." } - }, - "required": [ - "type", - "repository" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/containerfile-latest.json b/test-files/schema/modules/containerfile-latest.json index ef6dcb5e..d70a005b 100644 --- a/test-files/schema/modules/containerfile-latest.json +++ b/test-files/schema/modules/containerfile-latest.json @@ -1,35 +1,223 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/containerfile.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "containerfile", - "description": "The containerfile module is a tool for adding custom Containerfile instructions for custom image builds. \nhttps://blue-build.org/reference/modules/containerfile/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/containerfile-latest.json", + "type": "object", + "properties": { + "type": { + "oneOf": [ + { + "type": "string", + "const": "containerfile" + }, + { + "type": "string", + "const": "containerfile@latest" + }, + { + "type": "string", + "const": "containerfile@v1" + } + ], + "description": "The containerfile module is a tool for adding custom Containerfile instructions for custom image builds.\nhttps://blue-build.org/reference/modules/containerfile/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "snippets": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Lines to directly insert into the generated Containerfile." + }, + "containerfiles": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Names of directories in ./containerfiles/ containing each a Containerfile to insert into the generated Containerfile." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "snippets": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Lines to directly insert into the generated Containerfile." - }, - "containerfiles": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Names of directories in ./containerfiles/ containing each a Containerfile to insert into the generated Containerfile." + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/containerfile-v1.json b/test-files/schema/modules/containerfile-v1.json index ef6dcb5e..83850131 100644 --- a/test-files/schema/modules/containerfile-v1.json +++ b/test-files/schema/modules/containerfile-v1.json @@ -1,35 +1,223 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/containerfile.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "containerfile", - "description": "The containerfile module is a tool for adding custom Containerfile instructions for custom image builds. \nhttps://blue-build.org/reference/modules/containerfile/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/containerfile-v1.json", + "type": "object", + "properties": { + "type": { + "oneOf": [ + { + "type": "string", + "const": "containerfile" + }, + { + "type": "string", + "const": "containerfile@latest" + }, + { + "type": "string", + "const": "containerfile@v1" + } + ], + "description": "The containerfile module is a tool for adding custom Containerfile instructions for custom image builds.\nhttps://blue-build.org/reference/modules/containerfile/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "snippets": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Lines to directly insert into the generated Containerfile." + }, + "containerfiles": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Names of directories in ./containerfiles/ containing each a Containerfile to insert into the generated Containerfile." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "snippets": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Lines to directly insert into the generated Containerfile." - }, - "containerfiles": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Names of directories in ./containerfiles/ containing each a Containerfile to insert into the generated Containerfile." + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/copy-latest.json b/test-files/schema/modules/copy-latest.json index 5763e440..d70194c8 100644 --- a/test-files/schema/modules/copy-latest.json +++ b/test-files/schema/modules/copy-latest.json @@ -1,35 +1,223 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/copy.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "copy", - "description": "The copy module is a short-hand method of adding a COPY instruction into the Containerfile.\nhttps://blue-build.org/reference/modules/copy/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/copy-latest.json", + "type": "object", + "properties": { + "type": { + "oneOf": [ + { + "type": "string", + "const": "copy" + }, + { + "type": "string", + "const": "copy@latest" + }, + { + "type": "string", + "const": "copy@v1" + } + ], + "description": "The copy module is a short-hand method of adding a COPY instruction into the Containerfile.\nhttps://blue-build.org/reference/modules/copy/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "from": { + "type": "string", + "description": "Equivalent to the --from property in a COPY statement, use to specify an image to copy from.\nBy default, the COPY source is the build environment's file tree." + }, + "src": { + "type": "string", + "description": "Path to source file or directory." + }, + "dest": { + "type": "string", + "description": "Path to destination file or directory." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "from": { - "type": "string", - "description": "Equivalent to the --from property in a COPY statement, use to specify an image to copy from.\nBy default, the COPY source is the build environment's file tree." - }, - "src": { - "type": "string", - "description": "Path to source file or directory." - }, - "dest": { - "type": "string", - "description": "Path to destination file or directory." + "required": [ + "type", + "src", + "dest" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type", - "src", - "dest" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/copy-v1.json b/test-files/schema/modules/copy-v1.json index 5763e440..755e7cf9 100644 --- a/test-files/schema/modules/copy-v1.json +++ b/test-files/schema/modules/copy-v1.json @@ -1,35 +1,223 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/copy.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "copy", - "description": "The copy module is a short-hand method of adding a COPY instruction into the Containerfile.\nhttps://blue-build.org/reference/modules/copy/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/copy-v1.json", + "type": "object", + "properties": { + "type": { + "oneOf": [ + { + "type": "string", + "const": "copy" + }, + { + "type": "string", + "const": "copy@latest" + }, + { + "type": "string", + "const": "copy@v1" + } + ], + "description": "The copy module is a short-hand method of adding a COPY instruction into the Containerfile.\nhttps://blue-build.org/reference/modules/copy/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "from": { + "type": "string", + "description": "Equivalent to the --from property in a COPY statement, use to specify an image to copy from.\nBy default, the COPY source is the build environment's file tree." + }, + "src": { + "type": "string", + "description": "Path to source file or directory." + }, + "dest": { + "type": "string", + "description": "Path to destination file or directory." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "from": { - "type": "string", - "description": "Equivalent to the --from property in a COPY statement, use to specify an image to copy from.\nBy default, the COPY source is the build environment's file tree." - }, - "src": { - "type": "string", - "description": "Path to source file or directory." - }, - "dest": { - "type": "string", - "description": "Path to destination file or directory." + "required": [ + "type", + "src", + "dest" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type", - "src", - "dest" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/default-flatpaks-latest.json b/test-files/schema/modules/default-flatpaks-latest.json index 31783d0d..d879ea3d 100644 --- a/test-files/schema/modules/default-flatpaks-latest.json +++ b/test-files/schema/modules/default-flatpaks-latest.json @@ -1,94 +1,274 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/default-flatpaks.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "default-flatpaks", - "description": "The default-flatpaks module can be used to install or uninstall flatpaks from a configurable remote on every boot.\nhttps://blue-build.org/reference/modules/default-flatpaks/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "notify": { - "type": "boolean", - "default": false, - "description": "Whether to send a notification after the install/uninstall is finished." - }, - "system": { - "type": "object", - "properties": { - "repo-url": { - "type": "string", - "default": "https://dl.flathub.org/repo/flathub.flatpakrepo", - "description": "URL of the repo to add. Defaults to Flathub's URL." + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/default-flatpaks-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "default-flatpaks@v2" + }, + { + "type": "string", + "const": "default-flatpaks@latest" + }, + { + "type": "string", + "const": "default-flatpaks" + } + ], + "description": "The default-flatpaks module can be used to install Flatpaks from a configurable remote on every boot.\nusing version: v2\nhttps://blue-build.org/reference/modules/default-flatpaks/" }, - "repo-name": { - "type": "string", - "default": "flathub", - "description": "Name for the repo to add." + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" }, - "repo-title": { - "type": "string", - "description": "Pretty title for the repo to add. Not set by default." + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." }, - "install": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Flatpak IDs to install from the repo." + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." }, - "remove": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Flatpak IDs to remove." + "configurations": { + "type": "array", + "items": { + "$ref": "#/$defs/ConfigurationV2" + } } - }, - "description": "Configuration for system flatpaks." }, - "user": { - "type": "object", - "properties": { - "repo-url": { - "type": "string", - "default": "https://dl.flathub.org/repo/flathub.flatpakrepo", - "description": "URL of the repo to add. Defaults to Flathub's URL." + "required": [ + "type", + "configurations" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "ConfigurationV2": { + "type": "object", + "properties": { + "notify": { + "type": "boolean", + "default": true, + "description": "Whether to notify users about Flatpak installation." + }, + "scope": { + "anyOf": [ + { + "type": "string", + "const": "system" + }, + { + "type": "string", + "const": "user" + } + ], + "default": "user", + "description": "Whether to perform this configuration for system-wide or separately for each user." + }, + "repo": { + "$ref": "#/$defs/ConfigurationV2Repo", + "description": "Details of the Flatpak repository to set up. If omitted, Flathub will be used by default." + }, + "install": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of Flatpak IDs to install from the repo." + } + }, + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false }, - "repo-name": { - "type": "string", - "default": "flathub", - "description": "Name for the repo to add." + "ConfigurationV2Repo": { + "type": "object", + "properties": { + "url": { + "type": "string", + "default": "https://dl.flathub.org/repo/flathub.flatpakrepo", + "description": "Flatpak repository URL." + }, + "name": { + "type": "string", + "default": "flathub", + "description": "Flatpak repository name." + }, + "title": { + "type": "string", + "default": "Flathub", + "description": "Flatpak repository formatted title." + } + }, + "additionalProperties": false }, - "repo-title": { - "type": "string", - "description": "Pretty title for the repo to add. Not set by default." + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] }, - "install": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Flatpak IDs to install from the repo." + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false }, - "remove": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Flatpak IDs to remove." + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - }, - "description": "Configuration for user flatpaks." } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/default-flatpaks-v1.json b/test-files/schema/modules/default-flatpaks-v1.json index 31783d0d..4360d7f0 100644 --- a/test-files/schema/modules/default-flatpaks-v1.json +++ b/test-files/schema/modules/default-flatpaks-v1.json @@ -1,94 +1,245 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/default-flatpaks.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "default-flatpaks", - "description": "The default-flatpaks module can be used to install or uninstall flatpaks from a configurable remote on every boot.\nhttps://blue-build.org/reference/modules/default-flatpaks/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "notify": { - "type": "boolean", - "default": false, - "description": "Whether to send a notification after the install/uninstall is finished." - }, - "system": { - "type": "object", - "properties": { - "repo-url": { - "type": "string", - "default": "https://dl.flathub.org/repo/flathub.flatpakrepo", - "description": "URL of the repo to add. Defaults to Flathub's URL." + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/default-flatpaks-v1.json", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "default-flatpaks@v1", + "description": "The default-flatpaks module can be used to install or uninstall flatpaks from a configurable remote on every boot.\nusing version: v1\nhttps://blue-build.org/reference/modules/default-flatpaks/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." }, - "repo-name": { - "type": "string", - "default": "flathub", - "description": "Name for the repo to add." + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." }, - "repo-title": { - "type": "string", - "description": "Pretty title for the repo to add. Not set by default." + "notify": { + "type": "boolean", + "default": false, + "description": "Whether to send a notification after the install/uninstall is finished." }, - "install": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Flatpak IDs to install from the repo." + "system": { + "$ref": "#/$defs/ConfigurationV1", + "description": "Configuration for system flatpaks." }, - "remove": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Flatpak IDs to remove." + "user": { + "$ref": "#/$defs/ConfigurationV1", + "description": "Configuration for user flatpaks." } - }, - "description": "Configuration for system flatpaks." }, - "user": { - "type": "object", - "properties": { - "repo-url": { - "type": "string", - "default": "https://dl.flathub.org/repo/flathub.flatpakrepo", - "description": "URL of the repo to add. Defaults to Flathub's URL." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "ConfigurationV1": { + "type": "object", + "properties": { + "repo-url": { + "type": "string", + "default": "https://dl.flathub.org/repo/flathub.flatpakrepo", + "description": "URL of the repo to add. Defaults to Flathub's URL." + }, + "repo-name": { + "type": "string", + "default": "flathub", + "description": "Name for the repo to add." + }, + "repo-title": { + "type": "string", + "description": "Pretty title for the repo to add. Not set by default." + }, + "install": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of Flatpak IDs to install from the repo." + }, + "remove": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of Flatpak IDs to remove." + } + }, + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false }, - "repo-name": { - "type": "string", - "default": "flathub", - "description": "Name for the repo to add." + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false }, - "repo-title": { - "type": "string", - "description": "Pretty title for the repo to add. Not set by default." + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] }, - "install": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Flatpak IDs to install from the repo." + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false }, - "remove": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Flatpak IDs to remove." + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - }, - "description": "Configuration for user flatpaks." } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/default-flatpaks-v2.json b/test-files/schema/modules/default-flatpaks-v2.json new file mode 100644 index 00000000..6f900f74 --- /dev/null +++ b/test-files/schema/modules/default-flatpaks-v2.json @@ -0,0 +1,273 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/default-flatpaks-v2.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "default-flatpaks@v2" + }, + { + "type": "string", + "const": "default-flatpaks@latest" + }, + { + "type": "string", + "const": "default-flatpaks" + } + ], + "description": "The default-flatpaks module can be used to install Flatpaks from a configurable remote on every boot.\nusing version: v2\nhttps://blue-build.org/reference/modules/default-flatpaks/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "configurations": { + "type": "array", + "items": { + "$ref": "#/$defs/ConfigurationV2" + } + } + }, + "required": [ + "type", + "configurations" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "ConfigurationV2": { + "type": "object", + "properties": { + "notify": { + "type": "boolean", + "default": true, + "description": "Whether to notify users about Flatpak installation." + }, + "scope": { + "anyOf": [ + { + "type": "string", + "const": "system" + }, + { + "type": "string", + "const": "user" + } + ], + "default": "user", + "description": "Whether to perform this configuration for system-wide or separately for each user." + }, + "repo": { + "$ref": "#/$defs/ConfigurationV2Repo", + "description": "Details of the Flatpak repository to set up. If omitted, Flathub will be used by default." + }, + "install": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of Flatpak IDs to install from the repo." + } + }, + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "ConfigurationV2Repo": { + "type": "object", + "properties": { + "url": { + "type": "string", + "default": "https://dl.flathub.org/repo/flathub.flatpakrepo", + "description": "Flatpak repository URL." + }, + "name": { + "type": "string", + "default": "flathub", + "description": "Flatpak repository name." + }, + "title": { + "type": "string", + "default": "Flathub", + "description": "Flatpak repository formatted title." + } + }, + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/default-flatpaks.json b/test-files/schema/modules/default-flatpaks.json new file mode 100644 index 00000000..605284a8 --- /dev/null +++ b/test-files/schema/modules/default-flatpaks.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/default-flatpaks.json", + "oneOf": [ + { + "$ref": "/modules/default-flatpaks-v1.json" + }, + { + "$ref": "/modules/default-flatpaks-v2.json" + } + ] +} \ No newline at end of file diff --git a/test-files/schema/modules/dnf-latest.json b/test-files/schema/modules/dnf-latest.json new file mode 100644 index 00000000..2f279229 --- /dev/null +++ b/test-files/schema/modules/dnf-latest.json @@ -0,0 +1,771 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/dnf-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "dnf" + }, + { + "type": "string", + "const": "dnf@v1" + }, + { + "type": "string", + "const": "dnf@latest" + } + ], + "description": "The dnf module offers pseudo-declarative package and repository management using dnf.\nhttps://blue-build.org/reference/modules/dnf/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "repos": { + "$ref": "#/$defs/DnfRepo", + "description": "List of links to .repo files to download into /etc/yum.repos.d/." + }, + "optfix": { + "type": "array", + "items": { + "type": "string" + }, + "description": "DEPRECATED: List of folder names under /opt/ to enable for installing into." + }, + "group-remove": { + "$ref": "#/$defs/DnfGroupRemove", + "description": "Configuration of RPM groups removal." + }, + "group-install": { + "$ref": "#/$defs/DnfGroupInstall", + "description": "Configuration of RPM groups install." + }, + "remove": { + "$ref": "#/$defs/DnfRemove", + "description": "Configuration of RPM packages removal." + }, + "install": { + "$ref": "#/$defs/DnfInstall", + "description": "Configuration of RPM packages install." + }, + "builddep": { + "$ref": "#/$defs/DnfBuilddep", + "description": "Configuration of RPM build dependency installation." + }, + "replace": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfReplace" + }, + "description": "List of configurations for replacing packages from another repo." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "DnfRepo": { + "type": "object", + "properties": { + "cleanup": { + "type": "boolean", + "default": false, + "description": "Cleans up the repos added in the same step after packages are installed." + }, + "files": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "$ref": "#/$defs/DnfRepoFiles" + } + ], + "description": "List of paths or URLs to .repo files to import" + }, + "copr": { + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/$defs/DnfRepoCoprEnableUnion" + } + }, + { + "$ref": "#/$defs/DnfRepoCopr" + } + ], + "description": "List of COPR project repos to add.\nYou can also specify 2 lists\ninstead to 'enable' or 'disable' COPR repos." + }, + "keys": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of links to key files to import for installing from custom repositories." + }, + "nonfree": { + "anyOf": [ + { + "type": "string", + "const": "negativo17" + }, + { + "type": "string", + "const": "rpmfusion" + } + ], + "description": "Enable one of the nonfree repos.\n\nThis allows you to enable one of the nonfree repos.\nHowever, only one can be enabled at a time so if one\nis enabled, the other will be disabled if it is already enabled." + } + }, + "additionalProperties": false + }, + "DnfGroupRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM groups to remove." + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfGroupInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM groups to install." + }, + "with-optional": { + "type": "boolean", + "default": false, + "description": "Include optional packages from group." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM packages to remove." + }, + "auto-remove": { + "type": "boolean", + "default": true, + "description": "Whether to remove unused dependencies during removal operation." + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfInstallObjectUnion" + }, + "description": "List of RPM packages to install." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfBuilddep": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfBuilddepObjectUnion" + }, + "description": "List of RPM packages/specs to resolve build dependencies for." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfReplace": { + "type": "object", + "properties": { + "from-repo": { + "type": "string", + "description": "URL to the source COPR repo for the new packages." + }, + "packages": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfSwapUnion" + }, + "description": "List of packages to replace using packages from the defined repo." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "from-repo", + "packages" + ], + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "DnfRepoFiles": { + "type": "object", + "properties": { + "add": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of repo files/URLs to add." + }, + "remove": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of repos to disable.\nThis must be the ID of the repo\nas seen in `dnf5 repolist`." + } + }, + "additionalProperties": false + }, + "DnfRepoCoprEnableUnion": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/DnfRepoCoprEnable" + } + ] + }, + "DnfRepoCopr": { + "type": "object", + "properties": { + "enable": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfRepoCoprEnableUnion" + }, + "description": "List of COPR repos to enable" + }, + "disable": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of COPR repos to disable" + } + }, + "additionalProperties": false + }, + "DnfInstallObjectUnion": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/DnfInstallObject" + } + ] + }, + "DnfBuilddepObjectUnion": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/DnfBuilddepObject" + } + ] + }, + "DnfSwapUnion": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/DnfSwap" + } + ] + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "DnfRepoCoprEnable": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The COPR repo's name" + }, + "chroot": { + "type": "string", + "description": "The chroot for the COPR repo" + } + }, + "required": [ + "name", + "chroot" + ], + "additionalProperties": false + }, + "DnfInstallObject": { + "type": "object", + "properties": { + "repo": { + "type": "string", + "description": "The repo to use when installing packages" + }, + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM packages to install." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfBuilddepObject": { + "type": "object", + "properties": { + "repo": { + "type": "string", + "description": "The repo to use when resolving build dependencies" + }, + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM packages/specs to resolve build dependencies for." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfSwap": { + "type": "object", + "properties": { + "old": { + "type": "string", + "description": "The package to be replaced." + }, + "new": { + "type": "string", + "description": "The package to replace with." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + } + }, + "required": [ + "old", + "new" + ], + "additionalProperties": false + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/dnf-v1.json b/test-files/schema/modules/dnf-v1.json new file mode 100644 index 00000000..a3dcd429 --- /dev/null +++ b/test-files/schema/modules/dnf-v1.json @@ -0,0 +1,771 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/dnf-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "dnf" + }, + { + "type": "string", + "const": "dnf@v1" + }, + { + "type": "string", + "const": "dnf@latest" + } + ], + "description": "The dnf module offers pseudo-declarative package and repository management using dnf.\nhttps://blue-build.org/reference/modules/dnf/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "repos": { + "$ref": "#/$defs/DnfRepo", + "description": "List of links to .repo files to download into /etc/yum.repos.d/." + }, + "optfix": { + "type": "array", + "items": { + "type": "string" + }, + "description": "DEPRECATED: List of folder names under /opt/ to enable for installing into." + }, + "group-remove": { + "$ref": "#/$defs/DnfGroupRemove", + "description": "Configuration of RPM groups removal." + }, + "group-install": { + "$ref": "#/$defs/DnfGroupInstall", + "description": "Configuration of RPM groups install." + }, + "remove": { + "$ref": "#/$defs/DnfRemove", + "description": "Configuration of RPM packages removal." + }, + "install": { + "$ref": "#/$defs/DnfInstall", + "description": "Configuration of RPM packages install." + }, + "builddep": { + "$ref": "#/$defs/DnfBuilddep", + "description": "Configuration of RPM build dependency installation." + }, + "replace": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfReplace" + }, + "description": "List of configurations for replacing packages from another repo." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "DnfRepo": { + "type": "object", + "properties": { + "cleanup": { + "type": "boolean", + "default": false, + "description": "Cleans up the repos added in the same step after packages are installed." + }, + "files": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "$ref": "#/$defs/DnfRepoFiles" + } + ], + "description": "List of paths or URLs to .repo files to import" + }, + "copr": { + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/$defs/DnfRepoCoprEnableUnion" + } + }, + { + "$ref": "#/$defs/DnfRepoCopr" + } + ], + "description": "List of COPR project repos to add.\nYou can also specify 2 lists\ninstead to 'enable' or 'disable' COPR repos." + }, + "keys": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of links to key files to import for installing from custom repositories." + }, + "nonfree": { + "anyOf": [ + { + "type": "string", + "const": "negativo17" + }, + { + "type": "string", + "const": "rpmfusion" + } + ], + "description": "Enable one of the nonfree repos.\n\nThis allows you to enable one of the nonfree repos.\nHowever, only one can be enabled at a time so if one\nis enabled, the other will be disabled if it is already enabled." + } + }, + "additionalProperties": false + }, + "DnfGroupRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM groups to remove." + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfGroupInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM groups to install." + }, + "with-optional": { + "type": "boolean", + "default": false, + "description": "Include optional packages from group." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM packages to remove." + }, + "auto-remove": { + "type": "boolean", + "default": true, + "description": "Whether to remove unused dependencies during removal operation." + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfInstallObjectUnion" + }, + "description": "List of RPM packages to install." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfBuilddep": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfBuilddepObjectUnion" + }, + "description": "List of RPM packages/specs to resolve build dependencies for." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfReplace": { + "type": "object", + "properties": { + "from-repo": { + "type": "string", + "description": "URL to the source COPR repo for the new packages." + }, + "packages": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfSwapUnion" + }, + "description": "List of packages to replace using packages from the defined repo." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "from-repo", + "packages" + ], + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "DnfRepoFiles": { + "type": "object", + "properties": { + "add": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of repo files/URLs to add." + }, + "remove": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of repos to disable.\nThis must be the ID of the repo\nas seen in `dnf5 repolist`." + } + }, + "additionalProperties": false + }, + "DnfRepoCoprEnableUnion": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/DnfRepoCoprEnable" + } + ] + }, + "DnfRepoCopr": { + "type": "object", + "properties": { + "enable": { + "type": "array", + "items": { + "$ref": "#/$defs/DnfRepoCoprEnableUnion" + }, + "description": "List of COPR repos to enable" + }, + "disable": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of COPR repos to disable" + } + }, + "additionalProperties": false + }, + "DnfInstallObjectUnion": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/DnfInstallObject" + } + ] + }, + "DnfBuilddepObjectUnion": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/DnfBuilddepObject" + } + ] + }, + "DnfSwapUnion": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/DnfSwap" + } + ] + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "DnfRepoCoprEnable": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The COPR repo's name" + }, + "chroot": { + "type": "string", + "description": "The chroot for the COPR repo" + } + }, + "required": [ + "name", + "chroot" + ], + "additionalProperties": false + }, + "DnfInstallObject": { + "type": "object", + "properties": { + "repo": { + "type": "string", + "description": "The repo to use when installing packages" + }, + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM packages to install." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfBuilddepObject": { + "type": "object", + "properties": { + "repo": { + "type": "string", + "description": "The repo to use when resolving build dependencies" + }, + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM packages/specs to resolve build dependencies for." + }, + "install-weak-deps": { + "type": "boolean", + "default": true, + "description": "Whether to install weak dependencies." + }, + "skip-unavailable": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are no packages available in the repository." + }, + "skip-broken": { + "type": "boolean", + "default": false, + "description": "Whether to continue with the install if there are broken packages." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + }, + "no-gpgchecks": { + "type": "boolean", + "default": false, + "description": "Disable OpenPGP signature checking, incase a package has faulty signatures (not secure, only set when needed)." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of packages to prevent from being installed" + } + }, + "required": [ + "packages" + ], + "additionalProperties": false + }, + "DnfSwap": { + "type": "object", + "properties": { + "old": { + "type": "string", + "description": "The package to be replaced." + }, + "new": { + "type": "string", + "description": "The package to replace with." + }, + "allow-erasing": { + "type": "boolean", + "default": false, + "description": "Whether to allow erasing (removal) of packages in case of dependency problems." + } + }, + "required": [ + "old", + "new" + ], + "additionalProperties": false + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/files-latest.json b/test-files/schema/modules/files-latest.json index 614f8e41..e590a9d5 100644 --- a/test-files/schema/modules/files-latest.json +++ b/test-files/schema/modules/files-latest.json @@ -1,60 +1,244 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/files.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "files", - "description": "Copy files to your image at build time\nhttps://blue-build.org/reference/modules/files/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/files-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "files" + }, + { + "type": "string", + "const": "files@v1" + }, + { + "type": "string", + "const": "files@latest" + } + ], + "description": "Copy files to your image at build time\nhttps://blue-build.org/reference/modules/files/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "files": { + "anyOf": [ + { + "type": "array", + "items": { + "$ref": "#/$defs/RecordString" + } + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/SrcDest" + } + } + ], + "description": "List of files / folders to copy." + } }, - "files": { - "anyOf": [ - { - "type": "array", - "items": { - "$ref": "#/$defs/RecordString" - } - }, - { - "type": "array", - "items": { + "required": [ + "type", + "files" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { "type": "object", - "properties": { - "source": { - "type": "string" - }, - "destination": { + "properties": {}, + "additionalProperties": { "type": "string" - } + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SrcDest": { + "type": "object", + "properties": { + "source": { + "type": "string" + }, + "destination": { + "type": "string" + } + }, + "required": [ + "source", + "destination" + ], + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } }, "required": [ - "source", - "destination" + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } ] - } + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - ], - "description": "List of files / folders to copy." - } - }, - "required": [ - "type", - "files" - ], - "additionalProperties": false, - "$defs": { - "RecordString": { - "type": "object", - "properties": {}, - "additionalProperties": { - "type": "string" - } } - } } \ No newline at end of file diff --git a/test-files/schema/modules/files-v1.json b/test-files/schema/modules/files-v1.json index 614f8e41..72853023 100644 --- a/test-files/schema/modules/files-v1.json +++ b/test-files/schema/modules/files-v1.json @@ -1,60 +1,244 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/files.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "files", - "description": "Copy files to your image at build time\nhttps://blue-build.org/reference/modules/files/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/files-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "files" + }, + { + "type": "string", + "const": "files@v1" + }, + { + "type": "string", + "const": "files@latest" + } + ], + "description": "Copy files to your image at build time\nhttps://blue-build.org/reference/modules/files/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "files": { + "anyOf": [ + { + "type": "array", + "items": { + "$ref": "#/$defs/RecordString" + } + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/SrcDest" + } + } + ], + "description": "List of files / folders to copy." + } }, - "files": { - "anyOf": [ - { - "type": "array", - "items": { - "$ref": "#/$defs/RecordString" - } - }, - { - "type": "array", - "items": { + "required": [ + "type", + "files" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { "type": "object", - "properties": { - "source": { - "type": "string" - }, - "destination": { + "properties": {}, + "additionalProperties": { "type": "string" - } + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SrcDest": { + "type": "object", + "properties": { + "source": { + "type": "string" + }, + "destination": { + "type": "string" + } + }, + "required": [ + "source", + "destination" + ], + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } }, "required": [ - "source", - "destination" + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } ] - } + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - ], - "description": "List of files / folders to copy." - } - }, - "required": [ - "type", - "files" - ], - "additionalProperties": false, - "$defs": { - "RecordString": { - "type": "object", - "properties": {}, - "additionalProperties": { - "type": "string" - } } - } } \ No newline at end of file diff --git a/test-files/schema/modules/fonts-latest.json b/test-files/schema/modules/fonts-latest.json index 2f5c163d..74f2e3a0 100644 --- a/test-files/schema/modules/fonts-latest.json +++ b/test-files/schema/modules/fonts-latest.json @@ -1,41 +1,259 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/fonts.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "fonts", - "description": "The fonts module can be used to install fonts from Nerd Fonts or Google Fonts. \nhttps://blue-build.org/reference/modules/fonts/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/fonts-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "fonts" + }, + { + "type": "string", + "const": "fonts@v1" + }, + { + "type": "string", + "const": "fonts@latest" + } + ], + "description": "The fonts module can be used to install fonts from Nerd Fonts, Google Fonts, or custom URLs.\nhttps://blue-build.org/reference/modules/fonts/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "fonts": { + "$ref": "#/$defs/Fonts" + } }, - "fonts": { - "type": "object", - "properties": { - "nerd-fonts": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Nerd Fonts to install (without the \"Nerd Font\" suffix)." - }, - "google-fonts": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Google Fonts to install." + "required": [ + "type", + "fonts" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "Fonts": { + "type": "object", + "properties": { + "nerd-fonts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of Nerd Fonts to install (without the \"Nerd Font\" suffix)." + }, + "google-fonts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of Google Fonts to install." + }, + "url-fonts": { + "type": "array", + "items": { + "$ref": "#/$defs/UrlFont" + }, + "description": "List of custom URL fonts to install." + } + }, + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "UrlFont": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name for the font (will be used as directory name)." + }, + "url": { + "type": "string", + "description": "URL to download the font from (supports .otf, .ttf files and archives)." + } + }, + "required": [ + "name", + "url" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - } } - }, - "required": [ - "type", - "fonts" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/fonts-v1.json b/test-files/schema/modules/fonts-v1.json index 2f5c163d..1d9d2856 100644 --- a/test-files/schema/modules/fonts-v1.json +++ b/test-files/schema/modules/fonts-v1.json @@ -1,41 +1,259 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/fonts.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "fonts", - "description": "The fonts module can be used to install fonts from Nerd Fonts or Google Fonts. \nhttps://blue-build.org/reference/modules/fonts/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/fonts-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "fonts" + }, + { + "type": "string", + "const": "fonts@v1" + }, + { + "type": "string", + "const": "fonts@latest" + } + ], + "description": "The fonts module can be used to install fonts from Nerd Fonts, Google Fonts, or custom URLs.\nhttps://blue-build.org/reference/modules/fonts/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "fonts": { + "$ref": "#/$defs/Fonts" + } }, - "fonts": { - "type": "object", - "properties": { - "nerd-fonts": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Nerd Fonts to install (without the \"Nerd Font\" suffix)." - }, - "google-fonts": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of Google Fonts to install." + "required": [ + "type", + "fonts" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "Fonts": { + "type": "object", + "properties": { + "nerd-fonts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of Nerd Fonts to install (without the \"Nerd Font\" suffix)." + }, + "google-fonts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of Google Fonts to install." + }, + "url-fonts": { + "type": "array", + "items": { + "$ref": "#/$defs/UrlFont" + }, + "description": "List of custom URL fonts to install." + } + }, + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "UrlFont": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name for the font (will be used as directory name)." + }, + "url": { + "type": "string", + "description": "URL to download the font from (supports .otf, .ttf files and archives)." + } + }, + "required": [ + "name", + "url" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - } } - }, - "required": [ - "type", - "fonts" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/gnome-extensions-latest.json b/test-files/schema/modules/gnome-extensions-latest.json index d0c8e9bb..02344f3a 100644 --- a/test-files/schema/modules/gnome-extensions-latest.json +++ b/test-files/schema/modules/gnome-extensions-latest.json @@ -1,42 +1,231 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/gnome-extensions.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "gnome-extensions", - "description": "The gnome-extensions module can be used to install GNOME extensions inside system directory.\nhttps://blue-build.org/reference/modules/gnome-extensions/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/gnome-extensions-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "gnome-extensions" + }, + { + "type": "string", + "const": "gnome-extensions@v1" + }, + { + "type": "string", + "const": "gnome-extensions@latest" + } + ], + "description": "The gnome-extensions module can be used to install GNOME extensions inside system directory.\nhttps://blue-build.org/reference/modules/gnome-extensions/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "install": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "description": "List of GNOME extensions to install.\n(case sensitive extension names or extension IDs from https://extensions.gnome.org/)" + }, + "uninstall": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of system GNOME extensions to uninstall.\nOnly use this to remove extensions not installed by your package manager. Those extensions should be uninstalled using the package manager instead." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "install": { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - }, - "description": "List of GNOME extensions to install. \n(case sensitive extension names or extension IDs from https://extensions.gnome.org/)" - }, - "uninstall": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of system GNOME extensions to uninstall. \nOnly use this to remove extensions not installed by your package manager. Those extensions should be uninstalled using the package manager instead." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/gnome-extensions-v1.json b/test-files/schema/modules/gnome-extensions-v1.json index d0c8e9bb..330aa2d0 100644 --- a/test-files/schema/modules/gnome-extensions-v1.json +++ b/test-files/schema/modules/gnome-extensions-v1.json @@ -1,42 +1,231 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/gnome-extensions.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "gnome-extensions", - "description": "The gnome-extensions module can be used to install GNOME extensions inside system directory.\nhttps://blue-build.org/reference/modules/gnome-extensions/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/gnome-extensions-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "gnome-extensions" + }, + { + "type": "string", + "const": "gnome-extensions@v1" + }, + { + "type": "string", + "const": "gnome-extensions@latest" + } + ], + "description": "The gnome-extensions module can be used to install GNOME extensions inside system directory.\nhttps://blue-build.org/reference/modules/gnome-extensions/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "install": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "description": "List of GNOME extensions to install.\n(case sensitive extension names or extension IDs from https://extensions.gnome.org/)" + }, + "uninstall": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of system GNOME extensions to uninstall.\nOnly use this to remove extensions not installed by your package manager. Those extensions should be uninstalled using the package manager instead." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "install": { - "type": "array", - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - }, - "description": "List of GNOME extensions to install. \n(case sensitive extension names or extension IDs from https://extensions.gnome.org/)" - }, - "uninstall": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of system GNOME extensions to uninstall. \nOnly use this to remove extensions not installed by your package manager. Those extensions should be uninstalled using the package manager instead." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/gschema-overrides-latest.json b/test-files/schema/modules/gschema-overrides-latest.json index ed1a5fb4..3f9c4db9 100644 --- a/test-files/schema/modules/gschema-overrides-latest.json +++ b/test-files/schema/modules/gschema-overrides-latest.json @@ -1,28 +1,217 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/gschema-overrides.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "gschema-overrides", - "description": "The gschema-overrides module can be used for including system-setting overrides for GTK-based desktop environments.\nhttps://blue-build.org/reference/modules/gschema-overrides/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/gschema-overrides-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "gschema-overrides" + }, + { + "type": "string", + "const": "gschema-overrides@v1" + }, + { + "type": "string", + "const": "gschema-overrides@latest" + } + ], + "description": "The gschema-overrides module can be used for including system-setting overrides for GTK-based desktop environments.\nhttps://blue-build.org/reference/modules/gschema-overrides/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "include": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Gschema override files to test and copy to the correct place." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "include": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Gschema override files to test and copy to the correct place." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/gschema-overrides-v1.json b/test-files/schema/modules/gschema-overrides-v1.json index ed1a5fb4..95580ae0 100644 --- a/test-files/schema/modules/gschema-overrides-v1.json +++ b/test-files/schema/modules/gschema-overrides-v1.json @@ -1,28 +1,217 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/gschema-overrides.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "gschema-overrides", - "description": "The gschema-overrides module can be used for including system-setting overrides for GTK-based desktop environments.\nhttps://blue-build.org/reference/modules/gschema-overrides/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/gschema-overrides-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "gschema-overrides" + }, + { + "type": "string", + "const": "gschema-overrides@v1" + }, + { + "type": "string", + "const": "gschema-overrides@latest" + } + ], + "description": "The gschema-overrides module can be used for including system-setting overrides for GTK-based desktop environments.\nhttps://blue-build.org/reference/modules/gschema-overrides/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "include": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Gschema override files to test and copy to the correct place." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "include": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Gschema override files to test and copy to the correct place." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/initramfs-latest.json b/test-files/schema/modules/initramfs-latest.json new file mode 100644 index 00000000..382c0974 --- /dev/null +++ b/test-files/schema/modules/initramfs-latest.json @@ -0,0 +1,210 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/initramfs-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "initramfs" + }, + { + "type": "string", + "const": "initramfs@v1" + }, + { + "type": "string", + "const": "initramfs@latest" + } + ], + "description": "The initramfs module is used to regenerate initramfs, needed to apply some modifications early in the Linux startup process.\nhttps://blue-build.org/reference/modules/initramfs/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/initramfs-v1.json b/test-files/schema/modules/initramfs-v1.json new file mode 100644 index 00000000..429ef0ea --- /dev/null +++ b/test-files/schema/modules/initramfs-v1.json @@ -0,0 +1,210 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/initramfs-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "initramfs" + }, + { + "type": "string", + "const": "initramfs@v1" + }, + { + "type": "string", + "const": "initramfs@latest" + } + ], + "description": "The initramfs module is used to regenerate initramfs, needed to apply some modifications early in the Linux startup process.\nhttps://blue-build.org/reference/modules/initramfs/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/justfiles-latest.json b/test-files/schema/modules/justfiles-latest.json index 9198abf9..2708708b 100644 --- a/test-files/schema/modules/justfiles-latest.json +++ b/test-files/schema/modules/justfiles-latest.json @@ -1,33 +1,227 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/justfiles.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "justfiles", - "description": "The justfiles module makes it easy to include just recipes from multiple files in Universal Blue -based images.\nhttps://blue-build.org/reference/modules/justfiles/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/justfiles-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "justfiles" + }, + { + "type": "string", + "const": "justfiles@v1" + }, + { + "type": "string", + "const": "justfiles@latest" + } + ], + "description": "The justfiles module makes it easy to include just recipes from multiple files in Universal Blue -based images.\nhttps://blue-build.org/reference/modules/justfiles/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "validate": { + "type": "boolean", + "default": false, + "description": "Whether to validate the syntax of the justfiles against `just --fmt`. (warning: can be very unforgiving)" + }, + "include": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of files or subfolders to include into this image. If omitted, all justfiles will be included." + }, + "install": { + "type": "boolean", + "default": false, + "description": "Install `just` via the package manager. *" + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "validate": { - "type": "boolean", - "default": false, - "description": "Whether to validate the syntax of the justfiles against `just --fmt`. (warning: can be very unforgiving)" - }, - "include": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of files or subfolders to include into this image. If omitted, all justfiles will be included." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/justfiles-v1.json b/test-files/schema/modules/justfiles-v1.json index 9198abf9..3e03adc0 100644 --- a/test-files/schema/modules/justfiles-v1.json +++ b/test-files/schema/modules/justfiles-v1.json @@ -1,33 +1,227 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/justfiles.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "justfiles", - "description": "The justfiles module makes it easy to include just recipes from multiple files in Universal Blue -based images.\nhttps://blue-build.org/reference/modules/justfiles/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/justfiles-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "justfiles" + }, + { + "type": "string", + "const": "justfiles@v1" + }, + { + "type": "string", + "const": "justfiles@latest" + } + ], + "description": "The justfiles module makes it easy to include just recipes from multiple files in Universal Blue -based images.\nhttps://blue-build.org/reference/modules/justfiles/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "validate": { + "type": "boolean", + "default": false, + "description": "Whether to validate the syntax of the justfiles against `just --fmt`. (warning: can be very unforgiving)" + }, + "include": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of files or subfolders to include into this image. If omitted, all justfiles will be included." + }, + "install": { + "type": "boolean", + "default": false, + "description": "Install `just` via the package manager. *" + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "validate": { - "type": "boolean", - "default": false, - "description": "Whether to validate the syntax of the justfiles against `just --fmt`. (warning: can be very unforgiving)" - }, - "include": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of files or subfolders to include into this image. If omitted, all justfiles will be included." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/kargs-latest.json b/test-files/schema/modules/kargs-latest.json new file mode 100644 index 00000000..3034b198 --- /dev/null +++ b/test-files/schema/modules/kargs-latest.json @@ -0,0 +1,222 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/kargs-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "kargs" + }, + { + "type": "string", + "const": "kargs@v1" + }, + { + "type": "string", + "const": "kargs@latest" + } + ], + "description": "The kargs module injects kernel arguments into the image.\nhttps://blue-build.org/reference/modules/kargs/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "arch": { + "type": "string", + "description": "Defines on which OS architectures are kargs applied. Defaults to all architectures if omitted." + }, + "kargs": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Kargs to inject in the image." + } + }, + "required": [ + "type", + "kargs" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/kargs-v1.json b/test-files/schema/modules/kargs-v1.json new file mode 100644 index 00000000..f8ce25f1 --- /dev/null +++ b/test-files/schema/modules/kargs-v1.json @@ -0,0 +1,222 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/kargs-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "kargs" + }, + { + "type": "string", + "const": "kargs@v1" + }, + { + "type": "string", + "const": "kargs@latest" + } + ], + "description": "The kargs module injects kernel arguments into the image.\nhttps://blue-build.org/reference/modules/kargs/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "arch": { + "type": "string", + "description": "Defines on which OS architectures are kargs applied. Defaults to all architectures if omitted." + }, + "kargs": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Kargs to inject in the image." + } + }, + "required": [ + "type", + "kargs" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/os-release-latest.json b/test-files/schema/modules/os-release-latest.json new file mode 100644 index 00000000..c247b8d2 --- /dev/null +++ b/test-files/schema/modules/os-release-latest.json @@ -0,0 +1,215 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/os-release-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "os-release" + }, + { + "type": "string", + "const": "os-release@v1" + }, + { + "type": "string", + "const": "os-release@latest" + } + ], + "description": "The `os-release` module offers a way to modify and set values in the `/etc/os-release` file in your image.\nhttps://blue-build.org/reference/modules/os-release/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "properties": { + "$ref": "#/$defs/RecordString", + "description": "The properties of the `/etc/os-release` file to set." + } + }, + "required": [ + "type", + "properties" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/os-release-v1.json b/test-files/schema/modules/os-release-v1.json new file mode 100644 index 00000000..830468a4 --- /dev/null +++ b/test-files/schema/modules/os-release-v1.json @@ -0,0 +1,215 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/os-release-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "os-release" + }, + { + "type": "string", + "const": "os-release@v1" + }, + { + "type": "string", + "const": "os-release@latest" + } + ], + "description": "The `os-release` module offers a way to modify and set values in the `/etc/os-release` file in your image.\nhttps://blue-build.org/reference/modules/os-release/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "properties": { + "$ref": "#/$defs/RecordString", + "description": "The properties of the `/etc/os-release` file to set." + } + }, + "required": [ + "type", + "properties" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/pacman-latest.json b/test-files/schema/modules/pacman-latest.json new file mode 100644 index 00000000..e2e6bd11 --- /dev/null +++ b/test-files/schema/modules/pacman-latest.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/pacman-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "pacman" + }, + { + "type": "string", + "const": "pacman@v1" + }, + { + "type": "string", + "const": "pacman@latest" + } + ], + "description": "The pacman module offers pseudo-declarative package and repository management using pacman.\nhttps://blue-build.org/reference/modules/pacman/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "remove": { + "$ref": "#/$defs/PacmanRemove", + "description": "Configuration of packages removal." + }, + "install": { + "$ref": "#/$defs/PacmanInstall", + "description": "Configuration of packages install." + } + }, + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "PacmanRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to remove." + } + }, + "required": [ + "packages" + ] + }, + "PacmanInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to install." + } + }, + "required": [ + "packages" + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/pacman-v1.json b/test-files/schema/modules/pacman-v1.json new file mode 100644 index 00000000..0ec2473b --- /dev/null +++ b/test-files/schema/modules/pacman-v1.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/pacman-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "pacman" + }, + { + "type": "string", + "const": "pacman@v1" + }, + { + "type": "string", + "const": "pacman@latest" + } + ], + "description": "The pacman module offers pseudo-declarative package and repository management using pacman.\nhttps://blue-build.org/reference/modules/pacman/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "remove": { + "$ref": "#/$defs/PacmanRemove", + "description": "Configuration of packages removal." + }, + "install": { + "$ref": "#/$defs/PacmanInstall", + "description": "Configuration of packages install." + } + }, + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "PacmanRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to remove." + } + }, + "required": [ + "packages" + ] + }, + "PacmanInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to install." + } + }, + "required": [ + "packages" + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/rpm-ostree-latest.json b/test-files/schema/modules/rpm-ostree-latest.json index 3331cb83..aa3e992b 100644 --- a/test-files/schema/modules/rpm-ostree-latest.json +++ b/test-files/schema/modules/rpm-ostree-latest.json @@ -1,80 +1,273 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/rpm-ostree.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "rpm-ostree", - "description": "The rpm-ostree module offers pseudo-declarative package and repository management using rpm-ostree.\nhttps://blue-build.org/reference/modules/rpm-ostree/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "repos": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of links to .repo files to download into /etc/yum.repos.d/." - }, - "keys": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of links to key files to import for installing from custom repositories." - }, - "optfix": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of folder names under /opt/ to enable for installing into." - }, - "install": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of RPM packages to install." - }, - "remove": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of RPM packages to remove." - }, - "replace": { - "type": "array", - "items": { - "type": "object", - "properties": { - "from-repo": { - "type": "string", - "description": "URL to the source COPR repo for the new packages." - }, - "packages": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/rpm-ostree-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "rpm-ostree" + }, + { + "type": "string", + "const": "rpm-ostree@v1" + }, + { + "type": "string", + "const": "rpm-ostree@latest" + } + ], + "description": "The rpm-ostree module offers pseudo-declarative package and repository management using rpm-ostree.\nhttps://blue-build.org/reference/modules/rpm-ostree/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "repos": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of links to .repo files to download into /etc/yum.repos.d/." + }, + "keys": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of links to key files to import for installing from custom repositories." + }, + "optfix": { + "type": "array", + "items": { + "type": "string" + }, + "description": "DEPRECATED: List of folder names under /opt/ to enable for installing into." + }, + "install": { "type": "array", "items": { - "type": "string" + "type": "string" + }, + "description": "List of RPM packages to install." + }, + "remove": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM packages to remove." + }, + "replace": { + "type": "array", + "items": { + "$ref": "#/$defs/RpmOstreeReplace" + }, + "description": "List of configurations for `rpm-ostree override replace`ing packages." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "RpmOstreeReplace": { + "type": "object", + "properties": { + "from-repo": { + "type": "string", + "description": "URL to the source COPR repo for the new packages." + }, + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to replace using packages from the defined repo." + } + }, + "required": [ + "from-repo", + "packages" + ], + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } }, - "description": "List of packages to replace using packages from the defined repo." - } - }, - "required": [ - "from-repo", - "packages" - ] - }, - "description": "List of configurations for `rpm-ostree override replace`ing packages." + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/rpm-ostree-v1.json b/test-files/schema/modules/rpm-ostree-v1.json index 3331cb83..95f506ca 100644 --- a/test-files/schema/modules/rpm-ostree-v1.json +++ b/test-files/schema/modules/rpm-ostree-v1.json @@ -1,80 +1,273 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/rpm-ostree.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "rpm-ostree", - "description": "The rpm-ostree module offers pseudo-declarative package and repository management using rpm-ostree.\nhttps://blue-build.org/reference/modules/rpm-ostree/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "repos": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of links to .repo files to download into /etc/yum.repos.d/." - }, - "keys": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of links to key files to import for installing from custom repositories." - }, - "optfix": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of folder names under /opt/ to enable for installing into." - }, - "install": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of RPM packages to install." - }, - "remove": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of RPM packages to remove." - }, - "replace": { - "type": "array", - "items": { - "type": "object", - "properties": { - "from-repo": { - "type": "string", - "description": "URL to the source COPR repo for the new packages." - }, - "packages": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/rpm-ostree-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "rpm-ostree" + }, + { + "type": "string", + "const": "rpm-ostree@v1" + }, + { + "type": "string", + "const": "rpm-ostree@latest" + } + ], + "description": "The rpm-ostree module offers pseudo-declarative package and repository management using rpm-ostree.\nhttps://blue-build.org/reference/modules/rpm-ostree/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "repos": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of links to .repo files to download into /etc/yum.repos.d/." + }, + "keys": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of links to key files to import for installing from custom repositories." + }, + "optfix": { + "type": "array", + "items": { + "type": "string" + }, + "description": "DEPRECATED: List of folder names under /opt/ to enable for installing into." + }, + "install": { "type": "array", "items": { - "type": "string" + "type": "string" + }, + "description": "List of RPM packages to install." + }, + "remove": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of RPM packages to remove." + }, + "replace": { + "type": "array", + "items": { + "$ref": "#/$defs/RpmOstreeReplace" + }, + "description": "List of configurations for `rpm-ostree override replace`ing packages." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "RpmOstreeReplace": { + "type": "object", + "properties": { + "from-repo": { + "type": "string", + "description": "URL to the source COPR repo for the new packages." + }, + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to replace using packages from the defined repo." + } + }, + "required": [ + "from-repo", + "packages" + ], + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } }, - "description": "List of packages to replace using packages from the defined repo." - } - }, - "required": [ - "from-repo", - "packages" - ] - }, - "description": "List of configurations for `rpm-ostree override replace`ing packages." + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/script-latest.json b/test-files/schema/modules/script-latest.json index cf20fdae..2c95f7b8 100644 --- a/test-files/schema/modules/script-latest.json +++ b/test-files/schema/modules/script-latest.json @@ -1,35 +1,212 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/script.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "script", - "description": "The script module can be used to run arbitrary bash snippets and scripts at image build time.\nhttps://blue-build.org/reference/modules/script/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/script-latest.json", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "script@v1", + "description": "The script module can be used to run arbitrary bash snippets and scripts at image build time.\nhttps://blue-build.org/reference/modules/script/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "snippets": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of bash one-liners to run." + }, + "scripts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of script files to run." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "snippets": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of bash one-liners to run." - }, - "scripts": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of script files to run." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/script-v1.json b/test-files/schema/modules/script-v1.json index cf20fdae..c200ed12 100644 --- a/test-files/schema/modules/script-v1.json +++ b/test-files/schema/modules/script-v1.json @@ -1,35 +1,212 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/script.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "script", - "description": "The script module can be used to run arbitrary bash snippets and scripts at image build time.\nhttps://blue-build.org/reference/modules/script/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/script-v1.json", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "script@v1", + "description": "The script module can be used to run arbitrary bash snippets and scripts at image build time.\nhttps://blue-build.org/reference/modules/script/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "snippets": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of bash one-liners to run." + }, + "scripts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of script files to run." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "snippets": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of bash one-liners to run." - }, - "scripts": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of script files to run." + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/script-v2.json b/test-files/schema/modules/script-v2.json new file mode 100644 index 00000000..7bdb447c --- /dev/null +++ b/test-files/schema/modules/script-v2.json @@ -0,0 +1,224 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/script-v2.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "script" + }, + { + "type": "string", + "const": "script@v2" + }, + { + "type": "string", + "const": "script@latest" + } + ], + "description": "The script module can be used to run arbitrary posix shell snippets and scripts at image build time.\nhttps://blue-build.org/reference/modules/script/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "snippets": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of bash one-liners to run." + }, + "scripts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of script files to run." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/signing-latest.json b/test-files/schema/modules/signing-latest.json index 212a27c2..f9bd230f 100644 --- a/test-files/schema/modules/signing-latest.json +++ b/test-files/schema/modules/signing-latest.json @@ -1,21 +1,210 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/signing.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "signing", - "description": "The signing module is used to install the required signing policies for cosign image verification with rpm-ostree and bootc.\nhttps://blue-build.org/reference/modules/signing/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/signing-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "signing" + }, + { + "type": "string", + "const": "signing@v1" + }, + { + "type": "string", + "const": "signing@latest" + } + ], + "description": "The signing module is used to install the required signing policies for cosign image verification with rpm-ostree and bootc.\nhttps://blue-build.org/reference/modules/signing/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/signing-v1.json b/test-files/schema/modules/signing-v1.json index 212a27c2..6e152466 100644 --- a/test-files/schema/modules/signing-v1.json +++ b/test-files/schema/modules/signing-v1.json @@ -1,21 +1,210 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/signing.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "signing", - "description": "The signing module is used to install the required signing policies for cosign image verification with rpm-ostree and bootc.\nhttps://blue-build.org/reference/modules/signing/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/signing-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "signing" + }, + { + "type": "string", + "const": "signing@v1" + }, + { + "type": "string", + "const": "signing@latest" + } + ], + "description": "The signing module is used to install the required signing policies for cosign image verification with rpm-ostree and bootc.\nhttps://blue-build.org/reference/modules/signing/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/soar-latest.json b/test-files/schema/modules/soar-latest.json new file mode 100644 index 00000000..56498295 --- /dev/null +++ b/test-files/schema/modules/soar-latest.json @@ -0,0 +1,225 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/soar-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "soar" + }, + { + "type": "string", + "const": "soar@v1" + }, + { + "type": "string", + "const": "soar@latest" + } + ], + "description": "The soar module installs & integrates soar package manager, as an alternative to Homebrew / Linuxbrew.\nhttps://blue-build.org/reference/modules/soar/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "auto-upgrade": { + "type": "boolean", + "default": true, + "description": "Whether to auto-upgrade all installed `soar` packages using a systemd service." + }, + "upgrade-interval": { + "type": "string", + "default": "8h", + "description": "Defines how often the `soar` upgrade service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "additional-repos": { + "type": "boolean", + "default": false, + "description": "This is a placeholder option which currently does nothing, as it was used before when there were multiple available repos. It may be repurposed to be used in the future." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/soar-v1.json b/test-files/schema/modules/soar-v1.json new file mode 100644 index 00000000..e94eb74a --- /dev/null +++ b/test-files/schema/modules/soar-v1.json @@ -0,0 +1,225 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/soar-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "soar" + }, + { + "type": "string", + "const": "soar@v1" + }, + { + "type": "string", + "const": "soar@latest" + } + ], + "description": "The soar module installs & integrates soar package manager, as an alternative to Homebrew / Linuxbrew.\nhttps://blue-build.org/reference/modules/soar/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "auto-upgrade": { + "type": "boolean", + "default": true, + "description": "Whether to auto-upgrade all installed `soar` packages using a systemd service." + }, + "upgrade-interval": { + "type": "string", + "default": "8h", + "description": "Defines how often the `soar` upgrade service should run. The string is passed directly to `OnUnitInactiveSec` in systemd timer. (Syntax: ['1d', '6h', '10m'])." + }, + "additional-repos": { + "type": "boolean", + "default": false, + "description": "This is a placeholder option which currently does nothing, as it was used before when there were multiple available repos. It may be repurposed to be used in the future." + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/systemd-latest.json b/test-files/schema/modules/systemd-latest.json index e94d0432..25eda094 100644 --- a/test-files/schema/modules/systemd-latest.json +++ b/test-files/schema/modules/systemd-latest.json @@ -1,89 +1,252 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/systemd.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "systemd", - "description": "The systemd module streamlines the management of systemd units during image building.\nhttps://blue-build.org/reference/modules/systemd/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "system": { - "type": "object", - "properties": { - "enabled": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to enable. (runs on system boot)" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/systemd-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "systemd" + }, + { + "type": "string", + "const": "systemd@v1" + }, + { + "type": "string", + "const": "systemd@latest" + } + ], + "description": "The systemd module streamlines the management of systemd units during image building.\nhttps://blue-build.org/reference/modules/systemd/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" }, - "disabled": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to disable. (does not run on system boot, unless another unit strictly requires it)" + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." }, - "masked": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to mask. (does not run on system boot, under any circumstances)" + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." }, - "unmasked": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to unmask. (runs on system boot, even if previously masked)" + "system": { + "$ref": "#/$defs/UnitConfig", + "description": "System unit configuration." + }, + "user": { + "$ref": "#/$defs/UnitConfig", + "description": "User unit configuration (with --global to make changes for all users)." } - }, - "description": "System unit configuration." }, - "user": { - "type": "object", - "properties": { - "enabled": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to enable. (runs for the users)" + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "UnitConfig": { + "type": "object", + "properties": { + "enabled": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of systemd units to enable. (runs on system boot)" + }, + "disabled": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of systemd units to disable. (does not run on system boot, unless another unit strictly requires it)" + }, + "masked": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of systemd units to mask. (does not run on system boot, under any circumstances)" + }, + "unmasked": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of systemd units to unmask. (runs on system boot, even if previously masked)" + } + }, + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false }, - "disabled": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to disable. (does not run for the users, unless another unit strictly requires it)" + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] }, - "masked": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to mask. (does not run for the users, under any circumstances)" + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false }, - "unmasked": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to unmask. (runs for the users, even if previously masked)" + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - }, - "description": "User unit configuration (with --global to make changes for all users)." } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/systemd-v1.json b/test-files/schema/modules/systemd-v1.json index e94d0432..8a954716 100644 --- a/test-files/schema/modules/systemd-v1.json +++ b/test-files/schema/modules/systemd-v1.json @@ -1,89 +1,252 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/systemd.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "systemd", - "description": "The systemd module streamlines the management of systemd units during image building.\nhttps://blue-build.org/reference/modules/systemd/" - }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "system": { - "type": "object", - "properties": { - "enabled": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to enable. (runs on system boot)" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/systemd-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "systemd" + }, + { + "type": "string", + "const": "systemd@v1" + }, + { + "type": "string", + "const": "systemd@latest" + } + ], + "description": "The systemd module streamlines the management of systemd units during image building.\nhttps://blue-build.org/reference/modules/systemd/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" }, - "disabled": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to disable. (does not run on system boot, unless another unit strictly requires it)" + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." }, - "masked": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to mask. (does not run on system boot, under any circumstances)" + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." }, - "unmasked": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to unmask. (runs on system boot, even if previously masked)" + "system": { + "$ref": "#/$defs/UnitConfig", + "description": "System unit configuration." + }, + "user": { + "$ref": "#/$defs/UnitConfig", + "description": "User unit configuration (with --global to make changes for all users)." } - }, - "description": "System unit configuration." }, - "user": { - "type": "object", - "properties": { - "enabled": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to enable. (runs for the users)" + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "UnitConfig": { + "type": "object", + "properties": { + "enabled": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of systemd units to enable. (runs on system boot)" + }, + "disabled": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of systemd units to disable. (does not run on system boot, unless another unit strictly requires it)" + }, + "masked": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of systemd units to mask. (does not run on system boot, under any circumstances)" + }, + "unmasked": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of systemd units to unmask. (runs on system boot, even if previously masked)" + } + }, + "additionalProperties": false + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false }, - "disabled": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to disable. (does not run for the users, unless another unit strictly requires it)" + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] }, - "masked": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to mask. (does not run for the users, under any circumstances)" + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false }, - "unmasked": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of systemd units to unmask. (runs for the users, even if previously masked)" + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false } - }, - "description": "User unit configuration (with --global to make changes for all users)." } - }, - "required": [ - "type" - ], - "additionalProperties": false } \ No newline at end of file diff --git a/test-files/schema/modules/yafti-latest.json b/test-files/schema/modules/yafti-latest.json index d3914c98..3386824a 100644 --- a/test-files/schema/modules/yafti-latest.json +++ b/test-files/schema/modules/yafti-latest.json @@ -1,37 +1,217 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/yafti.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "yafti", - "description": "The yafti module can be used to install yafti and set it up to run on first boot.\nhttps://blue-build.org/reference/modules/yafti/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/yafti-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "yafti" + }, + { + "type": "string", + "const": "yafti@v1" + }, + { + "type": "string", + "const": "yafti@latest" + } + ], + "description": "The yafti module can be used to install yafti and set it up to run on first boot.\nhttps://blue-build.org/reference/modules/yafti/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "custom-flatpaks": { + "type": "array", + "items": { + "$ref": "#/$defs/RecordString" + }, + "description": "List of custom Flatpaks to inject to the default yafti.yml. Format is: `PrettyName: org.example.flatpak_id`" + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "custom-flatpaks": { - "type": "array", - "items": { - "$ref": "#/$defs/RecordString" - }, - "description": "List of custom Flatpaks to inject to the default yafti.yml. Format is: `PrettyName: org.example.flatpak_id`" - } - }, - "required": [ - "type" - ], - "additionalProperties": false, - "$defs": { - "RecordString": { - "type": "object", - "properties": {}, - "additionalProperties": { - "type": "string" - } + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - } } \ No newline at end of file diff --git a/test-files/schema/modules/yafti-v1.json b/test-files/schema/modules/yafti-v1.json index d3914c98..0d5aeabd 100644 --- a/test-files/schema/modules/yafti-v1.json +++ b/test-files/schema/modules/yafti-v1.json @@ -1,37 +1,217 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "/modules/yafti.json", - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "yafti", - "description": "The yafti module can be used to install yafti and set it up to run on first boot.\nhttps://blue-build.org/reference/modules/yafti/" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/yafti-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "yafti" + }, + { + "type": "string", + "const": "yafti@v1" + }, + { + "type": "string", + "const": "yafti@latest" + } + ], + "description": "The yafti module can be used to install yafti and set it up to run on first boot.\nhttps://blue-build.org/reference/modules/yafti/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "custom-flatpaks": { + "type": "array", + "items": { + "$ref": "#/$defs/RecordString" + }, + "description": "List of custom Flatpaks to inject to the default yafti.yml. Format is: `PrettyName: org.example.flatpak_id`" + } }, - "no-cache": { - "type": "boolean", - "default": false, - "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" - }, - "custom-flatpaks": { - "type": "array", - "items": { - "$ref": "#/$defs/RecordString" - }, - "description": "List of custom Flatpaks to inject to the default yafti.yml. Format is: `PrettyName: org.example.flatpak_id`" - } - }, - "required": [ - "type" - ], - "additionalProperties": false, - "$defs": { - "RecordString": { - "type": "object", - "properties": {}, - "additionalProperties": { - "type": "string" - } + "required": [ + "type" + ], + "additionalProperties": false, + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } } - } } \ No newline at end of file diff --git a/test-files/schema/modules/zypper-latest.json b/test-files/schema/modules/zypper-latest.json new file mode 100644 index 00000000..5c932a8a --- /dev/null +++ b/test-files/schema/modules/zypper-latest.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/zypper-latest.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "zypper" + }, + { + "type": "string", + "const": "zypper@v1" + }, + { + "type": "string", + "const": "zypper@latest" + } + ], + "description": "The zypper module offers pseudo-declarative package and repository management using zypper.\nhttps://blue-build.org/reference/modules/zypper/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "remove": { + "$ref": "#/$defs/ZypperRemove", + "description": "Configuration of packages removal." + }, + "install": { + "$ref": "#/$defs/ZypperInstall", + "description": "Configuration of packages install." + } + }, + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "ZypperRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to remove." + } + }, + "required": [ + "packages" + ] + }, + "ZypperInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to install." + } + }, + "required": [ + "packages" + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/modules/zypper-v1.json b/test-files/schema/modules/zypper-v1.json new file mode 100644 index 00000000..daf375a0 --- /dev/null +++ b/test-files/schema/modules/zypper-v1.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "/modules/zypper-v1.json", + "type": "object", + "properties": { + "type": { + "anyOf": [ + { + "type": "string", + "const": "zypper" + }, + { + "type": "string", + "const": "zypper@v1" + }, + { + "type": "string", + "const": "zypper@latest" + } + ], + "description": "The zypper module offers pseudo-declarative package and repository management using zypper.\nhttps://blue-build.org/reference/modules/zypper/" + }, + "no-cache": { + "type": "boolean", + "default": false, + "description": "Whether to disabling caching for this layer.\nhttps://blue-build.org/reference/module/#no-cache-optional" + }, + "env": { + "$ref": "#/$defs/RecordString", + "description": "Environment variables to add for the module call." + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/$defs/Secret" + }, + "description": "Secrets to mount for this module call." + }, + "remove": { + "$ref": "#/$defs/ZypperRemove", + "description": "Configuration of packages removal." + }, + "install": { + "$ref": "#/$defs/ZypperInstall", + "description": "Configuration of packages install." + } + }, + "required": [ + "type" + ], + "$defs": { + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Secret": { + "oneOf": [ + { + "$ref": "#/$defs/SecretEnv" + }, + { + "$ref": "#/$defs/SecretFile" + }, + { + "$ref": "#/$defs/SecretExec" + }, + { + "$ref": "#/$defs/SecretSsh" + } + ] + }, + "ZypperRemove": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to remove." + } + }, + "required": [ + "packages" + ] + }, + "ZypperInstall": { + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of packages to install." + } + }, + "required": [ + "packages" + ] + }, + "SecretEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from an environment variable." + }, + "name": { + "type": "string", + "description": "The name of the environment variable" + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "name", + "mount" + ], + "additionalProperties": false + }, + "SecretFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file." + }, + "source": { + "type": "string", + "description": "The source file containing the secret.\n\nNOTE: Relative paths are relative to the root of the repository." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "source", + "mount" + ], + "additionalProperties": false + }, + "SecretExec": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "exec", + "description": "A secret pulled from the stdout of a command." + }, + "command": { + "type": "string", + "description": "The command that will be executed." + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for the command being executed." + }, + "mount": { + "$ref": "#/$defs/SecretMount", + "description": "Defines the mount type for the result of the command into the build." + } + }, + "required": [ + "type", + "command", + "mount" + ], + "additionalProperties": false + }, + "SecretSsh": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ssh", + "description": "Mount the SSH socket to use the hosts SSH socket." + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "SecretMount": { + "oneOf": [ + { + "$ref": "#/$defs/SecretMountEnv" + }, + { + "$ref": "#/$defs/SecretMountFile" + } + ] + }, + "SecretMountEnv": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "env", + "description": "A secret pulled from a file on the host system." + }, + "name": { + "type": "string", + "description": "The environment variable where the secret will be set." + } + }, + "required": [ + "type", + "name" + ], + "additionalProperties": false + }, + "SecretMountFile": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file", + "description": "A secret pulled from a file on the host system." + }, + "destination": { + "type": "string", + "description": "The destination path in the build to mount the secret." + } + }, + "required": [ + "type", + "destination" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/recipe-v1.json b/test-files/schema/recipe-v1.json index 56c8117a..1bfc032b 100644 --- a/test-files/schema/recipe-v1.json +++ b/test-files/schema/recipe-v1.json @@ -1,98 +1,137 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "recipe-v1.json", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The image name. Used when publishing to GHCR as `ghcr.io/user/name`." - }, - "description": { - "type": "string", - "description": "The image description. Published to GHCR in the image metadata." - }, - "alt-tags": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Allows setting custom tags on the recipe’s final image.\nAdding tags to this property will override the `latest` and timestamp tags." - }, - "base-image": { - "type": "string", - "description": "The [OCI](https://opencontainers.org/) image to base your custom image on.\nOnly atomic Fedora images and those based on them are officially supported.\nUniversal Blue is recommended. [A list of Universal Blue's images](https://universal-blue.org/images/) can be found on their website\nBlueBuild-built images can be used as well." - }, - "image-version": { - "anyOf": [ - { - "type": "string" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "recipe-v1.json", + "type": "object", + "properties": { + "version": { + "type": "number", + "const": 1, + "description": "The version of the recipe file schema." }, - { - "type": "integer" - } - ], - "description": "The tag of the base image to build on.\nUsed to select a version explicitly (`40`) or to always use the latest stable version (`latest`).\nA list of all available tags can be viewed by pasting your `base-image` url into your browser." - }, - "blue-build-tag": { - "type": "string", - "description": "The tag to pull for the bluebuild cli. This is mostly used for\ntrying out specific versions of the cli without compiling it locally." - }, - "stages": { - "type": "array", - "items": { - "$ref": "#/$defs/StageEntry" - }, - "description": "A list of [stages](https://blue-build.org/reference/stages/) that are executed before the build of the final image.\nThis is useful for compiling programs from source without polluting the final bootable image." - }, - "modules": { - "type": "array", - "items": { - "$ref": "#/$defs/ModuleEntry" - }, - "description": "A list of [modules](https://blue-build.org/reference/module/) that is executed in order. Multiple of the same module can be included.\n\nEach item in this list should have at least a `type:` or be specified to be included from an external file in the `recipes/` directory with `from-file:`." - } - }, - "required": [ - "name", - "description", - "base-image", - "image-version", - "modules" - ], - "additionalProperties": false, - "$defs": { - "StageEntry": { - "anyOf": [ - { - "$ref": "stage-v1.json" + "name": { + "type": "string", + "description": "The image name. Used when publishing to GHCR as `ghcr.io/user/name`." }, - { - "$ref": "#/$defs/ImportedModule" - } - ] - }, - "ModuleEntry": { - "anyOf": [ - { - "$ref": "module-v1.json" + "description": { + "type": "string", + "description": "The image description. Published to GHCR in the image metadata." + }, + "alt-tags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Allows setting custom tags on the recipe’s final image.\nAdding tags to this property will override the `latest` and timestamp tags." }, - { - "$ref": "#/$defs/ImportedModule" + "base-image": { + "type": "string", + "description": "The [OCI](https://opencontainers.org/) image to base your custom image on.\nOnly atomic Fedora images and those based on them are officially supported as of now.\n[BlueBuild base images](https://github.com/blue-build/base-images) or [Universal Blue images](https://universal-blue.org/images/) are recommended.\nOther custom bootc images can be used as well.\n\nExample:\n```yaml\nbase-image: ghcr.io/blue-build/base-images/fedora-silverblue\n```" + }, + "image-version": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "description": "The tag of the base image to build on.\nUsed to select a version explicitly (`40`) or to always use the latest stable version (`latest`).\nA list of all available tags can be viewed by pasting your `base-image` url into your browser." + }, + "blue-build-tag": { + "type": "string", + "description": "The tag to pull for the BlueBuild cli. This is mostly used for\ntrying out specific versions of the cli without compiling it locally.\nSupply the tag of the cli release container to pull, see [the list of available tags](https://github.com/blue-build/cli/pkgs/container/cli) for reference.\nDefault: `latest-installer`. Set to to `none` to opt out of installing the CLI into your image." + }, + "cosign-version": { + "type": "string", + "description": "The version of cosign that will be included in the image.\nThis will override the default version set by the CLI.\nSetting to `none` will prevent installing cosign altogether." + }, + "nushell-version": { + "type": "string", + "description": "The version of nushell to include at `/usr/libexec/bluebuild/nu/nu` for use by modules in the image.\nThis will override the default BlueBuild Nushell version.\nChange only if you need a specific version of Nushell, changing this might break some BlueBuild modules.\nSet to to `none` to opt out of installing Nushell into your image (this will break modules that use Nushell at run time in the final image, like `default-flatpaks`)." + }, + "platforms": { + "type": "array", + "items": { + "$ref": "#/$defs/Platform" + }, + "description": "Specify a list of the platforms to build for your image.\nThe resulting images will be added to a manifest list that allows your host’s container runtime to pull the correct image architecture for your hardware. The process of building a multi-architecture image will end up using emulation. Consequently, image builds will take significantly longer and more space will be required on the build host since each platform that is being built is its own image. If `platforms:` is not specified, the build host’s architecture will be used." + }, + "labels": { + "$ref": "#/$defs/RecordString", + "description": "A collection of custom labels that will be applied to the image.\n\nEach item should be a `key: value` pair representing a label name mapping to label value." + }, + "stages": { + "type": "array", + "items": { + "$ref": "#/$defs/StageEntry" + }, + "description": "A list of [stages](https://blue-build.org/reference/stages/) that are executed before the build of the final image.\nThis is useful for compiling programs from source without polluting the final bootable image." + }, + "modules": { + "type": "array", + "items": { + "$ref": "#/$defs/ModuleEntry" + }, + "description": "A list of [modules](https://blue-build.org/reference/module/) that is executed in order. Multiple of the same module can be included.\n\nEach item in this list needs have at least a `type:` except if the configuration is included from an external file in the `recipes/` directory with [`from-file:`](https://blue-build.org/how-to/multiple-files/).\n\nExample:\n\n```yaml\nmodules:\n - from-file: common-packages.yml # an external module configuration file for installing commong packages\n - type: signing # a module that doesn't require any configuration\n```" } - ] }, - "ImportedModule": { - "type": "object", - "properties": { - "from-file": { - "type": "string", - "description": "The path to another file containing module configuration to import here.\nhttps://blue-build.org/how-to/multiple-files/" + "required": [ + "name", + "description", + "base-image", + "image-version", + "modules" + ], + "additionalProperties": false, + "$defs": { + "Platform": { + "type": "string", + "enum": [ + "linux/amd64", + "linux/amd64/v2", + "linux/arm64", + "linux/arm", + "linux/arm/v6", + "linux/arm/v7", + "linux/386", + "linux/loong64", + "linux/mips", + "linux/mipsle", + "linux/mips64", + "linux/mips64le", + "linux/ppc64", + "linux/ppc64le", + "linux/riscv64", + "linux/s390x" + ] + }, + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "StageEntry": { + "oneOf": [ + { + "$ref": "stage-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] + }, + "ModuleEntry": { + "oneOf": [ + { + "$ref": "module-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] } - }, - "required": [ - "from-file" - ], - "additionalProperties": false } - } } \ No newline at end of file diff --git a/test-files/schema/recipe-v2.json b/test-files/schema/recipe-v2.json new file mode 100644 index 00000000..a4106ccb --- /dev/null +++ b/test-files/schema/recipe-v2.json @@ -0,0 +1,218 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "recipe-v2.json", + "type": "object", + "properties": { + "version": { + "type": "number", + "const": 2, + "description": "The version of the recipe file schema." + }, + "base": { + "$ref": "#/$defs/RecipeV2BaseImage", + "description": "Options for the base image like the image and public key." + }, + "metadata": { + "$ref": "#/$defs/RecipeV2Metadata", + "description": "Metadata for the image like the name, description, and labels." + }, + "spec": { + "$ref": "#/$defs/RecipeV2Spec", + "description": "Specifications for the image that modifies how it is built and published." + }, + "stages": { + "type": "array", + "items": { + "$ref": "#/$defs/StageEntry" + }, + "description": "A list of [stages](https://blue-build.org/reference/stages/) that are executed before the build of the final image.\nThis is useful for compiling programs from source without polluting the final bootable image." + }, + "modules": { + "type": "array", + "items": { + "$ref": "#/$defs/ModuleEntry" + }, + "description": "A list of [modules](https://blue-build.org/reference/module/) that is executed in order. Multiple of the same module can be included.\n\nEach item in this list needs have at least a `type:` except if the configuration is included from an external file in the `recipes/` directory with [`from-file:`](https://blue-build.org/how-to/multiple-files/).\n\nExample:\n\n```yaml\nmodules:\n - from-file: common-packages.yml # an external module configuration file for installing commong packages\n - type: signing # a module that doesn't require any configuration\n```" + } + }, + "required": [ + "version", + "base", + "metadata", + "modules" + ], + "additionalProperties": false, + "$defs": { + "RecipeV2BaseImage": { + "type": "object", + "properties": { + "image": { + "$ref": "#/$defs/RecipeV2BaseImageRef", + "description": "The base image ref." + }, + "public-key": { + "type": "string", + "description": "The public key used to verify the base image signature.\nThis will validate the image before building with it.\n\nURLs are supported. Paths are relative to the root of the project." + } + }, + "required": [ + "image" + ], + "additionalProperties": false + }, + "RecipeV2Metadata": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The image name. Used when publishing to GHCR as `ghcr.io/user/name`." + }, + "description": { + "type": "string", + "description": "The image description. Published to GHCR in the image metadata." + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Allows setting custom tags on the recipe’s final image.\nAdding tags to this property will override the `latest` and timestamp tags." + }, + "labels": { + "$ref": "#/$defs/RecordString", + "description": "A collection of custom labels that will be applied to the image.\n\nEach item should be a `key: value` pair representing a label name mapping to label value." + } + }, + "required": [ + "name" + ], + "additionalProperties": false + }, + "RecipeV2Spec": { + "type": "object", + "properties": { + "platforms": { + "type": "array", + "items": { + "$ref": "#/$defs/Platform" + }, + "description": "Specify a list of the platforms to build for your image.\nThe resulting images will be added to a manifest list that allows your host’s container runtime to pull the correct image architecture for your hardware. The process of building a multi-architecture image will end up using emulation. Consequently, image builds will take significantly longer and more space will be required on the build host since each platform that is being built is its own image. If `platforms:` is not specified, the build host’s architecture will be used." + }, + "tool-versions": { + "$ref": "#/$defs/RecipeV2SpecToolVersions", + "description": "Extra tooling version overrides." + } + }, + "additionalProperties": false + }, + "StageEntry": { + "oneOf": [ + { + "$ref": "stage-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] + }, + "ModuleEntry": { + "oneOf": [ + { + "$ref": "module-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] + }, + "RecipeV2BaseImageRef": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/ImageRef" + } + ] + }, + "RecordString": { + "type": "object", + "properties": {}, + "additionalProperties": { + "type": "string" + } + }, + "Platform": { + "type": "string", + "enum": [ + "linux/amd64", + "linux/amd64/v2", + "linux/arm64", + "linux/arm", + "linux/arm/v6", + "linux/arm/v7", + "linux/386", + "linux/loong64", + "linux/mips", + "linux/mipsle", + "linux/mips64", + "linux/mips64le", + "linux/ppc64", + "linux/ppc64le", + "linux/riscv64", + "linux/s390x" + ] + }, + "RecipeV2SpecToolVersions": { + "type": "object", + "properties": { + "bluebuild": { + "type": "string", + "description": "The tag to pull for the BlueBuild cli. This is mostly used for\ntrying out specific versions of the cli without compiling it locally.\nSupply the tag of the cli release container to pull, see [the list of available tags](https://github.com/blue-build/cli/pkgs/container/cli) for reference.\nDefault: `latest-installer`. Set to to `none` to opt out of installing the CLI into your image." + }, + "cosign": { + "type": "string", + "description": "The version of cosign that will be included in the image.\nThis will override the default version set by the CLI.\nSetting to `none` will prevent installing cosign altogether." + }, + "nushell": { + "type": "string", + "description": "The version of nushell to include at `/usr/libexec/bluebuild/nu/nu` for use by modules in the image.\nThis will override the default BlueBuild Nushell version.\nChange only if you need a specific version of Nushell, changing this might break some BlueBuild modules." + } + }, + "additionalProperties": false + }, + "ImageRef": { + "type": "object", + "properties": { + "registry": { + "type": "string", + "description": "The registry hostname.\n\ni.e. `registry.example.com`" + }, + "repository": { + "type": "string", + "description": "The image repository path in the registry.\n\ni.e. `path/to/image`" + }, + "tag": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "description": "The tag of the image. This is overriden by `digest`.\nDefaults to `latest` if left blank.\n\ni.e. `gts`" + }, + "digest": { + "type": "string", + "description": "The specific digest of the image to pull.\nOverrides the `tag`.\n\ni.e. `sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`" + } + }, + "required": [ + "registry", + "repository" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/test-files/schema/recipe.json b/test-files/schema/recipe.json new file mode 100644 index 00000000..e08ce4d3 --- /dev/null +++ b/test-files/schema/recipe.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "recipe.json", + "oneOf": [ + { + "$ref": "recipe-v1.json" + }, + { + "$ref": "recipe-v2.json" + } + ] +} \ No newline at end of file diff --git a/test-files/schema/stage-list-v1.json b/test-files/schema/stage-list-v1.json index bde0479a..317d2a47 100644 --- a/test-files/schema/stage-list-v1.json +++ b/test-files/schema/stage-list-v1.json @@ -1,29 +1,30 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "stage-list-v1.json", - "type": "object", - "properties": { - "stages": { - "type": "array", - "items": { - "$ref": "#/$defs/StageEntry" - }, - "description": "A list of [stages](https://blue-build.org/reference/stages/) that are executed before the build of the final image.\nThis is useful for compiling programs from source without polluting the final bootable image." - } - }, - "required": [ - "stages" - ], - "$defs": { - "StageEntry": { - "anyOf": [ - { - "$ref": "stage-v1.json" - }, - { - "$ref": "import-v1.json" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "stage-list-v1.json", + "type": "object", + "properties": { + "stages": { + "type": "array", + "items": { + "$ref": "#/$defs/StageEntry" + }, + "description": "A list of [stages](https://blue-build.org/reference/stages/) that are executed before the build of the final image.\nThis is useful for compiling programs from source without polluting the final bootable image." + } + }, + "required": [ + "stages" + ], + "additionalProperties": false, + "$defs": { + "StageEntry": { + "oneOf": [ + { + "$ref": "stage-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] } - ] } - } } \ No newline at end of file diff --git a/test-files/schema/stage-v1.json b/test-files/schema/stage-v1.json index 833994a4..7a333ec4 100644 --- a/test-files/schema/stage-v1.json +++ b/test-files/schema/stage-v1.json @@ -1,57 +1,69 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "stage-v1.json", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the stage. This is used when referencing\nthe stage when using the from: property in the [`copy` module](https://blue-build.org/reference/modules/copy/)." - }, - "from": { - "type": "string", - "description": "The full image ref (image name + tag). This will be set in the FROM statement of the stage." - }, - "shell": { - "type": "string", - "description": "Allows a user to pass in an array of strings that are passed directly into the [`SHELL` instruction](https://docs.docker.com/reference/dockerfile/#shell)." - }, - "modules": { - "type": "array", - "items": { - "$ref": "#/$defs/ModuleEntry" - }, - "description": "The list of modules to execute. The exact same syntax used by the main recipe `modules:` property." - } - }, - "required": [ - "name", - "from", - "modules" - ], - "additionalProperties": false, - "$defs": { - "ModuleEntry": { - "anyOf": [ - { - "$ref": "module-v1.json" + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "stage-v1.json", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the stage. This is used when referencing\nthe stage when using the from: property in the [`copy` module](https://blue-build.org/reference/modules/copy/)." }, - { - "$ref": "#/$defs/ImportedModule" + "from": { + "type": "string", + "description": "The full image ref (image name + tag). This will be set in the FROM statement of the stage." + }, + "platform": { + "$ref": "#/$defs/Platform", + "description": "Defines the platform to run this stage on" + }, + "shell": { + "type": "string", + "description": "Allows a user to pass in an array of strings that are passed directly into the [`SHELL` instruction](https://docs.docker.com/reference/dockerfile/#shell)." + }, + "modules": { + "type": "array", + "items": { + "$ref": "#/$defs/ModuleEntry" + }, + "description": "The list of modules to execute. The exact same syntax used by the main recipe `modules:` property." } - ] }, - "ImportedModule": { - "type": "object", - "properties": { - "from-file": { - "type": "string", - "description": "The path to another file containing module configuration to import here.\nhttps://blue-build.org/how-to/multiple-files/" + "required": [ + "name", + "from", + "modules" + ], + "additionalProperties": false, + "$defs": { + "Platform": { + "type": "string", + "enum": [ + "linux/amd64", + "linux/amd64/v2", + "linux/arm64", + "linux/arm", + "linux/arm/v6", + "linux/arm/v7", + "linux/386", + "linux/loong64", + "linux/mips", + "linux/mipsle", + "linux/mips64", + "linux/mips64le", + "linux/ppc64", + "linux/ppc64le", + "linux/riscv64", + "linux/s390x" + ] + }, + "ModuleEntry": { + "oneOf": [ + { + "$ref": "module-v1.json" + }, + { + "$ref": "import-v1.json" + } + ] } - }, - "required": [ - "from-file" - ], - "additionalProperties": false } - } } \ No newline at end of file diff --git a/utils/src/constants.rs b/utils/src/constants.rs index fbd0affd..2a85be47 100644 --- a/utils/src/constants.rs +++ b/utils/src/constants.rs @@ -129,7 +129,8 @@ pub const GITHUB_CHAR_LIMIT: usize = 8100; // Magic number accepted by Github pub const DEFAULT_MAX_LAYERS: NonZeroU32 = NonZeroU32::new(128).unwrap(); // Schema -pub const SCHEMA_BASE_URL: &str = "https://schema.blue-build.org"; +// pub const SCHEMA_BASE_URL: &str = "https://schema.blue-build.org"; +pub const SCHEMA_BASE_URL: &str = "https://oneof-fix.schema-e29.pages.dev/"; pub const RECIPE_V1_SCHEMA_URL: &str = concat!(SCHEMA_BASE_URL, "/recipe-v1.json"); pub const STAGE_V1_SCHEMA_URL: &str = concat!(SCHEMA_BASE_URL, "/stage-v1.json"); pub const MODULE_V1_SCHEMA_URL: &str = concat!(SCHEMA_BASE_URL, "/module-v1.json");