diff --git a/Cargo.lock b/Cargo.lock index 931a1c86..aad4c874 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,9 +29,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" dependencies = [ "cfg-if", "once_cell", @@ -96,9 +96,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -147,7 +147,7 @@ dependencies = [ "percent-encoding", "serde", "serde_json", - "serde_yaml 0.9.30", + "serde_yaml 0.9.31", ] [[package]] @@ -295,7 +295,7 @@ dependencies = [ "format_serde_error", "futures-util", "fuzzy-matcher", - "indexmap 2.2.1", + "indexmap 2.2.3", "log", "open", "os_info", @@ -305,13 +305,16 @@ dependencies = [ "rusty-hook", "serde", "serde_json", - "serde_yaml 0.9.30", + "serde_yaml 0.9.31", "shadow-rs", + "signal-hook", + "signal-hook-tokio", "sigstore", "tokio", "typed-builder", "urlencoding", "users", + "uuid", "which", ] @@ -418,9 +421,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", @@ -453,9 +456,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -463,9 +466,9 @@ dependencies = [ [[package]] name = "clap-verbosity-flag" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b57f73ca21b17a0352944b9bb61803b6007bd911b6cccfef7153f7f0600ac495" +checksum = "bb9b20c0dd58e4c2e991c8d203bbeb76c11304d1011659686b5b644bc29aa478" dependencies = [ "clap", "log", @@ -473,32 +476,32 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", "unicase", "unicode-width", ] [[package]] name = "clap_complete" -version = "4.4.9" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df631ae429f6613fcd3a7c1adbdb65f637271e561b03680adaa6573015dfb106" +checksum = "299353be8209bd133b049bf1c63582d184a8b39fd9c04f15fe65f50f88bdfe6c" dependencies = [ "clap", ] [[package]] name = "clap_complete_nushell" -version = "4.4.2" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "948bf70d7e1f179635d3ef819ce8baa2d3074d0d57816ac37387cd6f9eed0c31" +checksum = "92cd8ac7c321605310e4b3bdc047daf27c6ca1b50f6ae59b22aa0661ab45e295" dependencies = [ "clap", "clap_complete", @@ -506,9 +509,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", @@ -518,9 +521,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -639,9 +642,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -726,9 +729,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -764,12 +767,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" dependencies = [ - "darling_core 0.20.3", - "darling_macro 0.20.3", + "darling_core 0.20.5", + "darling_macro 0.20.5", ] [[package]] @@ -782,21 +785,21 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn 1.0.109", ] [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn 2.0.48", ] @@ -813,11 +816,11 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" dependencies = [ - "darling_core 0.20.3", + "darling_core 0.20.5", "quote", "syn 2.0.48", ] @@ -858,18 +861,18 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "660047478bc508c0fde22c868991eec0c40a63e48d610befef466d48e2bee574" +checksum = "8f59169f400d8087f238c5c0c7db6a28af18681717f3b623227d92f397e938c7" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b217e6dd1011a54d12f3b920a411b5abd44b1716ecfe94f5f2f2f7b52e08ab7" +checksum = "a4ec317cc3e7ef0928b0ca6e4a634a4d6c001672ae210438cf114a83e56b018d" dependencies = [ "darling 0.14.4", "proc-macro2", @@ -879,9 +882,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5f77d7e20ac9153428f7ca14a88aba652adfc7a0ef0a06d654386310ef663b" +checksum = "870368c3fb35b8031abb378861d4460f573b92238ec2152c927a21f77e3e0127" dependencies = [ "derive_builder_core", "syn 1.0.109", @@ -964,9 +967,9 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", @@ -979,9 +982,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elliptic-curve" @@ -1025,9 +1028,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e7cf40684ae96ade6232ed84582f40ce0a66efcd43a5117aef610534f8e0b8" +checksum = "6c012a26a7f605efc424dd53697843a72be7dc86ad2d01f7814337794a12231d" dependencies = [ "anstream", "anstyle", @@ -1080,9 +1083,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" [[package]] name = "filetime" @@ -1312,9 +1315,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git2" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" +checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" dependencies = [ "bitflags 2.4.2", "libc", @@ -1359,7 +1362,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.1", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -1390,9 +1393,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -1555,9 +1558,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1605,9 +1608,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.1" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1703,18 +1706,18 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -1745,15 +1748,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libgit2-sys" -version = "0.16.1+1.7.1" +version = "0.16.2+1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2a2bb3680b094add03bb3732ec520ece34da31a8cd2d633d1389d0f0fb60d0c" +checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" dependencies = [ "cc", "libc", @@ -1866,9 +1869,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -1942,21 +1945,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", @@ -1965,9 +1973,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", "libm", @@ -2421,9 +2429,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" @@ -2672,9 +2680,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.23" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ "base64 0.21.7", "bytes 1.5.0", @@ -2695,9 +2703,11 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", @@ -2787,9 +2797,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ "bitflags 2.4.2", "errno", @@ -2798,17 +2808,26 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "rustls-pki-types" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9d979b3ce68192e42760c7810125eb6cf2ea10efae545a156063e61f314e2a" +checksum = "048a63e5b3ac996d78d402940b5fa47973d2d080c6c6fffa1d0f19c4445310b7" [[package]] name = "rustls-webpki" -version = "0.102.1" +version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4ca26037c909dedb327b48c3327d0ba91d3dd3c4e05dad328f210ffb68e95b" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ "ring 0.17.7", "rustls-pki-types", @@ -2959,9 +2978,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.112" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -3012,16 +3031,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.5.1" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5c9fdb6b00a489875b22efd4b78fe2b363b72265cc5f6eb2e2b9ee270e6140c" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.1", + "indexmap 2.2.3", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -3029,11 +3049,11 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.5.1" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbff351eb4b33600a2e138dfa0b10b65a238ea8ff8fb2387c422c5022a3e8298" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ - "darling 0.20.3", + "darling 0.20.5", "proc-macro2", "quote", "syn 2.0.48", @@ -3053,11 +3073,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.30" +version = "0.9.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" +checksum = "adf8a49373e98a4c5f0ceb5d05aa7c648d75f63774981ed95b7c7443bbd50c6e" dependencies = [ - "indexmap 2.2.1", + "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -3124,6 +3144,18 @@ dependencies = [ "libc", ] +[[package]] +name = "signal-hook-tokio" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213241f76fb1e37e27de3b6aa1b068a2c333233b59cca6634f634b80a27ecf1e" +dependencies = [ + "futures-core", + "libc", + "signal-hook", + "tokio", +] + [[package]] name = "signature" version = "2.2.0" @@ -3266,6 +3298,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "subtle" version = "2.5.0" @@ -3294,6 +3332,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "system-configuration" version = "0.5.1" @@ -3328,13 +3372,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", "rustix", "windows-sys 0.52.0", ] @@ -3364,18 +3407,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", @@ -3394,13 +3437,14 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", "libc", + "num-conv", "num_threads", "powerfmt", "serde", @@ -3416,10 +3460,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -3461,9 +3506,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes 1.5.0", @@ -3659,9 +3704,9 @@ dependencies = [ [[package]] name = "tzdb_data" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629555d2921f3f0dc0de98699415a8b2b61dfcd3a0b082a327f7ed748bbb2b76" +checksum = "d1889fdffac09d65c1d95c42d5202e9b21ad8c758f426e9fe09088817ea998d6" dependencies = [ "tz-rs", ] @@ -3704,9 +3749,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" @@ -3782,6 +3827,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +dependencies = [ + "getrandom", +] + [[package]] name = "vcpkg" version = "0.2.15" @@ -3821,9 +3875,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3831,9 +3885,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", @@ -3846,9 +3900,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -3858,9 +3912,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3868,9 +3922,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", @@ -3881,15 +3935,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "wasm-streams" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" dependencies = [ "futures-util", "js-sys", @@ -3900,9 +3954,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 4905682f..9640505d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,20 +34,22 @@ requestty = { version = "0.5", features = ["macros", "termion"] } serde = { version = "1", features = ["derive"] } serde_json = "1" serde_yaml = "0.9.30" +signal-hook = { version = "0.3.17", optional = true } +signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"], optional = true } shadow-rs = { version = "0.26" } sigstore = { version = "0.8.0", optional = true } tokio = { version = "1", features = ["full"], optional = true } typed-builder = "0.18.1" urlencoding = "2.1.3" users = "0.11.0" +uuid = { version = "1.7.0", features = ["v4"] } which = "6" [features] default = [] -init = [] -nightly = ["podman-api"] -tls = ["podman-api/tls", "podman-api"] -podman-api = ["dep:podman-api", "tokio", "futures-util"] +nightly = ["builtin-podman"] +builtin-podman = ["podman-api", "tokio", "futures-util", "signal-hook-tokio", "signal-hook"] +tls = ["podman-api/tls", "builtin-podman"] [dev-dependencies] rusty-hook = "0.11.2" diff --git a/src/commands/build.rs b/src/commands/build.rs index ef347668..b6d8aa53 100644 --- a/src/commands/build.rs +++ b/src/commands/build.rs @@ -11,6 +11,10 @@ use anyhow::{anyhow, bail, Result}; use clap::Args; use log::{debug, info, trace, warn}; use typed_builder::TypedBuilder; +use uuid::Uuid; + +#[cfg(feature = "builtin-podman")] +use std::sync::Arc; #[cfg(feature = "podman-api")] use podman_api::{ @@ -21,8 +25,14 @@ use podman_api::{ #[cfg(feature = "podman-api")] use build_strategy::BuildStrategy; +#[cfg(feature = "signal-hook-tokio")] +use signal_hook_tokio::Signals; + #[cfg(feature = "tokio")] -use tokio::runtime::Runtime; +use tokio::{ + runtime::Runtime, + sync::oneshot::{self, Sender}, +}; use crate::{ commands::template::TemplateCommand, @@ -141,6 +151,8 @@ impl BlueBuildCommand for BuildCommand { fn try_run(&mut self) -> Result<()> { trace!("BuildCommand::try_run()"); + let build_id = Uuid::new_v4(); + if self.push && self.archive.is_some() { bail!("You cannot use '--archive' and '--push' at the same time"); } @@ -166,27 +178,39 @@ impl BlueBuildCommand for BuildCommand { TemplateCommand::builder() .recipe(&recipe_path) .output(PathBuf::from("Containerfile")) + .build_id(build_id) .build() .try_run()?; info!("Building image for recipe at {}", recipe_path.display()); - #[cfg(feature = "podman-api")] + #[cfg(feature = "builtin-podman")] match BuildStrategy::determine_strategy()? { - BuildStrategy::Socket(socket) => Runtime::new()? - .block_on(self.build_image_podman_api(Podman::unix(socket), &recipe_path)), + BuildStrategy::Socket(socket) => Runtime::new()?.block_on(self.build_image_podman_api( + Podman::unix(socket), + build_id, + &recipe_path, + )), _ => self.build_image(&recipe_path), } - #[cfg(not(feature = "podman-api"))] + #[cfg(not(feature = "builtin-podman"))] self.build_image(&recipe_path) } } impl BuildCommand { - #[cfg(feature = "podman-api")] - async fn build_image_podman_api(&self, client: Podman, recipe_path: &Path) -> Result<()> { + #[cfg(feature = "builtin-podman")] + async fn build_image_podman_api( + &self, + client: Podman, + build_id: Uuid, + recipe_path: &Path, + ) -> Result<()> { use futures_util::StreamExt; + use signal_hook::consts::{SIGINT, SIGQUIT, SIGTERM}; + + use crate::ops::BUILD_ID_LABEL; trace!("BuildCommand::build_image({client:#?})"); @@ -211,34 +235,52 @@ impl BuildCommand { }; debug!("Full tag is {first_image_name}"); + // Prepare for the signal trap + let client = Arc::new(client); + + let signals = Signals::new([SIGTERM, SIGINT, SIGQUIT])?; + let handle = signals.handle(); + + let (kill_tx, mut kill_rx) = oneshot::channel::<()>(); + + let signals_task = tokio::spawn(handle_signals(signals, kill_tx, build_id, client.clone())); + // Get podman ready to build let opts = ImageBuildOpts::builder(".") .tag(&first_image_name) .dockerfile("Containerfile") .remove(true) .layers(true) + .labels([(BUILD_ID_LABEL, build_id.to_string())]) .pull(true) .build(); trace!("Build options: {opts:#?}"); info!("Building image {first_image_name}"); match client.images().build(&opts) { - Ok(mut build_stream) => { - while let Some(chunk) = build_stream.next().await { - match chunk { - Ok(chunk) => chunk - .stream - .trim() - .lines() - .map(str::trim) - .filter(|line| !line.is_empty()) - .for_each(|line| info!("{line}")), - Err(e) => bail!("{e}"), + Ok(mut build_stream) => loop { + tokio::select! { + Some(chunk) = build_stream.next() => { + match chunk { + Ok(chunk) => chunk + .stream + .trim() + .lines() + .map(str::trim) + .filter(|line| !line.is_empty()) + .for_each(|line| info!("{line}")), + Err(e) => bail!("{e}"), + } + }, + _ = &mut kill_rx => { + break; } } - } + }, Err(e) => bail!("{e}"), }; + handle.close(); + signals_task.await??; if self.push { debug!("Pushing is enabled"); @@ -274,6 +316,7 @@ impl BuildCommand { sign_images(&image_name, tags.first().map(String::as_str))?; } + Ok(()) } @@ -765,6 +808,71 @@ fn check_cosign_files() -> Result<()> { } } +#[cfg(feature = "builtin-podman")] +async fn handle_signals( + mut signals: Signals, + kill: Sender<()>, + build_id: Uuid, + client: Arc, +) -> Result<()> { + use std::process; + + use futures_util::StreamExt; + use podman_api::opts::{ + ContainerListOpts, ContainerPruneFilter, ContainerPruneOpts, ImagePruneFilter, + ImagePruneOpts, + }; + use signal_hook::consts::{SIGHUP, SIGINT}; + use tokio::time::{self, Duration}; + + use crate::ops::BUILD_ID_LABEL; + + trace!("handle_signals(signals, {build_id}, {client:#?})"); + + while let Some(signal) = signals.next().await { + match signal { + SIGHUP => (), + SIGINT => { + kill.send(()).unwrap(); + info!("Recieved SIGINT, cleaning up build..."); + + time::sleep(Duration::from_secs(1)).await; + + let containers = client + .containers() + .list(&ContainerListOpts::builder().sync(true).all(true).build()) + .await?; + + trace!("{containers:#?}"); + + // Prune containers from this build + let container_prune_opts = ContainerPruneOpts::builder() + .filter([ContainerPruneFilter::LabelKeyVal( + BUILD_ID_LABEL.to_string(), + build_id.to_string(), + )]) + .build(); + client.containers().prune(&container_prune_opts).await?; + debug!("Pruned containers"); + + // Prune images from this build + let image_prune_opts = ImagePruneOpts::builder() + .filter([ImagePruneFilter::LabelKeyVal( + BUILD_ID_LABEL.to_string(), + build_id.to_string(), + )]) + .build(); + client.images().prune(&image_prune_opts).await?; + debug!("Pruned images"); + process::exit(2); + } + _ => unreachable!(), + } + } + + Ok(()) +} + fn tag_images(tags: &[String], image_name: &str, full_image: &str) -> Result<()> { debug!("Tagging all images"); diff --git a/src/commands/template.rs b/src/commands/template.rs index 55fc237b..b3d54045 100644 --- a/src/commands/template.rs +++ b/src/commands/template.rs @@ -4,11 +4,12 @@ use std::{ process, }; -use anyhow::Result; +use anyhow::{anyhow, Result}; use askama::Template; use clap::Args; use log::{debug, error, info, trace}; use typed_builder::TypedBuilder; +use uuid::Uuid; use crate::{ constants::{self}, @@ -21,8 +22,13 @@ use super::BlueBuildCommand; #[template(path = "Containerfile")] pub struct ContainerFileTemplate<'a> { recipe: &'a Recipe<'a>, + + #[builder(setter(into))] recipe_path: &'a Path, + #[builder(setter(into))] + build_id: Uuid, + #[builder(default)] export_script: ExportsTemplate, } @@ -42,6 +48,10 @@ pub struct TemplateCommand { #[arg(short, long)] #[builder(default, setter(into, strip_option))] output: Option, + + #[clap(skip)] + #[builder(default, setter(into, strip_option))] + build_id: Option, } impl BlueBuildCommand for TemplateCommand { @@ -54,6 +64,8 @@ impl BlueBuildCommand for TemplateCommand { .display() ); + self.build_id.get_or_insert(Uuid::new_v4()); + self.template_file() } } @@ -71,9 +83,14 @@ impl TemplateCommand { let recipe_de = Recipe::parse(&recipe_path)?; trace!("recipe_de: {recipe_de:#?}"); + let build_id = self + .build_id + .ok_or_else(|| anyhow!("Build ID should have been generated by now"))?; + let template = ContainerFileTemplate::builder() + .build_id(build_id) .recipe(&recipe_de) - .recipe_path(&recipe_path) + .recipe_path(recipe_path.as_path()) .build(); let output_str = template.render()?; diff --git a/src/module_recipe.rs b/src/module_recipe.rs index b55c470d..61ed4448 100644 --- a/src/module_recipe.rs +++ b/src/module_recipe.rs @@ -39,7 +39,7 @@ pub struct Recipe<'a> { pub blue_build_tag: Option>, #[serde(flatten)] - pub modules_ext: ModuleExt, + pub modules_ext: ModuleExt<'a>, #[serde(flatten)] #[builder(setter(into))] @@ -145,7 +145,7 @@ impl<'a> Recipe<'a> { let mut recipe = serde_yaml::from_str::(&file).map_err(ops::serde_yaml_err(&file))?; - recipe.modules_ext.modules = Module::get_modules(&recipe.modules_ext.modules); + recipe.modules_ext.modules = Module::get_modules(&recipe.modules_ext.modules).into(); Ok(recipe) } @@ -203,12 +203,12 @@ impl<'a> Recipe<'a> { } #[derive(Default, Serialize, Clone, Deserialize, Debug, TypedBuilder)] -pub struct ModuleExt { +pub struct ModuleExt<'a> { #[builder(default, setter(into))] - pub modules: Vec, + pub modules: Cow<'a, [Module<'a>]>, } -impl ModuleExt { +impl ModuleExt<'_> { /// # Parse a module file returning a [`ModuleExt`] /// /// # Errors @@ -236,21 +236,21 @@ impl ModuleExt { } #[derive(Serialize, Deserialize, Debug, Clone, TypedBuilder)] -pub struct Module { +pub struct Module<'a> { #[builder(default, setter(into, strip_option))] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub module_type: Option, + pub module_type: Option>, #[builder(default, setter(into, strip_option))] #[serde(rename = "from-file", skip_serializing_if = "Option::is_none")] - pub from_file: Option, + pub from_file: Option>, #[serde(flatten)] #[builder(default, setter(into))] pub config: IndexMap, } -impl Module { +impl Module<'_> { #[must_use] pub fn get_modules(modules: &[Self]) -> Vec { modules diff --git a/src/ops.rs b/src/ops.rs index a0b62dde..84b7abab 100644 --- a/src/ops.rs +++ b/src/ops.rs @@ -5,6 +5,7 @@ use std::process::Command; pub const LOCAL_BUILD: &str = "/etc/bluebuild"; pub const ARCHIVE_SUFFIX: &str = "tar.gz"; +pub const BUILD_ID_LABEL: &str = "org.blue-build.build-id"; pub fn check_command_exists(command: &str) -> Result<()> { trace!("check_command_exists({command})"); diff --git a/templates/Containerfile b/templates/Containerfile index b4a13bfe..a5f684a8 100644 --- a/templates/Containerfile +++ b/templates/Containerfile @@ -18,10 +18,10 @@ RUN printf {{ self::print_script(export_script) }} >> /exports.sh && chmod +x /e FROM {{ recipe.base_image }}:{{ recipe.image_version }} +LABEL {{ crate::ops::BUILD_ID_LABEL }}="{{ build_id }}" LABEL org.opencontainers.image.title="{{ recipe.name }}" LABEL org.opencontainers.image.description="{{ recipe.description }}" -LABEL io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/startingpoint/main/README.md -LABEL io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4 +LABEL io.artifacthub.package.readme-url=https://raw.githubusercontent.com/blue-build/cli/main/README.md ARG RECIPE={{ recipe_path.display() }}