From 6ebf32f30adaacb8c56da2f5c7817286ae2dc98e Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 15 Nov 2022 12:14:04 +0200 Subject: [PATCH] use upstream hubcaps --- Cargo.lock | 499 ++++++++++++++++++------ flake.nix | 2 +- ofborg/Cargo.toml | 11 +- ofborg/src/commitstatus.rs | 49 +-- ofborg/src/config.rs | 29 +- ofborg/src/ghevent/pullrequestevent.rs | 6 +- ofborg/src/tasks/build.rs | 9 +- ofborg/src/tasks/eval/nixpkgs.rs | 33 +- ofborg/src/tasks/evaluate.rs | 55 +-- ofborg/src/tasks/githubcommentfilter.rs | 19 +- ofborg/src/tasks/githubcommentposter.rs | 15 +- 11 files changed, 503 insertions(+), 224 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 32d0f36..386bb16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "aho-corasick" version = "0.7.19" @@ -70,8 +55,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56987108bf48d2eb500cae8896cd9291564eedd8744776ecc5c3338a8b2ca5f8" dependencies = [ "amq-protocol-types", - "percent-encoding 2.2.0", - "url 2.3.1", + "percent-encoding 2.1.0", + "url 2.3.0", ] [[package]] @@ -83,12 +68,6 @@ dependencies = [ "libc", ] -[[package]] -name = "antidote" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" - [[package]] name = "async-channel" version = "1.7.1" @@ -256,21 +235,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "backtrace" -version = "0.3.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.9.3" @@ -281,6 +245,12 @@ dependencies = [ "safemem", ] +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + [[package]] name = "base64" version = "0.13.1" @@ -337,6 +307,12 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + [[package]] name = "cache-padded" version = "1.2.0" @@ -521,6 +497,12 @@ dependencies = [ "syn", ] +[[package]] +name = "data-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" + [[package]] name = "des" version = "0.8.1" @@ -554,12 +536,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] -name = "error-chain" -version = "0.10.0" +name = "encoding_rs" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" dependencies = [ - "backtrace", + "cfg-if", ] [[package]] @@ -598,6 +580,12 @@ dependencies = [ "spin 0.9.4", ] +[[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" @@ -615,23 +603,12 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ - "percent-encoding 2.2.0", -] - -[[package]] -name = "frank_jwt" -version = "3.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9febc9f09c7569636ba0e3d98a12addd6b11b3b3bc1d7baad06d52c60c1bbadd" -dependencies = [ - "base64 0.13.1", - "openssl", - "serde", - "serde_json", + "matches", + "percent-encoding 2.1.0", ] [[package]] @@ -644,6 +621,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "futures" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.25" @@ -651,6 +642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -711,6 +703,7 @@ checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-core", "futures-macro", + "futures-sink", "futures-task", "pin-project-lite", "pin-utils", @@ -738,12 +731,6 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] -[[package]] -name = "gimli" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" - [[package]] name = "gloo-timers" version = "0.2.4" @@ -756,6 +743,31 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "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 = "hermit-abi" version = "0.1.19" @@ -774,25 +786,59 @@ dependencies = [ "digest", ] +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "hubcaps" -version = "0.3.16" -source = "git+https://github.com/grahamc/hubcaps.git#de1e1521ee78b5df5e1435619c8e1b90c932d36b" +version = "0.6.2" +source = "git+https://github.com/softprops/hubcaps.git?rev=d60d157b6638760fc725b2e4e4f329a4ec6b901e#d60d157b6638760fc725b2e4e4f329a4ec6b901e" dependencies = [ - "error-chain", - "frank_jwt", - "hyper", - "log 0.3.9", + "base64 0.13.1", + "data-encoding", + "futures", + "http", + "hyperx", + "jsonwebtoken", + "log 0.4.17", + "mime 0.3.16", + "percent-encoding 2.1.0", + "reqwest", "serde", "serde_derive", "serde_json", - "url 1.7.2", + "url 2.3.0", ] [[package]] @@ -803,26 +849,68 @@ checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" dependencies = [ "base64 0.9.3", "httparse", - "language-tags", + "language-tags 0.2.2", "log 0.3.9", - "mime", + "mime 0.2.6", "num_cpus", "time", "traitobject", "typeable", - "unicase", + "unicase 1.4.2", "url 1.7.2", ] [[package]] -name = "hyper-native-tls" -version = "0.3.0" +name = "hyper" +version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d375598f442742b0e66208ee12501391f1c7ac0bafb90b4fe53018f81f06068" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ - "antidote", - "hyper", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper 0.14.23", "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "hyperx" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5617e92fc2f2501c3e2bc6ce547cad841adba2bae5b921c7e52510beca6d084c" +dependencies = [ + "base64 0.13.1", + "bytes", + "http", + "httpdate", + "language-tags 0.3.2", + "mime 0.3.16", + "percent-encoding 2.1.0", + "unicase 2.6.0", ] [[package]] @@ -862,14 +950,25 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ + "matches", "unicode-bidi", "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +dependencies = [ + "autocfg", + "hashbrown", +] + [[package]] name = "inout" version = "0.1.3" @@ -889,6 +988,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipnet" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" + [[package]] name = "itoa" version = "1.0.4" @@ -904,6 +1009,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonwebtoken" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afabcc15e437a6484fc4f12d0fd63068fe457bf93f1c148d3d9649c60b103f32" +dependencies = [ + "base64 0.12.3", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "kv-log-macro" version = "1.0.7" @@ -919,6 +1038,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" +[[package]] +name = "language-tags" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" + [[package]] name = "lapin" version = "2.1.1" @@ -1042,6 +1167,12 @@ dependencies = [ "log 0.3.9", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1049,12 +1180,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] -name = "miniz_oxide" -version = "0.5.4" +name = "mio" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ - "adler", + "libc", + "log 0.4.17", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.42.0", ] [[package]] @@ -1105,6 +1239,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -1126,23 +1271,14 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ "hermit-abi", "libc", ] -[[package]] -name = "object" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" -dependencies = [ - "memchr", -] - [[package]] name = "ofborg" version = "0.1.9" @@ -1152,9 +1288,9 @@ dependencies = [ "either", "fs2", "futures-util", + "http", "hubcaps", - "hyper", - "hyper-native-tls", + "hyper 0.10.16", "lapin", "lru-cache", "md5", @@ -1282,6 +1418,17 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "pem" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" +dependencies = [ + "base64 0.13.1", + "once_cell", + "regex", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -1290,9 +1437,9 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" @@ -1440,6 +1587,43 @@ dependencies = [ "winapi", ] +[[package]] +name = "reqwest" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" +dependencies = [ + "base64 0.13.1", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper 0.14.23", + "hyper-tls", + "ipnet", + "js-sys", + "log 0.4.17", + "mime 0.3.16", + "native-tls", + "once_cell", + "percent-encoding 2.1.0", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url 2.3.0", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "ring" version = "0.16.20" @@ -1455,12 +1639,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - [[package]] name = "rustls" version = "0.20.7" @@ -1610,6 +1788,18 @@ 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 = "sha1" version = "0.10.5" @@ -1649,6 +1839,17 @@ dependencies = [ "libc", ] +[[package]] +name = "simple_asn1" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b" +dependencies = [ + "chrono", + "num-bigint", + "num-traits", +] + [[package]] name = "slab" version = "0.4.7" @@ -1786,6 +1987,52 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "1.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "pin-project-lite", + "socket2", + "winapi", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" @@ -1867,6 +2114,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "typeable" version = "0.1.2" @@ -1888,6 +2141,15 @@ dependencies = [ "version_check 0.1.5", ] +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check 0.9.4", +] + [[package]] name = "unicode-bidi" version = "0.3.8" @@ -1934,13 +2196,13 @@ dependencies = [ [[package]] name = "url" -version = "2.3.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "22fe195a4f217c25b25cb5058ced57059824a678474874038dc88d211bf508d3" dependencies = [ "form_urlencoded", - "idna 0.3.0", - "percent-encoding 2.2.0", + "idna 0.2.3", + "percent-encoding 2.1.0", ] [[package]] @@ -1992,6 +2254,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log 0.4.17", + "try-lock", +] + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -2230,6 +2502,15 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + [[package]] name = "yasna" version = "0.5.0" diff --git a/flake.nix b/flake.nix index 582d7b8..e9613f2 100644 --- a/flake.nix +++ b/flake.nix @@ -113,7 +113,7 @@ cargoLock = { lockFile = ./Cargo.lock; outputHashes = { - "hubcaps-0.3.16" = "sha256-/BFXGccu27K8heK4IL7JnS/U7zatTk9wRybhtxppADM="; + "hubcaps-0.6.2" = "sha256-yyHOCxUsehvtYfttRY4T9TDrJhSKGpJRa/SX3Sd1TNc="; }; }; }; diff --git a/ofborg/Cargo.toml b/ofborg/Cargo.toml index 863ef94..5c3c123 100644 --- a/ofborg/Cargo.toml +++ b/ofborg/Cargo.toml @@ -11,12 +11,13 @@ chrono = "0.4.22" either = "1.8.0" fs2 = "0.4.3" futures-util = "0.3.25" -hubcaps = { git = "https://github.com/grahamc/hubcaps.git" } -#hubcaps = { path = "../../../grahamc/hubcaps/" } # for testing patches -# to upgrade hyper, hubcaps has to be updated too -# newer hyper has hyper::StatusCode while hubcaps returns a hyper::status::StatusCode +#hubcaps = "0.6" +# for Conclusion::Skipped which is in master +hubcaps = { git = "https://github.com/softprops/hubcaps.git", rev = "d60d157b6638760fc725b2e4e4f329a4ec6b901e" } +# hyper = { version = "0.14", features = ["full"] } hyper = "=0.10.*" -hyper-native-tls = "0.3.0" +# maybe can be removed when hyper is updated +http = "0.2" lapin = "2.1.1" lru-cache = "0.1.2" md5 = "0.7.0" diff --git a/ofborg/src/commitstatus.rs b/ofborg/src/commitstatus.rs index 74d606b..cbc29a5 100644 --- a/ofborg/src/commitstatus.rs +++ b/ofborg/src/commitstatus.rs @@ -1,21 +1,22 @@ +use futures_util::future::TryFutureExt; use tracing::warn; -pub struct CommitStatus<'a> { - api: hubcaps::statuses::Statuses<'a>, +pub struct CommitStatus { + api: hubcaps::statuses::Statuses, sha: String, context: String, description: String, url: String, } -impl<'a> CommitStatus<'a> { +impl CommitStatus { pub fn new( - api: hubcaps::statuses::Statuses<'a>, + api: hubcaps::statuses::Statuses, sha: String, context: String, description: String, url: Option, - ) -> CommitStatus<'a> { + ) -> CommitStatus { let mut stat = CommitStatus { api, sha, @@ -56,18 +57,19 @@ impl<'a> CommitStatus<'a> { } else { self.description.clone() }; - - self.api - .create( - self.sha.as_ref(), - &hubcaps::statuses::StatusOptions::builder(state) - .context(self.context.clone()) - .description(desc) - .target_url(self.url.clone()) - .build(), - ) - .map(|_| ()) - .map_err(|e| CommitStatusError::from(e)) + async_std::task::block_on( + self.api + .create( + self.sha.as_ref(), + &hubcaps::statuses::StatusOptions::builder(state) + .context(self.context.clone()) + .description(desc) + .target_url(self.url.clone()) + .build(), + ) + .map_ok(|_| ()) + .map_err(|e| CommitStatusError::from(e)), + ) } } @@ -80,15 +82,16 @@ pub enum CommitStatusError { impl From for CommitStatusError { fn from(e: hubcaps::Error) -> CommitStatusError { - use hyper::status::StatusCode; - match e.kind() { - hubcaps::ErrorKind::Fault { code, error } - if code == &StatusCode::Unauthorized && error.message == "Bad credentials" => + use http::status::StatusCode; + use hubcaps::Error; + match &e { + Error::Fault { code, error } + if code == &StatusCode::UNAUTHORIZED && error.message == "Bad credentials" => { CommitStatusError::ExpiredCreds(e) } - hubcaps::ErrorKind::Fault { code, error } - if code == &StatusCode::UnprocessableEntity + Error::Fault { code, error } + if code == &StatusCode::UNPROCESSABLE_ENTITY && error.message.starts_with("No commit found for SHA:") => { CommitStatusError::MissingSha(e) diff --git a/ofborg/src/config.rs b/ofborg/src/config.rs index 8fd791e..693d7a2 100644 --- a/ofborg/src/config.rs +++ b/ofborg/src/config.rs @@ -9,9 +9,6 @@ use std::marker::PhantomData; use std::path::{Path, PathBuf}; use hubcaps::{Credentials, Github, InstallationTokenGenerator, JWTCredentials}; -use hyper::net::HttpsConnector; -use hyper::Client; -use hyper_native_tls::NativeTlsClient; use serde::de::{self, Deserialize, Deserializer}; use tracing::{debug, error, info, warn}; @@ -57,8 +54,8 @@ pub struct GithubConfig { #[derive(Serialize, Deserialize, Debug, Clone)] pub struct GithubAppConfig { - pub app_id: i32, - pub installation_id: i32, + pub app_id: u64, + pub installation_id: u64, pub private_key: PathBuf, } @@ -119,9 +116,9 @@ impl Config { Github::new( "github.com/grahamc/ofborg", // tls configured hyper client - Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap())), Credentials::Token(self.github.clone().unwrap().token), ) + .unwrap() } pub fn github_app_vendingmachine(&self) -> GithubAppVendingMachine { @@ -176,8 +173,8 @@ pub fn load(filename: &Path) -> Config { pub struct GithubAppVendingMachine { conf: GithubAppConfig, - id_cache: HashMap<(String, String), Option>, - client_cache: HashMap, + id_cache: HashMap<(String, String), Option>, + client_cache: HashMap, } impl GithubAppVendingMachine { @@ -186,10 +183,12 @@ impl GithubAppVendingMachine { } fn jwt(&self) -> JWTCredentials { - JWTCredentials::new(self.conf.app_id, self.conf.private_key.clone()) + // JWTCredentials::new(self.conf.app_id, self.conf.private_key.clone()) + // FIXME: upstream wants raw bytes of private key + JWTCredentials::new(self.conf.app_id, vec![0x00]).unwrap() } - fn install_id_for_repo(&mut self, owner: &str, repo: &str) -> Option { + fn install_id_for_repo(&mut self, owner: &str, repo: &str) -> Option { let useragent = self.useragent(); let jwt = self.jwt(); @@ -198,13 +197,9 @@ impl GithubAppVendingMachine { *self.id_cache.entry(key).or_insert_with(|| { info!("Looking up install ID for {}/{}", owner, repo); - let lookup_gh = Github::new( - useragent, - Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap())), - Credentials::JWT(jwt), - ); + let lookup_gh = Github::new(useragent, Credentials::JWT(jwt)).unwrap(); - match lookup_gh.app().find_repo_installation(owner, repo) { + match async_std::task::block_on(lookup_gh.app().find_repo_installation(owner, repo)) { Ok(install_id) => { debug!("Received install ID {:?}", install_id); Some(install_id.id) @@ -225,9 +220,9 @@ impl GithubAppVendingMachine { Some(self.client_cache.entry(install_id).or_insert_with(|| { Github::new( useragent, - Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap())), Credentials::InstallationToken(InstallationTokenGenerator::new(install_id, jwt)), ) + .unwrap() })) } } diff --git a/ofborg/src/ghevent/pullrequestevent.rs b/ofborg/src/ghevent/pullrequestevent.rs index 2cc11d2..911b972 100644 --- a/ofborg/src/ghevent/pullrequestevent.rs +++ b/ofborg/src/ghevent/pullrequestevent.rs @@ -67,8 +67,7 @@ mod tests { fn test_parse_changed_base() { let data = include_str!("../../test-srcs/events/pr-changed-base.json"); - let pr: PullRequestEvent = - serde_json::from_str(data).expect("Should properly deserialize"); + let pr: PullRequestEvent = serde_json::from_str(data).expect("Should properly deserialize"); assert_eq!(pr.action, PullRequestAction::Edited); } @@ -76,8 +75,7 @@ mod tests { fn test_parse_unknown_action() { let data = include_str!("../../test-srcs/events/pr-converted-to-draft.json"); - let pr: PullRequestEvent = - serde_json::from_str(data).expect("Should properly deserialize"); + let pr: PullRequestEvent = serde_json::from_str(data).expect("Should properly deserialize"); assert_eq!(pr.action, PullRequestAction::Unknown); } } diff --git a/ofborg/src/tasks/build.rs b/ofborg/src/tasks/build.rs index e24d51d..60569a1 100644 --- a/ofborg/src/tasks/build.rs +++ b/ofborg/src/tasks/build.rs @@ -408,7 +408,6 @@ mod tests { fn make_worker(path: &Path) -> BuildWorker { let cloner = checkout::cached_cloner(path); let nix = nix(); - BuildWorker::new( cloner, @@ -462,8 +461,12 @@ mod tests { false } }) - .unwrap_or_else(|| panic!("Actions should contain a job matching {}, after the previous check", - text_to_match)); + .unwrap_or_else(|| { + panic!( + "Actions should contain a job matching {}, after the previous check", + text_to_match + ) + }); } #[test] diff --git a/ofborg/src/tasks/eval/nixpkgs.rs b/ofborg/src/tasks/eval/nixpkgs.rs index c2c7fbc..f555c7f 100644 --- a/ofborg/src/tasks/eval/nixpkgs.rs +++ b/ofborg/src/tasks/eval/nixpkgs.rs @@ -49,11 +49,11 @@ fn label_from_title(title: &str) -> Vec { pub struct NixpkgsStrategy<'a> { job: &'a EvaluationJob, - pull: &'a hubcaps::pulls::PullRequest<'a>, + pull: &'a hubcaps::pulls::PullRequest, issue: &'a Issue, - issue_ref: &'a IssueRef<'a>, - repo: &'a Repository<'a>, - gists: &'a Gists<'a>, + issue_ref: &'a IssueRef, + repo: &'a Repository, + gists: &'a Gists, nix: Nix, stdenv_diff: Option, outpath_diff: Option, @@ -88,7 +88,7 @@ impl<'a> NixpkgsStrategy<'a> { } fn tag_from_title(&self) { - let title = match self.issue_ref.get() { + let title = match async_std::task::block_on(self.issue_ref.get()) { Ok(issue) => issue.title.to_lowercase(), Err(_) => return, }; @@ -254,12 +254,8 @@ impl<'a> NixpkgsStrategy<'a> { .collect::>>(); if let Some(ref changed_paths) = self.changed_paths { - let m = ImpactedMaintainers::calculate( - &self.nix, - dir, - changed_paths, - &changed_attributes, - ); + let m = + ImpactedMaintainers::calculate(&self.nix, dir, changed_paths, &changed_attributes); let gist_url = make_gist( self.gists, @@ -587,7 +583,7 @@ impl<'a> EvaluationStrategy for NixpkgsStrategy<'a> { } fn request_reviews(maint: &maintainers::ImpactedMaintainers, pull: &hubcaps::pulls::PullRequest) { - let pull_meta = pull.get(); + let pull_meta = async_std::task::block_on(pull.get()); info!("Impacted maintainers: {:?}", maint.maintainers()); if maint.maintainers().len() < 10 { @@ -605,13 +601,12 @@ fn request_reviews(maint: &maintainers::ImpactedMaintainers, pull: &hubcaps::pul } } - if let Err(e) = - pull.review_requests() - .create(&hubcaps::review_requests::ReviewRequestOptions { - reviewers: vec![maintainer.clone()], - team_reviewers: vec![], - }) - { + if let Err(e) = async_std::task::block_on(pull.review_requests().create( + &hubcaps::review_requests::ReviewRequestOptions { + reviewers: vec![maintainer.clone()], + team_reviewers: vec![], + }, + )) { warn!("Failure requesting a review from {}: {:?}", maintainer, e,); } } diff --git a/ofborg/src/tasks/evaluate.rs b/ofborg/src/tasks/evaluate.rs index 223ab47..600f39c 100644 --- a/ofborg/src/tasks/evaluate.rs +++ b/ofborg/src/tasks/evaluate.rs @@ -10,6 +10,7 @@ use crate::stats::{self, Event}; use crate::systems; use crate::tasks::eval; use crate::worker; +use futures_util::TryFutureExt; use std::collections::HashMap; use std::path::Path; @@ -105,8 +106,8 @@ impl worker::SimpleWorker for EvaluationWorker struct OneEval<'a, E> { client_app: &'a hubcaps::Github, - repo: hubcaps::repositories::Repository<'a>, - gists: Gists<'a>, + repo: hubcaps::repositories::Repository, + gists: Gists, nix: &'a nix::Nix, acl: &'a Acl, events: &'a mut E, @@ -180,11 +181,13 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> { &self.job.pr.number, &self.job.pr.head_sha, &description ); - self.repo - .statuses() - .create(&self.job.pr.head_sha, &builder.build()) - .map(|_| ()) - .map_err(|e| CommitStatusError::from(e)) + async_std::task::block_on( + self.repo + .statuses() + .create(&self.job.pr.head_sha, &builder.build()) + .map_ok(|_| ()) + .map_err(|e| CommitStatusError::from(e)), + ) } fn make_gist( @@ -259,7 +262,7 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> { let issue: Issue; let auto_schedule_build_archs: Vec; - match issue_ref.get() { + match async_std::task::block_on(issue_ref.get()) { Ok(iss) => { if iss.state == "closed" { self.events.notify(Event::IssueAlreadyClosed); @@ -465,7 +468,7 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> { fn send_check_statuses(checks: Vec, repo: &hubcaps::repositories::Repository) { for check in checks { - match repo.checkruns().create(&check) { + match async_std::task::block_on(repo.checkruns().create(&check)) { Ok(_) => debug!("Sent check update"), Err(e) => warn!("Failed to send check update: {:?}", e), } @@ -504,8 +507,8 @@ fn schedule_builds( response } -pub fn make_gist<'a>( - gists: &hubcaps::gists::Gists<'a>, +pub fn make_gist( + gists: &hubcaps::gists::Gists, name: &str, description: Option, contents: String, @@ -520,20 +523,19 @@ pub fn make_gist<'a>( ); Some( - gists - .create(&hubcaps::gists::GistOptions { - description, - public: Some(true), - files, - }) - .expect("Failed to create gist!") - .html_url, + async_std::task::block_on(gists.create(&hubcaps::gists::GistOptions { + description, + public: Some(true), + files, + })) + .expect("Failed to create gist!") + .html_url, ) } pub fn update_labels(issueref: &hubcaps::issues::IssueRef, add: &[String], remove: &[String]) { let l = issueref.labels(); - let issue = issueref.get().expect("Failed to get issue"); + let issue = async_std::task::block_on(issueref.get()).expect("Failed to get issue"); let existing: Vec = issue.labels.iter().map(|l| l.name.clone()).collect(); @@ -554,7 +556,7 @@ pub fn update_labels(issueref: &hubcaps::issues::IssueRef, add: &[String], remov issue.number, to_add, to_remove, existing ); - l.add(to_add.clone()).unwrap_or_else(|e| { + async_std::task::block_on(l.add(to_add.clone())).unwrap_or_else(|e| { panic!( "Failed to add labels {:?} to issue #{}: {:?}", to_add, issue.number, e @@ -562,7 +564,7 @@ pub fn update_labels(issueref: &hubcaps::issues::IssueRef, add: &[String], remov }); for label in to_remove { - l.remove(&label).unwrap_or_else(|e| { + async_std::task::block_on(l.remove(&label)).unwrap_or_else(|e| { panic!( "Failed to remove label {:?} from issue #{}: {:?}", label, issue.number, e @@ -604,12 +606,11 @@ fn indicates_wip(text: &str) -> bool { /// that (e.g. if someone used `@ofborg eval`, `@ofborg build`, `@ofborg test`). /// Otherwise, if it's a new PR or was recently force-pushed (and therefore /// doesn't have any old `grahamcofborg`-prefixed statuses), use the new prefix. -pub fn get_prefix<'a>( +pub fn get_prefix( statuses: hubcaps::statuses::Statuses, - sha: &'a str, -) -> Result<&'a str, CommitStatusError> { - if statuses - .list(sha)? + sha: &str, +) -> Result<&str, CommitStatusError> { + if async_std::task::block_on(statuses.list(sha))? .iter() .any(|s| s.context.starts_with("grahamcofborg-")) { diff --git a/ofborg/src/tasks/githubcommentfilter.rs b/ofborg/src/tasks/githubcommentfilter.rs index 1c34c98..7312111 100644 --- a/ofborg/src/tasks/githubcommentfilter.rs +++ b/ofborg/src/tasks/githubcommentfilter.rs @@ -65,15 +65,16 @@ impl worker::SimpleWorker for GitHubCommentWorker { let instructions = commentparser::parse(&job.comment.body); info!("Instructions: {:?}", instructions); - let pr = self - .github - .repo( - job.repository.owner.login.clone(), - job.repository.name.clone(), - ) - .pulls() - .get(job.issue.number) - .get(); + let pr = async_std::task::block_on( + self.github + .repo( + job.repository.owner.login.clone(), + job.repository.name.clone(), + ) + .pulls() + .get(job.issue.number) + .get(), + ); if let Err(x) = pr { info!( diff --git a/ofborg/src/tasks/githubcommentposter.rs b/ofborg/src/tasks/githubcommentposter.rs index 84d23e7..5222ea7 100644 --- a/ofborg/src/tasks/githubcommentposter.rs +++ b/ofborg/src/tasks/githubcommentposter.rs @@ -78,13 +78,14 @@ impl worker::SimpleWorker for GitHubCommentPoster { ); debug!("{:?}", check); - let check_create_attempt = self - .github_vend - .for_repo(&repo.owner, &repo.name) - .unwrap() - .repo(repo.owner.clone(), repo.name.clone()) - .checkruns() - .create(&check); + let check_create_attempt = async_std::task::block_on( + self.github_vend + .for_repo(&repo.owner, &repo.name) + .unwrap() + .repo(repo.owner.clone(), repo.name.clone()) + .checkruns() + .create(&check), + ); match check_create_attempt { Ok(_) => info!("Successfully sent."),