diff --git a/Cargo.lock b/Cargo.lock index 1343ce9..d345c2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -42,12 +57,17 @@ dependencies = [ ] [[package]] -name = "ansi_term" -version = "0.12.1" +name = "async-compression" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +checksum = "a116f46a969224200a0a97f29cfd4c50e7534e4b4826bd23ea2c3c533039c82c" dependencies = [ - "winapi", + "brotli", + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", ] [[package]] @@ -109,6 +129,27 @@ dependencies = [ "generic-array", ] +[[package]] +name = "brotli" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + [[package]] name = "bumpalo" version = "3.15.4" @@ -121,6 +162,27 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "cc" version = "1.0.90" @@ -152,17 +214,40 @@ dependencies = [ [[package]] name = "clap" -version = "2.34.0" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ - "ansi_term", "atty", "bitflags 1.3.2", + "clap_lex", + "indexmap 1.9.3", + "once_cell", "strsim", + "termcolor", "textwrap", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", "unicode-width", - "vec_map", + "windows-sys 0.52.0", ] [[package]] @@ -190,6 +275,15 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +dependencies = [ + "cfg-if", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -216,6 +310,21 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + [[package]] name = "env_logger" version = "0.9.3" @@ -235,12 +344,65 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" + +[[package]] +name = "filetime" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "windows-sys 0.52.0", +] + +[[package]] +name = "flate2" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -381,12 +543,43 @@ dependencies = [ "url", ] +[[package]] +name = "h2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.1.0", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -422,6 +615,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -429,7 +633,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -467,8 +694,8 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -480,6 +707,26 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -487,13 +734,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "log", - "rustls", + "rustls 0.21.10", "rustls-native-certs", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", +] + +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.2.0", + "hyper-util", + "rustls 0.22.3", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.25.0", + "tower-service", ] [[package]] @@ -502,12 +766,48 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.28", "pin-project-lite", "tokio", "tokio-io-timeout", ] +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.2.0", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.2.0", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.60" @@ -541,6 +841,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + [[package]] name = "indexmap" version = "2.2.6" @@ -548,9 +858,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.14.3", +] + +[[package]] +name = "indicatif" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +dependencies = [ + "console", + "instant", + "number_prefix", + "portable-atomic", + "unicode-width", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", ] +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + [[package]] name = "itoa" version = "1.0.11" @@ -625,17 +963,17 @@ dependencies = [ "either", "futures", "home", - "http", - "http-body", - "hyper", - "hyper-rustls", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-rustls 0.24.2", "hyper-timeout", "jsonpath-rust", "k8s-openapi", "kube-core", "pem", "pin-project", - "rustls", + "rustls 0.21.10", "rustls-pemfile", "secrecy", "serde", @@ -657,7 +995,7 @@ checksum = "b5bba93d054786eba7994d03ce522f368ef7d48c88a1826faa28478d85fb63ae" dependencies = [ "chrono", "form_urlencoded", - "http", + "http 0.2.12", "k8s-openapi", "once_cell", "serde", @@ -717,6 +1055,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + [[package]] name = "lock_api" version = "0.4.11" @@ -765,6 +1109,24 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "num-traits" version = "0.2.18" @@ -784,6 +1146,12 @@ dependencies = [ "libc", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "object" version = "0.32.2" @@ -799,6 +1167,32 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "openssl" +version = "0.10.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "openssl-probe" version = "0.1.5" @@ -826,6 +1220,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + [[package]] name = "parking_lot" version = "0.12.1" @@ -948,6 +1348,12 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "proc-macro2" version = "1.0.79" @@ -1004,6 +1410,56 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +[[package]] +name = "reqwest" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d66674f2b6fb864665eea7a3c1ac4e3dfacd2fda83cf6f935a612e01b0e3338" +dependencies = [ + "async-compression", + "base64", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.2.0", + "hyper-rustls 0.26.0", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.22.3", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-rustls 0.25.0", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + [[package]] name = "ring" version = "0.17.8" @@ -1034,6 +1490,19 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.38.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "rustls" version = "0.21.10" @@ -1042,10 +1511,24 @@ checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99008d7ad0bbbea527ec27bddbc0e432c5b87d8175178cee68d2eec9c4a1813c" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki 0.102.2", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" version = "0.6.3" @@ -1067,6 +1550,12 @@ dependencies = [ "base64", ] +[[package]] +name = "rustls-pki-types" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -1077,6 +1566,23 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.102.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.17" @@ -1188,13 +1694,25 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "serde_yaml" version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap", + "indexmap 2.2.6", "itoa", "ryu", "serde", @@ -1265,9 +1783,34 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "strsim" -version = "0.8.0" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" + +[[package]] +name = "strum_macros" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" @@ -1280,6 +1823,56 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tar" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys 0.52.0", +] + [[package]] name = "termcolor" version = "1.4.1" @@ -1291,12 +1884,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.11.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" @@ -1373,13 +1963,34 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.10", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.3", + "rustls-pki-types", "tokio", ] @@ -1425,8 +2036,8 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "http-range-header", "mime", "pin-project-lite", @@ -1551,14 +2162,22 @@ dependencies = [ name = "validator-lab" version = "0.0.1" dependencies = [ + "bzip2", "clap", + "console", "git2", + "indicatif", "k8s-openapi", "kube", "log", + "reqwest", "rustc_version", "solana-logger", + "strum", + "strum_macros", + "tar", "tokio", + "url", ] [[package]] @@ -1567,12 +2186,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" @@ -1619,6 +2232,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.92" @@ -1648,6 +2273,25 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi" version = "0.3.9" @@ -1820,6 +2464,27 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "xattr" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +dependencies = [ + "libc", + "linux-raw-sys", + "rustix", +] + [[package]] name = "zeroize" version = "1.7.0" diff --git a/Cargo.toml b/Cargo.toml index b66f78d..81bd72c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,13 +8,21 @@ license = "Apache-2.0" edition = "2021" [dependencies] -clap = "2.33.1" +bzip2 = "0.4.4" +clap = { version = "3.2.22", features = ["cargo"] } +console = "0.15.8" git2 = "0.18.3" +indicatif = "0.17.8" k8s-openapi ={ version = "0.20.0", features = ["v1_28"] } kube = "0.87.2" log = "0.4.21" +reqwest = { version = "0.12.2", features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] } solana-logger = "1.18.7" +strum = "0.26.2" +strum_macros = "0.26.2" +tar = "0.4.40" tokio = { version = "1.29.1", features = ["full"] } +url = "2.5.0" [build-dependencies] rustc_version = "0.4" diff --git a/PROGRESS.md b/PROGRESS.md index a9fb96b..ec7199a 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -9,9 +9,9 @@ ## Steps - [x] Connect to kubernetes endpoint and check if namespace exists -- [ ] Setup build config Local +- [x] Setup build config Local - [x] Build from local commit - - [ ] Build from tar (release version) + - [x] Build from tar (release version) - [ ] Create Genesis - [ ] Generate faucet and bootstrap accounts - [ ] Build genesis diff --git a/README.md b/README.md index 6fc337f..0580e91 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,16 @@ kubectl create ns ``` ### Run +#### Build Agave from local agave repo ``` cargo run --bin cluster -- -n - --deploy-method local --local-path ``` + +#### Build specific Agave release +``` +cargo run --bin cluster -- + -n + --release-channel # note: MUST include the "v" +``` diff --git a/src/lib.rs b/src/lib.rs index d652f51..250be20 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,17 +1,22 @@ -use std::{env, path::PathBuf}; - -#[macro_export] -macro_rules! boxed_error { - ($message:expr) => { - Box::new(std::io::Error::new(std::io::ErrorKind::Other, $message)) as Box - }; -} +use { + bzip2::bufread::BzDecoder, + console::Emoji, + indicatif::{ProgressBar, ProgressStyle}, + log::*, + reqwest::Client, + std::{ + env, + fs::File, + io::{BufReader, Cursor, Read}, + path::{Path, PathBuf}, + time::Duration, + }, + tar::Archive, + url::Url, +}; pub fn get_solana_root() -> PathBuf { - PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("$CARGO_MANIFEST_DIR")) - .parent() - .expect("Failed to get Solana root directory") - .to_path_buf() + PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("$CARGO_MANIFEST_DIR")).to_path_buf() } pub struct SolanaRoot { @@ -38,3 +43,80 @@ impl SolanaRoot { pub mod kubernetes; pub mod release; + +static PACKAGE: Emoji = Emoji("📦 ", ""); +static TRUCK: Emoji = Emoji("🚚 ", ""); + +/// Creates a new process bar for processing that will take an unknown amount of time +pub fn new_spinner_progress_bar() -> ProgressBar { + let progress_bar = ProgressBar::new(42); + progress_bar.set_style( + ProgressStyle::default_spinner() + .template("{spinner:.green} {wide_msg}") + .expect("ProgresStyle::template direct input to be correct"), + ); + progress_bar.enable_steady_tick(Duration::from_millis(100)); + progress_bar +} + +pub fn cat_file(path: &PathBuf) -> std::io::Result<()> { + let mut file = File::open(path)?; + let mut contents = String::new(); + file.read_to_string(&mut contents)?; + info!("{:?}:\n{}", path.file_name(), contents); + + Ok(()) +} + +pub async fn download_to_temp( + url: &str, + file_name: &str, + solana_root_path: PathBuf, +) -> Result<(), Box> { + let progress_bar = new_spinner_progress_bar(); + progress_bar.set_message(format!("{TRUCK}Downloading...")); + + let url = Url::parse(url).map_err(|err| format!("Unable to parse {url}: {err}"))?; + + let client = Client::builder() + .connect_timeout(Duration::from_secs(30)) + .https_only(false) + .build()?; + + let response = client.get(url.clone()).send().await?; + if !response.status().is_success() { + return Err(format!( + "Failed to download release from url: {:?}, response body: {:?}", + url.to_string(), + response.text().await? + ) + .into()); + } + + let file_name: PathBuf = solana_root_path.join(file_name); + let mut out = File::create(file_name).expect("failed to create file"); + let mut content = Cursor::new(response.bytes().await?); + std::io::copy(&mut content, &mut out)?; + + progress_bar.finish_and_clear(); + Ok(()) +} + +pub fn extract_release_archive( + tarball_filename: &Path, + extract_dir: &Path, +) -> Result<(), Box> { + let progress_bar = new_spinner_progress_bar(); + progress_bar.set_message(format!("{PACKAGE}Extracting...")); + + let tarball_file = File::open(tarball_filename)?; + let decompressed = BzDecoder::new(BufReader::new(tarball_file)); + let mut archive = Archive::new(decompressed); + + // Unpack the archive into extract_dir + archive.unpack(extract_dir)?; + + progress_bar.finish_and_clear(); + + Ok(()) +} diff --git a/src/main.rs b/src/main.rs index d3bbb45..5943a72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,50 +1,51 @@ use { - clap::{crate_description, crate_name, App, Arg, ArgMatches}, + clap::{command, Arg, ArgGroup}, log::*, std::fs, + strum::VariantNames, validator_lab::{ kubernetes::Kubernetes, - release::{BuildConfig, DeployMethod}, + release::{BuildConfig, BuildType, DeployMethod}, SolanaRoot, }, }; -fn parse_matches() -> ArgMatches<'static> { - App::new(crate_name!()) - .about(crate_description!()) +fn parse_matches() -> clap::ArgMatches { + command!() .arg( - Arg::with_name("cluster_namespace") + Arg::new("cluster_namespace") .long("namespace") - .short("n") + .short('n') .takes_value(true) .default_value("default") .help("namespace to deploy test cluster"), ) .arg( - Arg::with_name("deploy_method") - .long("deploy-method") + Arg::new("local_path") + .long("local-path") .takes_value(true) - .possible_values(&["local", "tar", "skip"]) - .default_value("local") - .help("Deploy method. tar, local, skip. [default: local]"), + .conflicts_with("release_channel") + .help("Build validator from local Agave repo. Specify path here."), ) .arg( - Arg::with_name("local-path") - .long("local-path") + Arg::new("build_type") + .long("build-type") .takes_value(true) - .required_if("deploy-method", "local") - .conflicts_with_all(&["tar", "skip"]) - .help("Path to local agave repo. Required for 'local' deploy method."), + .possible_values(BuildType::VARIANTS) + .default_value(BuildType::Release.into()) + .help("Specifies the build type: skip, debug, or release."), ) .arg( - Arg::with_name("skip_build") - .long("skip-build") - .help("Disable building for building from local repo"), + Arg::with_name("release_channel") + .long("release-channel") + .takes_value(true) + .conflicts_with("local_path") + .help("Pulls specific release version. e.g. v1.17.2"), ) - .arg( - Arg::with_name("debug_build") - .long("debug-build") - .help("Enable debug build"), + .group( + ArgGroup::new("required_group") + .args(&["local_path", "release_channel"]) + .required(true), ) .get_matches() } @@ -65,26 +66,23 @@ async fn main() { namespace: matches.value_of("cluster_namespace").unwrap_or_default(), }; - let deploy_method = matches.value_of("deploy_method").unwrap(); - let local_path = matches.value_of("local-path"); - match deploy_method { - method if method == DeployMethod::Local.to_string() => { - if local_path.is_none() { - panic!("Error: --local-path is required for 'local' deploy-method."); - } - } - _ => { - if local_path.is_some() { - warn!("WARN: --local-path will be ignored"); - } - } - } + let deploy_method = if let Some(local_path) = matches.value_of("local_path") { + DeployMethod::Local(local_path.to_owned()) + } else if let Some(release_channel) = matches.value_of("release_channel") { + DeployMethod::ReleaseChannel(release_channel.to_owned()) + } else { + unreachable!("One of --local-path or --release-channel must be provided."); + }; - let solana_root = match matches.value_of("local-path") { - Some(path) => SolanaRoot::new_from_path(path.into()), - None => SolanaRoot::default(), + let solana_root = match &deploy_method { + DeployMethod::Local(path) => SolanaRoot::new_from_path(path.into()), + DeployMethod::ReleaseChannel(_) => SolanaRoot::default(), }; + let build_type: BuildType = matches + .value_of_t("build_type") + .unwrap_or_else(|e| e.exit()); + if let Ok(metadata) = fs::metadata(solana_root.get_root_path()) { if !metadata.is_dir() { return error!( @@ -115,15 +113,10 @@ async fn main() { } } - let build_config = BuildConfig::new( - deploy_method, - matches.is_present("skip_build"), - matches.is_present("debug_build"), - &solana_root.get_root_path(), - ) - .unwrap_or_else(|err| { - panic!("Error creating BuildConfig: {}", err); - }); + let build_config = BuildConfig::new(deploy_method, build_type, &solana_root.get_root_path()) + .unwrap_or_else(|err| { + panic!("Error creating BuildConfig: {}", err); + }); match build_config.prepare().await { Ok(_) => info!("Validator setup prepared successfully"), diff --git a/src/release.rs b/src/release.rs index 7381663..fab5628 100644 --- a/src/release.rs +++ b/src/release.rs @@ -1,102 +1,101 @@ use { - crate::boxed_error, + crate::{cat_file, download_to_temp, extract_release_archive}, git2::Repository, log::*, - std::{error::Error, fmt::Display, path::PathBuf, str::FromStr, time::Instant}, + std::{error::Error, fs, path::PathBuf, time::Instant}, + strum_macros::{EnumString, IntoStaticStr, VariantNames}, }; -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum DeployMethod { - Local, - Tar, - Skip, + Local(String), + ReleaseChannel(String), } -impl Display for DeployMethod { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - DeployMethod::Local => write!(f, "local"), - DeployMethod::Tar => write!(f, "tar"), - DeployMethod::Skip => write!(f, "skip"), - } - } -} - -impl FromStr for DeployMethod { - type Err = (); - - fn from_str(s: &str) -> Result { - match s { - "local" => Ok(DeployMethod::Local), - "tar" => Ok(DeployMethod::Tar), - "skip" => Ok(DeployMethod::Skip), - _ => Err(()), - } - } +#[derive(PartialEq, EnumString, IntoStaticStr, VariantNames)] +#[strum(serialize_all = "lowercase")] +pub enum BuildType { + Skip, // use Agave build from the previous run + Debug, + Release, } pub struct BuildConfig { deploy_method: DeployMethod, - skip_build: bool, - debug_build: bool, + build_type: BuildType, _build_path: PathBuf, solana_root_path: PathBuf, } impl BuildConfig { pub fn new( - deploy_method: &str, - skip_build: bool, - debug_build: bool, + deploy_method: DeployMethod, + build_type: BuildType, solana_root_path: &PathBuf, ) -> Result> { - let deploy_method = deploy_method - .parse::() - .map_err(|_| "Failed to parse deploy_method".to_string())?; - let build_path = match deploy_method { - DeployMethod::Local => solana_root_path.join("farf/bin"), - DeployMethod::Tar => solana_root_path.join("solana-release/bin"), - DeployMethod::Skip => solana_root_path.join("farf/bin"), + DeployMethod::Local(_) => solana_root_path.join("farf/bin"), + DeployMethod::ReleaseChannel(_) => solana_root_path.join("solana-release/bin"), }; Ok(BuildConfig { deploy_method, - skip_build, - debug_build, + build_type, _build_path: build_path, solana_root_path: solana_root_path.clone(), }) } pub async fn prepare(&self) -> Result<(), Box> { - match self.deploy_method { - DeployMethod::Tar => { - return Err(boxed_error!("Tar deploy method not implemented yet.")); - } - DeployMethod::Local => { + match &self.deploy_method { + DeployMethod::ReleaseChannel(channel) => match self.setup_tar_deploy(channel).await { + Ok(tar_directory) => { + info!("Successfully setup tar file"); + cat_file(&tar_directory.join("version.yml")).unwrap(); + } + Err(err) => return Err(err), + }, + DeployMethod::Local(_) => { self.setup_local_deploy()?; } - DeployMethod::Skip => { - return Err(boxed_error!("Skip deploy method not implemented yet.")); - } } info!("Completed Prepare Deploy"); Ok(()) } + async fn setup_tar_deploy(&self, release_channel: &String) -> Result> { + let file_name = "solana-release"; + let tar_filename = format!("{file_name}.tar.bz2"); + info!("tar file: {}", tar_filename); + self.download_release_from_channel(&tar_filename, release_channel) + .await?; + + // Extract it and load the release version metadata + let tarball_filename = self.solana_root_path.join(&tar_filename); + let release_dir = self.solana_root_path.join(file_name); + extract_release_archive(&tarball_filename, &self.solana_root_path).map_err(|err| { + format!("Unable to extract {tar_filename} into {release_dir:?}: {err}") + })?; + + Ok(release_dir) + } + fn setup_local_deploy(&self) -> Result<(), Box> { - if !self.skip_build { + if self.build_type != BuildType::Skip { self.build()?; } else { - info!("Build skipped due to --skip-build"); + info!("Build skipped due to --build-type skip"); } Ok(()) } fn build(&self) -> Result<(), Box> { let start_time = Instant::now(); - let build_variant = if self.debug_build { "--debug" } else { "" }; + let build_variant = if self.build_type == BuildType::Debug { + "--debug" + } else { + "" + }; let install_directory = self.solana_root_path.join("farf"); let install_script = self.solana_root_path.join("scripts/cargo-install-all.sh"); @@ -110,7 +109,7 @@ impl BuildConfig { if result.success() { info!("Successfully built validator") } else { - return Err(boxed_error!("Failed to build validator")); + return Err("Failed to build validator".into()); } } Err(err) => return Err(Box::new(err)), @@ -145,4 +144,37 @@ impl BuildConfig { info!("Build took {:.3?} seconds", start_time.elapsed()); Ok(()) } + + async fn download_release_from_channel( + &self, + tar_filename: &str, + release_channel: &String, + ) -> Result<(), Box> { + info!("Downloading release from channel: {}", release_channel); + let file_path = self.solana_root_path.join(tar_filename); + // Remove file + if let Err(err) = fs::remove_file(&file_path) { + if err.kind() != std::io::ErrorKind::NotFound { + return Err(format!("{}: {:?}", "Error while removing file:", err).into()); + } + } + + let download_url = format!( + "{}{}{}", + "https://release.solana.com/", + release_channel, + "/solana-release-x86_64-unknown-linux-gnu.tar.bz2" + ); + info!("download_url: {}", download_url); + + download_to_temp( + download_url.as_str(), + tar_filename, + self.solana_root_path.clone(), + ) + .await + .map_err(|err| format!("Unable to download {download_url}. Error: {err}"))?; + + Ok(()) + } }