From f8145f3e6a8dfb29ad7b0a70e22b88f5d84fdeb7 Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Wed, 7 Jul 2021 13:56:46 -0500 Subject: [PATCH 1/6] fix: use built-in root certs (#649) --- Cargo.lock | 164 ++++++------------ Cargo.toml | 3 +- crates/rover-client/Cargo.toml | 3 +- crates/rover-client/src/blocking/client.rs | 12 +- .../src/blocking/studio_client.rs | 5 +- crates/rover-client/src/releases.rs | 6 +- crates/rover-client/tests/client.rs | 15 +- crates/sputnik/Cargo.toml | 2 +- crates/sputnik/src/report.rs | 6 +- crates/sputnik/src/session.rs | 9 +- src/cli.rs | 22 ++- src/command/config/whoami.rs | 2 +- src/command/graph/check.rs | 2 +- src/command/graph/fetch.rs | 2 +- src/command/graph/introspect.rs | 5 +- src/command/graph/mod.rs | 2 +- src/command/graph/publish.rs | 2 +- src/command/subgraph/check.rs | 2 +- src/command/subgraph/delete.rs | 2 +- src/command/subgraph/fetch.rs | 2 +- src/command/subgraph/introspect.rs | 5 +- src/command/subgraph/list.rs | 2 +- src/command/subgraph/mod.rs | 2 +- src/command/subgraph/publish.rs | 2 +- src/command/supergraph/compose/do_compose.rs | 14 +- src/command/supergraph/fetch.rs | 2 +- src/command/update/check.rs | 5 +- src/command/update/mod.rs | 5 +- src/utils/client.rs | 25 ++- src/utils/telemetry.rs | 5 + src/utils/version.rs | 15 +- 31 files changed, 184 insertions(+), 166 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fc6a3417..6e22619fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192ec435945d87bc2f70992b4d818154b5feede43c09fb7592146374eac90a6" + +[[package]] +name = "alloc-stdlib" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -102,6 +117,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443ccbb270374a2b1055fc72da40e1f237809cd6bb0e97e66d264cd138473a6" dependencies = [ + "brotli", "flate2", "futures-core", "memchr", @@ -199,6 +215,27 @@ dependencies = [ "generic-array", ] +[[package]] +name = "brotli" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f29919120f08613aadcd4383764e00526fc9f18b6c0895814faeed0dd78613e" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1052e1c3b8d4d80eb84a8b94f0a1498797b5fb96314c001156a1c761940ef4ec" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + [[package]] name = "bstr" version = "0.2.16" @@ -367,9 +404,9 @@ checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] name = "cpufeatures" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" dependencies = [ "libc", ] @@ -994,9 +1031,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.9.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "heck" @@ -1009,9 +1046,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] @@ -1093,21 +1130,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" -dependencies = [ - "futures-util", - "hyper", - "log", - "rustls", - "tokio", - "tokio-rustls", - "webpki", -] - [[package]] name = "hyper-tls" version = "0.5.0" @@ -1152,9 +1174,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", "hashbrown", @@ -1603,9 +1625,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -1861,7 +1883,6 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls", "hyper-tls", "ipnet", "js-sys", @@ -1871,37 +1892,19 @@ dependencies = [ "native-tls", "percent-encoding", "pin-project-lite", - "rustls", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", - "tokio-rustls", "tokio-util", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", "winreg 0.7.0", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - [[package]] name = "robot-panic" version = "1.0.3" @@ -2004,19 +2007,6 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" -[[package]] -name = "rustls" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" -dependencies = [ - "base64", - "log", - "ring", - "sct", - "webpki", -] - [[package]] name = "rusty_v8" version = "0.22.3" @@ -2061,16 +2051,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "sdl-encoder" version = "0.1.0" @@ -2292,12 +2272,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "sputnik" version = "0.0.0" @@ -2553,9 +2527,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb2ed024293bb19f7a5dc54fe83bf86532a44c12a2bb8ba40d64a4509395ca2" +checksum = "570c2eb13b3ab38208130eccd41be92520388791207fde783bda7c1e8ace28d4" dependencies = [ "autocfg", "bytes", @@ -2577,17 +2551,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" -dependencies = [ - "rustls", - "tokio", - "webpki", -] - [[package]] name = "tokio-util" version = "0.6.7" @@ -2737,9 +2700,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" @@ -2768,12 +2731,6 @@ dependencies = [ "void", ] -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "url" version = "2.2.2" @@ -2941,25 +2898,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" -dependencies = [ - "webpki", -] - [[package]] name = "which" version = "4.1.0" diff --git a/Cargo.toml b/Cargo.toml index 9d62adc99..60410c069 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,7 @@ humantime = "2.1.0" opener = "0.5.0" os_info = "3.0" prettytable-rs = "0.8.0" +reqwest = {version = "0.11", default-features = false, features = ["blocking", "brotli", "gzip", "json", "native-tls-vendored"]} regex = "1" semver = "1" serde = "1.0" @@ -75,7 +76,7 @@ url = { version = "2.2.2", features = ["serde"] } assert_cmd = "1.0.7" assert_fs = "1.0.3" predicates = "2.0.0" -reqwest = "0.11.4" +reqwest = { version = "0.11.4", default-features = false, features = ["blocking", "native-tls-vendored"] } serial_test = "0.5.0" [build-dependencies] diff --git a/crates/rover-client/Cargo.toml b/crates/rover-client/Cargo.toml index cb12bc8f7..03de68888 100644 --- a/crates/rover-client/Cargo.toml +++ b/crates/rover-client/Cargo.toml @@ -16,7 +16,7 @@ chrono = "0.4" graphql_client = "0.9" http = "0.2" regex = "1.5.4" -reqwest = {version = "0.11", default-features = false, features = ["json", "blocking", "rustls-tls", "gzip"]} +reqwest = {version = "0.11", default-features = false, features = ["blocking", "json"]} sdl-encoder = {path = "../sdl-encoder"} serde = "1" serde_json = "1" @@ -30,5 +30,6 @@ reqwest = {version = "0.11", default-features = false, features = ["json", "bloc uuid = {version = "0.8", features = ["v4"]} [dev-dependencies] + indoc = "1.0.3" pretty_assertions = "0.7.1" diff --git a/crates/rover-client/src/blocking/client.rs b/crates/rover-client/src/blocking/client.rs index 8cde1bb23..c734a63ad 100644 --- a/crates/rover-client/src/blocking/client.rs +++ b/crates/rover-client/src/blocking/client.rs @@ -10,20 +10,20 @@ use std::collections::HashMap; /// Represents a generic GraphQL client for making http requests. pub struct GraphQLClient { - client: ReqwestClient, graphql_endpoint: String, + client: ReqwestClient, } impl GraphQLClient { /// Construct a new [Client] from a `graphql_endpoint`. /// This client is used for generic GraphQL requests, such as introspection. - pub fn new(graphql_endpoint: &str) -> Result { + pub fn new( + graphql_endpoint: &str, + client: ReqwestClient, + ) -> Result { Ok(GraphQLClient { - client: ReqwestClient::builder() - .use_rustls_tls() - .gzip(true) - .build()?, graphql_endpoint: graphql_endpoint.to_string(), + client, }) } diff --git a/crates/rover-client/src/blocking/studio_client.rs b/crates/rover-client/src/blocking/studio_client.rs index 22b2d15b1..a7a4d2fbc 100644 --- a/crates/rover-client/src/blocking/studio_client.rs +++ b/crates/rover-client/src/blocking/studio_client.rs @@ -2,7 +2,7 @@ use crate::{blocking::GraphQLClient, headers, RoverClientError}; use houston::Credential; use graphql_client::GraphQLQuery; -use reqwest::Error as ReqwestError; +use reqwest::{blocking::Client as ReqwestClient, Error as ReqwestError}; /// Represents a client for making GraphQL requests to Apollo Studio. pub struct StudioClient { @@ -18,10 +18,11 @@ impl StudioClient { credential: Credential, graphql_endpoint: &str, version: &str, + client: ReqwestClient, ) -> Result { Ok(StudioClient { credential, - client: GraphQLClient::new(graphql_endpoint)?, + client: GraphQLClient::new(graphql_endpoint, client)?, version: version.to_string(), }) } diff --git a/crates/rover-client/src/releases.rs b/crates/rover-client/src/releases.rs index 365648169..544636899 100644 --- a/crates/rover-client/src/releases.rs +++ b/crates/rover-client/src/releases.rs @@ -1,12 +1,12 @@ use crate::RoverClientError; use regex::Regex; -use reqwest::blocking; +use reqwest::blocking::Client; const LATEST_RELEASE_URL: &str = "https://github.com/apollographql/rover/releases/latest"; /// Looks up the latest release version, and returns it as a string -pub fn get_latest_release() -> Result { - let res = blocking::Client::new().head(LATEST_RELEASE_URL).send()?; +pub fn get_latest_release(client: Client) -> Result { + let res = client.head(LATEST_RELEASE_URL).send()?; let release_url = res.url().to_string(); let release_url_parts: Vec<&str> = release_url.split('/').collect(); diff --git a/crates/rover-client/tests/client.rs b/crates/rover-client/tests/client.rs index 5a8486201..8e56fefe5 100644 --- a/crates/rover-client/tests/client.rs +++ b/crates/rover-client/tests/client.rs @@ -1,7 +1,17 @@ +use reqwest::blocking::Client; const STUDIO_PROD_API_ENDPOINT: &str = "https://graphql.api.apollographql.com/api/graphql"; +pub(crate) fn get_client() -> Client { + Client::builder() + .gzip(true) + .brotli(true) + .build() + .expect("Could not create reqwest Client") +} + #[cfg(test)] mod tests { + use super::*; use houston::{Credential, CredentialOrigin}; use rover_client::blocking::{GraphQLClient, StudioClient}; @@ -9,7 +19,7 @@ mod tests { #[test] fn it_can_build_client() { - assert!(GraphQLClient::new(STUDIO_PROD_API_ENDPOINT).is_ok()); + assert!(GraphQLClient::new(STUDIO_PROD_API_ENDPOINT, get_client()).is_ok(),); } #[test] @@ -20,7 +30,8 @@ mod tests { origin: CredentialOrigin::EnvVar, }, "0.1.0", - STUDIO_PROD_API_ENDPOINT + STUDIO_PROD_API_ENDPOINT, + get_client() ) .is_ok()); } diff --git a/crates/sputnik/Cargo.toml b/crates/sputnik/Cargo.toml index e048dba93..07d8ef198 100644 --- a/crates/sputnik/Cargo.toml +++ b/crates/sputnik/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" camino = "1.0" ci_info = { version = "0.14", features = ["serde-1"] } git2 = "0.13" -reqwest = { version = "0.11", features = ["blocking"] } +reqwest = { version = "0.11", default-features = false, features = ["blocking"] } semver = { version = "1", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/crates/sputnik/src/report.rs b/crates/sputnik/src/report.rs index 34bd835e4..a15129f4d 100644 --- a/crates/sputnik/src/report.rs +++ b/crates/sputnik/src/report.rs @@ -1,4 +1,5 @@ use camino::{Utf8Path, Utf8PathBuf}; +use reqwest::blocking::Client; use url::Url; use uuid::Uuid; @@ -38,12 +39,15 @@ pub trait Report { /// returns the globally persistent machine identifier /// and writes it if it does not exist - /// the default implemenation uses self.machine_id_config() + /// the default implementation uses self.machine_id_config() /// as the location the machine identifier is written to. fn machine_id(&self) -> Result { let config_path = self.machine_id_config()?; get_or_write_machine_id(&config_path) } + + /// returns the Client to use when sending telemetry data + fn client(&self) -> Client; } fn get_or_write_machine_id(path: &Utf8PathBuf) -> Result { diff --git a/crates/sputnik/src/session.rs b/crates/sputnik/src/session.rs index 706d2691a..9b7a5f6a1 100644 --- a/crates/sputnik/src/session.rs +++ b/crates/sputnik/src/session.rs @@ -1,6 +1,7 @@ use camino::Utf8PathBuf; use ci_info::types::Vendor as CiVendor; use git2::Repository; +use reqwest::blocking::Client; use reqwest::Url; use semver::Version; use serde::Serialize; @@ -45,6 +46,10 @@ pub struct Session { /// Where the telemetry data is being reported to #[serde(skip_serializing)] reporting_info: ReportingInfo, + + /// The reqwest Client sputnik uses to send telemetry data + #[serde(skip_serializing)] + client: Client, } /// Platform represents the platform the CLI is being run from @@ -82,6 +87,7 @@ impl Session { pub fn new(app: &T) -> Result { let machine_id = app.machine_id()?; let command = app.serialize_command()?; + let client = app.client(); let reporting_info = ReportingInfo { is_telemetry_enabled: app.is_telemetry_enabled()?, endpoint: app.endpoint()?, @@ -114,6 +120,7 @@ impl Session { platform, cli_version, reporting_info, + client, }) } @@ -125,7 +132,7 @@ impl Session { let body = serde_json::to_string(&self)?; tracing::debug!("POSTing to {}", &self.reporting_info.endpoint); tracing::debug!("{}", body); - reqwest::blocking::Client::new() + self.client .post(self.reporting_info.endpoint.clone()) .body(body) .header("User-Agent", &self.reporting_info.user_agent) diff --git a/src/cli.rs b/src/cli.rs index fa25d3dfd..4271bbec7 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,3 +1,4 @@ +use reqwest::blocking::Client; use serde::Serialize; use structopt::{clap::AppSettings, StructOpt}; @@ -60,6 +61,10 @@ pub struct Rover { #[structopt(skip)] #[serde(skip_serializing)] pub env_store: RoverEnv, + + #[structopt(skip)] + #[serde(skip_serializing)] + client: Client, } impl Rover { @@ -75,7 +80,11 @@ impl Rover { pub(crate) fn get_client_config(&self) -> Result { let override_endpoint = self.env_store.get(RoverEnvKey::RegistryUrl)?; let config = self.get_rover_config()?; - Ok(StudioClientConfig::new(override_endpoint, config)) + Ok(StudioClientConfig::new( + override_endpoint, + config, + self.get_reqwest_client(), + )) } pub(crate) fn get_install_override_path(&self) -> Result> { @@ -91,6 +100,11 @@ impl Rover { tracing::debug!(?git_context); Ok(git_context) } + + pub(crate) fn get_reqwest_client(&self) -> Client { + // we can use clone here freely since `reqwest` uses an `Arc` under the hood + self.client.clone() + } } #[derive(Debug, Serialize, StructOpt)] @@ -136,7 +150,7 @@ impl Rover { } else { let config = self.get_rover_config(); if let Ok(config) = config { - let _ = version::check_for_update(config, false); + let _ = version::check_for_update(config, false, self.get_reqwest_client()); } } @@ -150,7 +164,9 @@ impl Rover { Command::Subgraph(command) => { command.run(self.get_client_config()?, self.get_git_context()?) } - Command::Update(command) => command.run(self.get_rover_config()?), + Command::Update(command) => { + command.run(self.get_rover_config()?, self.get_reqwest_client()) + } Command::Install(command) => command.run(self.get_install_override_path()?), Command::Info(command) => command.run(), Command::Explain(command) => command.run(), diff --git a/src/command/config/whoami.rs b/src/command/config/whoami.rs index 2c343c16e..0a77288ec 100644 --- a/src/command/config/whoami.rs +++ b/src/command/config/whoami.rs @@ -23,7 +23,7 @@ pub struct WhoAmI { impl WhoAmI { pub fn run(&self, client_config: StudioClientConfig) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; eprintln!("Checking identity of your API key against the registry."); let identity = whoami::run(whoami::who_am_i_query::Variables {}, &client)?; diff --git a/src/command/graph/check.rs b/src/command/graph/check.rs index e3433a9c9..f4720436e 100644 --- a/src/command/graph/check.rs +++ b/src/command/graph/check.rs @@ -55,7 +55,7 @@ impl Check { client_config: StudioClientConfig, git_context: GitContext, ) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; let sdl = load_schema_from_flag(&self.schema, std::io::stdin())?; let res = check::run( check::check_schema_query::Variables { diff --git a/src/command/graph/fetch.rs b/src/command/graph/fetch.rs index d3d4c1e38..c1c147d31 100644 --- a/src/command/graph/fetch.rs +++ b/src/command/graph/fetch.rs @@ -25,7 +25,7 @@ pub struct Fetch { impl Fetch { pub fn run(&self, client_config: StudioClientConfig) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; let graph_ref = self.graph.to_string(); eprintln!( "Fetching SDL from {} using credentials from the {} profile.", diff --git a/src/command/graph/introspect.rs b/src/command/graph/introspect.rs index 25e270bef..a12ac60c9 100644 --- a/src/command/graph/introspect.rs +++ b/src/command/graph/introspect.rs @@ -1,4 +1,5 @@ use crate::Result; +use reqwest::blocking::Client; use serde::Serialize; use std::collections::HashMap; use structopt::StructOpt; @@ -27,8 +28,8 @@ pub struct Introspect { } impl Introspect { - pub fn run(&self) -> Result { - let client = GraphQLClient::new(&self.endpoint.to_string())?; + pub fn run(&self, client: Client) -> Result { + let client = GraphQLClient::new(&self.endpoint.to_string(), client)?; // add the flag headers to a hashmap to pass along to rover-client let mut headers = HashMap::new(); diff --git a/src/command/graph/mod.rs b/src/command/graph/mod.rs index 92e9a3c86..13744518e 100644 --- a/src/command/graph/mod.rs +++ b/src/command/graph/mod.rs @@ -42,7 +42,7 @@ impl Graph { Command::Check(command) => command.run(client_config, git_context), Command::Fetch(command) => command.run(client_config), Command::Publish(command) => command.run(client_config, git_context), - Command::Introspect(command) => command.run(), + Command::Introspect(command) => command.run(client_config.get_reqwest_client()), } } } diff --git a/src/command/graph/publish.rs b/src/command/graph/publish.rs index 06f66860c..053d3b953 100644 --- a/src/command/graph/publish.rs +++ b/src/command/graph/publish.rs @@ -37,7 +37,7 @@ impl Publish { client_config: StudioClientConfig, git_context: GitContext, ) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; let graph_ref = self.graph.to_string(); eprintln!( "Publishing SDL to {} using credentials from the {} profile.", diff --git a/src/command/subgraph/check.rs b/src/command/subgraph/check.rs index d4e85770a..9fff514ec 100644 --- a/src/command/subgraph/check.rs +++ b/src/command/subgraph/check.rs @@ -61,7 +61,7 @@ impl Check { client_config: StudioClientConfig, git_context: GitContext, ) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; let sdl = load_schema_from_flag(&self.schema, std::io::stdin())?; diff --git a/src/command/subgraph/delete.rs b/src/command/subgraph/delete.rs index f66a24485..030e6f45a 100644 --- a/src/command/subgraph/delete.rs +++ b/src/command/subgraph/delete.rs @@ -36,7 +36,7 @@ pub struct Delete { impl Delete { pub fn run(&self, client_config: StudioClientConfig) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; let graph_ref = self.graph.to_string(); eprintln!( "Checking for composition errors resulting from deleting subgraph {} from {} using credentials from the {} profile.", diff --git a/src/command/subgraph/fetch.rs b/src/command/subgraph/fetch.rs index e51ae6bc1..020dad04a 100644 --- a/src/command/subgraph/fetch.rs +++ b/src/command/subgraph/fetch.rs @@ -30,7 +30,7 @@ pub struct Fetch { impl Fetch { pub fn run(&self, client_config: StudioClientConfig) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; let graph_ref = self.graph.to_string(); eprintln!( "Fetching SDL from {} (subgraph: {}) using credentials from the {} profile.", diff --git a/src/command/subgraph/introspect.rs b/src/command/subgraph/introspect.rs index 4b69876f0..cae22c14c 100644 --- a/src/command/subgraph/introspect.rs +++ b/src/command/subgraph/introspect.rs @@ -1,3 +1,4 @@ +use reqwest::blocking::Client; use serde::Serialize; use std::collections::HashMap; use structopt::StructOpt; @@ -32,8 +33,8 @@ pub struct Introspect { } impl Introspect { - pub fn run(&self) -> Result { - let client = GraphQLClient::new(&self.endpoint.to_string())?; + pub fn run(&self, client: Client) -> Result { + let client = GraphQLClient::new(&self.endpoint.to_string(), client)?; // add the flag headers to a hashmap to pass along to rover-client let mut headers = HashMap::new(); diff --git a/src/command/subgraph/list.rs b/src/command/subgraph/list.rs index 27843938d..e469b68db 100644 --- a/src/command/subgraph/list.rs +++ b/src/command/subgraph/list.rs @@ -25,7 +25,7 @@ pub struct List { impl List { pub fn run(&self, client_config: StudioClientConfig) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; eprintln!( "Listing subgraphs for {} using credentials from the {} profile.", diff --git a/src/command/subgraph/mod.rs b/src/command/subgraph/mod.rs index dd0173a44..9361fcf70 100644 --- a/src/command/subgraph/mod.rs +++ b/src/command/subgraph/mod.rs @@ -48,7 +48,7 @@ impl Subgraph { ) -> Result { match &self.command { Command::Publish(command) => command.run(client_config, git_context), - Command::Introspect(command) => command.run(), + Command::Introspect(command) => command.run(client_config.get_reqwest_client()), Command::Delete(command) => command.run(client_config), Command::Fetch(command) => command.run(client_config), Command::Check(command) => command.run(client_config, git_context), diff --git a/src/command/subgraph/publish.rs b/src/command/subgraph/publish.rs index 6781d50c4..8e400488c 100644 --- a/src/command/subgraph/publish.rs +++ b/src/command/subgraph/publish.rs @@ -55,7 +55,7 @@ impl Publish { client_config: StudioClientConfig, git_context: GitContext, ) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; let graph_ref = format!("{}:{}", &self.graph.name, &self.graph.variant); eprintln!( "Publishing SDL to {} (subgraph: {}) using credentials from the {} profile.", diff --git a/src/command/supergraph/compose/do_compose.rs b/src/command/supergraph/compose/do_compose.rs index 781845afb..fc9c73924 100644 --- a/src/command/supergraph/compose/do_compose.rs +++ b/src/command/supergraph/compose/do_compose.rs @@ -102,7 +102,10 @@ pub(crate) fn get_subgraph_definitions( SchemaSource::SubgraphIntrospection { subgraph_url } => { // given a federated introspection URL, use subgraph introspect to // obtain SDL and add it to subgraph_definition. - let client = GraphQLClient::new(&subgraph_url.to_string())?; + let client = GraphQLClient::new( + &subgraph_url.to_string(), + client_config.get_reqwest_client(), + )?; let introspection_response = introspect::run(&client, &HashMap::new())?; let schema = introspection_response.result; @@ -120,7 +123,7 @@ pub(crate) fn get_subgraph_definitions( SchemaSource::Subgraph { graphref, subgraph } => { // given a graphref and subgraph, run subgraph fetch to // obtain SDL and add it to subgraph_definition. - let client = client_config.get_client(&profile_name)?; + let client = client_config.get_authenticated_client(&profile_name)?; let graphref = parse_graph_ref(graphref)?; let schema = fetch::run( fetch::fetch_subgraph_query::Variables { @@ -153,12 +156,17 @@ mod tests { use assert_fs::TempDir; use houston as houston_config; use houston_config::Config; + use reqwest::blocking::Client; use std::convert::TryFrom; fn get_studio_config() -> StudioClientConfig { let tmp_home = TempDir::new().unwrap(); let tmp_path = Utf8PathBuf::try_from(tmp_home.path().to_path_buf()).unwrap(); - StudioClientConfig::new(None, Config::new(Some(&tmp_path), None).unwrap()) + StudioClientConfig::new( + None, + Config::new(Some(&tmp_path), None).unwrap(), + Client::new(), + ) } #[test] diff --git a/src/command/supergraph/fetch.rs b/src/command/supergraph/fetch.rs index 8176f0297..3bc84ded4 100644 --- a/src/command/supergraph/fetch.rs +++ b/src/command/supergraph/fetch.rs @@ -24,7 +24,7 @@ pub struct Fetch { impl Fetch { pub fn run(&self, client_config: StudioClientConfig) -> Result { - let client = client_config.get_client(&self.profile_name)?; + let client = client_config.get_authenticated_client(&self.profile_name)?; let graph_ref = self.graph.to_string(); eprintln!( "Fetching supergraph SDL from {} using credentials from the {} profile.", diff --git a/src/command/update/check.rs b/src/command/update/check.rs index 13c745bc7..f4fe31ebd 100644 --- a/src/command/update/check.rs +++ b/src/command/update/check.rs @@ -1,3 +1,4 @@ +use reqwest::blocking::Client; use serde::Serialize; use structopt::StructOpt; @@ -12,8 +13,8 @@ pub struct Check { } impl Check { - pub fn run(&self, config: config::Config) -> Result { - version::check_for_update(config, true)?; + pub fn run(&self, config: config::Config, client: Client) -> Result { + version::check_for_update(config, true, client)?; Ok(RoverStdout::None) } } diff --git a/src/command/update/mod.rs b/src/command/update/mod.rs index 3b95446a1..9296ba172 100644 --- a/src/command/update/mod.rs +++ b/src/command/update/mod.rs @@ -1,5 +1,6 @@ mod check; +use reqwest::blocking::Client; use serde::Serialize; use structopt::StructOpt; @@ -21,9 +22,9 @@ pub enum Command { } impl Update { - pub fn run(&self, config: config::Config) -> Result { + pub fn run(&self, config: config::Config, client: Client) -> Result { match &self.command { - Command::Check(command) => command.run(config), + Command::Check(command) => command.run(config, client), } } } diff --git a/src/utils/client.rs b/src/utils/client.rs index e511c747d..96b7d2633 100644 --- a/src/utils/client.rs +++ b/src/utils/client.rs @@ -2,19 +2,25 @@ use crate::Result; use crate::PKG_VERSION; use houston as config; +use reqwest::blocking::Client; use rover_client::blocking::StudioClient; /// the Apollo graph registry's production API endpoint const STUDIO_PROD_API_ENDPOINT: &str = "https://graphql.api.apollographql.com/api/graphql"; pub struct StudioClientConfig { + pub(crate) config: config::Config, + client: Client, uri: String, - pub config: config::Config, version: String, } impl StudioClientConfig { - pub fn new(override_endpoint: Option, config: config::Config) -> StudioClientConfig { + pub fn new( + override_endpoint: Option, + config: config::Config, + client: Client, + ) -> StudioClientConfig { let version = if cfg!(debug_assertions) { format!("{} (dev)", PKG_VERSION) } else { @@ -25,11 +31,22 @@ impl StudioClientConfig { uri: override_endpoint.unwrap_or_else(|| STUDIO_PROD_API_ENDPOINT.to_string()), config, version, + client, } } - pub fn get_client(&self, profile_name: &str) -> Result { + pub(crate) fn get_reqwest_client(&self) -> Client { + // we can use clone here freely since `reqwest` uses an `Arc` under the hood + self.client.clone() + } + + pub fn get_authenticated_client(&self, profile_name: &str) -> Result { let credential = config::Profile::get_credential(profile_name, &self.config)?; - Ok(StudioClient::new(credential, &self.uri, &self.version)?) + Ok(StudioClient::new( + credential, + &self.uri, + &self.version, + self.get_reqwest_client(), + )?) } } diff --git a/src/utils/telemetry.rs b/src/utils/telemetry.rs index a03aef807..3882364d5 100644 --- a/src/utils/telemetry.rs +++ b/src/utils/telemetry.rs @@ -1,4 +1,5 @@ use camino::Utf8PathBuf; +use reqwest::blocking::Client; use url::Url; use crate::utils::env::RoverEnvKey; @@ -115,6 +116,10 @@ impl Report for Rover { .map_err(|_| SputnikError::ConfigError)?; Ok(config.home.join("machine.txt")) } + + fn client(&self) -> Client { + self.get_reqwest_client() + } } #[cfg(test)] diff --git a/src/utils/version.rs b/src/utils/version.rs index 9de822804..8ac32c7a8 100644 --- a/src/utils/version.rs +++ b/src/utils/version.rs @@ -3,6 +3,7 @@ use std::{fs, time::SystemTime}; use ansi_term::Colour::{Cyan, Yellow}; use billboard::{Alignment, Billboard}; use camino::Utf8PathBuf; +use reqwest::blocking::Client; use semver::Version; use crate::{Result, PKG_VERSION}; @@ -18,7 +19,7 @@ const ONE_DAY: u64 = ONE_HOUR * 24; /// check for newer versions, even if we recently checked for updates. /// /// If `force` is not passed, we check for updates every day at most -pub fn check_for_update(config: config::Config, force: bool) -> Result<()> { +pub fn check_for_update(config: config::Config, force: bool, client: Client) -> Result<()> { let version_file = config.home.join("version.toml"); let current_time = SystemTime::now(); // if we don't end up checking, we don't want to overwrite the last checked time @@ -28,7 +29,7 @@ pub fn check_for_update(config: config::Config, force: bool) -> Result<()> { let last_checked_time = get_last_checked_time_from_disk(&version_file); if force || last_checked_time.is_none() { - do_update_check(&mut checked, force)?; + do_update_check(&mut checked, force, client)?; } else if let Some(last_checked_time) = last_checked_time { let time_since_check = current_time.duration_since(last_checked_time)?.as_secs(); tracing::trace!( @@ -37,7 +38,7 @@ pub fn check_for_update(config: config::Config, force: bool) -> Result<()> { ); if time_since_check > ONE_DAY { - do_update_check(&mut checked, force)?; + do_update_check(&mut checked, force, client)?; } } @@ -49,8 +50,12 @@ pub fn check_for_update(config: config::Config, force: bool) -> Result<()> { Ok(()) } -fn do_update_check(checked: &mut bool, should_output_if_updated: bool) -> Result<()> { - let latest = get_latest_release()?; +fn do_update_check( + checked: &mut bool, + should_output_if_updated: bool, + client: Client, +) -> Result<()> { + let latest = get_latest_release(client)?; let pretty_latest = Cyan.normal().paint(format!("v{}", latest)); let update_available = is_latest_newer(&latest, PKG_VERSION)?; if update_available { From ab2d78a710a2d794d5b6608de8e087a43f2c1890 Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Wed, 7 Jul 2021 14:20:17 -0500 Subject: [PATCH 2/6] chore(deps): updates harmonizer (#631) --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e22619fc..e7b64a0bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1018,9 +1018,9 @@ dependencies = [ [[package]] name = "harmonizer" -version = "0.3.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7044c9959a4c2ad619473992e43ffd7287e7df7d0b651f830f195aa88badad34" +checksum = "d067853682d95c6e1fa666637ec7a99c4b20c2c7935ce90ab59bd69cad2ce7ef" dependencies = [ "anyhow", "deno_core", diff --git a/Cargo.toml b/Cargo.toml index 60410c069..dfd7a0ef0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ console = "0.14.0" crossterm = "0.20.0" git-url-parse = "0.3.1" git2 = { version = "0.13.20", default-features = false, features = ["vendored-openssl"] } -harmonizer = { version = "0.3.1", optional = true } +harmonizer = { version = "0.26.0", optional = true } heck = "0.3.3" humantime = "2.1.0" opener = "0.5.0" From d25b415fe72a08617e4a2950fce4497486e34c31 Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Wed, 7 Jul 2021 16:34:01 -0500 Subject: [PATCH 3/6] release: v0.1.8 (#666) --- CHANGELOG.md | 42 +++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 6 +-- docs/source/getting-started.md | 4 +- installers/binstall/scripts/nix/install.sh | 2 +- .../binstall/scripts/windows/install.ps1 | 2 +- installers/npm/package-lock.json | 4 +- installers/npm/package.json | 2 +- 9 files changed, 54 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5873b1390..1b85fc954 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,48 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## 🛠 Maintenance ## 📚 Documentation --> +# [0.1.8] 2021-07-07 + +## 🚀 Features + +- **Adds _preview_ support for `@tag` and `@inaccessible` directives - [EverlastingBugstopper], [pull/631]** + + **Preview** support for composing subgraphs with `@tag` and/or `@inaccessible` core features using `rover supergraph compose`. Note that `@apollo/gateway >= 0.33` is required when using **preview** support for these core features. + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/631]: https://github.com/apollographql/rover/pull/631 + +- **Auto-decode gzipped responses - [EverlastingBugstopper], [pull/650]** + + If your GraphQL server responds with an introspection response compressed with brotli, it will now be decoded automatically instead of failing the command. + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/650]: https://github.com/apollographql/rover/pull/650 + +## 🐛 Fixes + +- **Use built-in root certificates and re-use HTTP connection pool - [EverlastingBugstopper], [issue/645] [pull/649]** + + Rover now uses local CA Certificates along with your operating system's native TLS implementation instead of the Rust-based WebPKI implementation. + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/649]: https://github.com/apollographql/rover/pull/649 + [issue/645]: https://github.com/apollographql/rover/issues/645 + +## 🛠 Maintenance + +- **Re-use HTTP connection pool - [EverlastingBugstopper], [pull/650]** + + Rover will now create and reuse the same HTTP connection pool for subsequent requests, which should slightly improve performance. + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/650]: https://github.com/apollographql/rover/pull/650 + +- **Removes unused dependencies - [EverlastingBugstopper], [pull/651]** + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/651]: https://github.com/apollographql/rover/pull/651 + # [0.1.7] 2021-06-29 ## 🚀 Features diff --git a/Cargo.lock b/Cargo.lock index e7b64a0bf..cfac782a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1921,7 +1921,7 @@ dependencies = [ [[package]] name = "rover" -version = "0.1.7" +version = "0.1.8" dependencies = [ "ansi_term 0.12.1", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index dfd7a0ef0..c8eaaa9c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" name = "rover" readme = "README.md" repository = "https://github.com/apollographql/rover/" -version = "0.1.7" +version = "0.1.8" resolver = "2" [[bin]] diff --git a/README.md b/README.md index fb69e7c32..1e3f692b5 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ rover graph publish --schema ./path-to-valid-schema test@cats ## Command-line options ```console -Rover 0.1.7 +Rover 0.1.8 Rover - Your Graph Companion Read the getting started guide by running: @@ -118,7 +118,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -curl -sSL https://rover.apollo.dev/nix/v0.1.7 | sh +curl -sSL https://rover.apollo.dev/nix/v0.1.8 | sh ``` You will need `curl` installed on your system to run the above installation commands. You can get the latest version from [the curl downloads page](https://curl.se/download.html). @@ -136,7 +136,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -iwr 'https://rover.apollo.dev/win/v0.1.7' | iex +iwr 'https://rover.apollo.dev/win/v0.1.8' | iex ``` #### npm installer diff --git a/docs/source/getting-started.md b/docs/source/getting-started.md index be35cda4e..2270f6460 100644 --- a/docs/source/getting-started.md +++ b/docs/source/getting-started.md @@ -20,7 +20,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -curl -sSL https://rover.apollo.dev/nix/v0.1.7 | sh +curl -sSL https://rover.apollo.dev/nix/v0.1.8 | sh ``` You will need `curl` installed on your system to run the above installation commands. You can get the latest version from [the curl downloads page](https://curl.se/download.html). @@ -38,7 +38,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -iwr 'https://rover.apollo.dev/win/v0.1.7' | iex +iwr 'https://rover.apollo.dev/win/v0.1.8' | iex ``` ### `npm` installer diff --git a/installers/binstall/scripts/nix/install.sh b/installers/binstall/scripts/nix/install.sh index 6969cb7b3..75f18dfb7 100755 --- a/installers/binstall/scripts/nix/install.sh +++ b/installers/binstall/scripts/nix/install.sh @@ -16,7 +16,7 @@ BINARY_DOWNLOAD_PREFIX="https://github.com/apollographql/rover/releases/download # Rover version defined in root cargo.toml # Note: this line is built automatically # in build.rs. Don't touch it! -PACKAGE_VERSION="v0.1.7" +PACKAGE_VERSION="v0.1.8" download_binary_and_run_installer() { downloader --check diff --git a/installers/binstall/scripts/windows/install.ps1 b/installers/binstall/scripts/windows/install.ps1 index 3851b6948..ba28b94dc 100644 --- a/installers/binstall/scripts/windows/install.ps1 +++ b/installers/binstall/scripts/windows/install.ps1 @@ -9,7 +9,7 @@ # version found in Rover's Cargo.toml # Note: this line is built automatically # in build.rs. Don't touch it! -$package_version = 'v0.1.7' +$package_version = 'v0.1.8' function Install-Binary() { $old_erroractionpreference = $ErrorActionPreference diff --git a/installers/npm/package-lock.json b/installers/npm/package-lock.json index 58ba92495..fbb0d7d24 100644 --- a/installers/npm/package-lock.json +++ b/installers/npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "@apollo/rover", - "version": "0.1.7", + "version": "0.1.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@apollo/rover", - "version": "0.1.7", + "version": "0.1.8", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/installers/npm/package.json b/installers/npm/package.json index 6d7ef3a6e..21d6766da 100644 --- a/installers/npm/package.json +++ b/installers/npm/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/rover", - "version": "0.1.7", + "version": "0.1.8", "description": "The new Apollo CLI", "main": "index.js", "bin": { From aec63cdd57c5cb18562975383056c302816d7c99 Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Wed, 7 Jul 2021 16:57:03 -0500 Subject: [PATCH 4/6] Revert "release: v0.1.8 (#666)" This reverts commit d25b415fe72a08617e4a2950fce4497486e34c31. --- CHANGELOG.md | 42 ------------------- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 6 +-- docs/source/getting-started.md | 4 +- installers/binstall/scripts/nix/install.sh | 2 +- .../binstall/scripts/windows/install.ps1 | 2 +- installers/npm/package-lock.json | 4 +- installers/npm/package.json | 2 +- 9 files changed, 12 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b85fc954..5873b1390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,48 +12,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## 🛠 Maintenance ## 📚 Documentation --> -# [0.1.8] 2021-07-07 - -## 🚀 Features - -- **Adds _preview_ support for `@tag` and `@inaccessible` directives - [EverlastingBugstopper], [pull/631]** - - **Preview** support for composing subgraphs with `@tag` and/or `@inaccessible` core features using `rover supergraph compose`. Note that `@apollo/gateway >= 0.33` is required when using **preview** support for these core features. - - [EverlastingBugstopper]: https://github.com/EverlastingBugstopper - [pull/631]: https://github.com/apollographql/rover/pull/631 - -- **Auto-decode gzipped responses - [EverlastingBugstopper], [pull/650]** - - If your GraphQL server responds with an introspection response compressed with brotli, it will now be decoded automatically instead of failing the command. - - [EverlastingBugstopper]: https://github.com/EverlastingBugstopper - [pull/650]: https://github.com/apollographql/rover/pull/650 - -## 🐛 Fixes - -- **Use built-in root certificates and re-use HTTP connection pool - [EverlastingBugstopper], [issue/645] [pull/649]** - - Rover now uses local CA Certificates along with your operating system's native TLS implementation instead of the Rust-based WebPKI implementation. - - [EverlastingBugstopper]: https://github.com/EverlastingBugstopper - [pull/649]: https://github.com/apollographql/rover/pull/649 - [issue/645]: https://github.com/apollographql/rover/issues/645 - -## 🛠 Maintenance - -- **Re-use HTTP connection pool - [EverlastingBugstopper], [pull/650]** - - Rover will now create and reuse the same HTTP connection pool for subsequent requests, which should slightly improve performance. - - [EverlastingBugstopper]: https://github.com/EverlastingBugstopper - [pull/650]: https://github.com/apollographql/rover/pull/650 - -- **Removes unused dependencies - [EverlastingBugstopper], [pull/651]** - - [EverlastingBugstopper]: https://github.com/EverlastingBugstopper - [pull/651]: https://github.com/apollographql/rover/pull/651 - # [0.1.7] 2021-06-29 ## 🚀 Features diff --git a/Cargo.lock b/Cargo.lock index cfac782a6..e7b64a0bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1921,7 +1921,7 @@ dependencies = [ [[package]] name = "rover" -version = "0.1.8" +version = "0.1.7" dependencies = [ "ansi_term 0.12.1", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index c8eaaa9c4..dfd7a0ef0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" name = "rover" readme = "README.md" repository = "https://github.com/apollographql/rover/" -version = "0.1.8" +version = "0.1.7" resolver = "2" [[bin]] diff --git a/README.md b/README.md index 1e3f692b5..fb69e7c32 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ rover graph publish --schema ./path-to-valid-schema test@cats ## Command-line options ```console -Rover 0.1.8 +Rover 0.1.7 Rover - Your Graph Companion Read the getting started guide by running: @@ -118,7 +118,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -curl -sSL https://rover.apollo.dev/nix/v0.1.8 | sh +curl -sSL https://rover.apollo.dev/nix/v0.1.7 | sh ``` You will need `curl` installed on your system to run the above installation commands. You can get the latest version from [the curl downloads page](https://curl.se/download.html). @@ -136,7 +136,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -iwr 'https://rover.apollo.dev/win/v0.1.8' | iex +iwr 'https://rover.apollo.dev/win/v0.1.7' | iex ``` #### npm installer diff --git a/docs/source/getting-started.md b/docs/source/getting-started.md index 2270f6460..be35cda4e 100644 --- a/docs/source/getting-started.md +++ b/docs/source/getting-started.md @@ -20,7 +20,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -curl -sSL https://rover.apollo.dev/nix/v0.1.8 | sh +curl -sSL https://rover.apollo.dev/nix/v0.1.7 | sh ``` You will need `curl` installed on your system to run the above installation commands. You can get the latest version from [the curl downloads page](https://curl.se/download.html). @@ -38,7 +38,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -iwr 'https://rover.apollo.dev/win/v0.1.8' | iex +iwr 'https://rover.apollo.dev/win/v0.1.7' | iex ``` ### `npm` installer diff --git a/installers/binstall/scripts/nix/install.sh b/installers/binstall/scripts/nix/install.sh index 75f18dfb7..6969cb7b3 100755 --- a/installers/binstall/scripts/nix/install.sh +++ b/installers/binstall/scripts/nix/install.sh @@ -16,7 +16,7 @@ BINARY_DOWNLOAD_PREFIX="https://github.com/apollographql/rover/releases/download # Rover version defined in root cargo.toml # Note: this line is built automatically # in build.rs. Don't touch it! -PACKAGE_VERSION="v0.1.8" +PACKAGE_VERSION="v0.1.7" download_binary_and_run_installer() { downloader --check diff --git a/installers/binstall/scripts/windows/install.ps1 b/installers/binstall/scripts/windows/install.ps1 index ba28b94dc..3851b6948 100644 --- a/installers/binstall/scripts/windows/install.ps1 +++ b/installers/binstall/scripts/windows/install.ps1 @@ -9,7 +9,7 @@ # version found in Rover's Cargo.toml # Note: this line is built automatically # in build.rs. Don't touch it! -$package_version = 'v0.1.8' +$package_version = 'v0.1.7' function Install-Binary() { $old_erroractionpreference = $ErrorActionPreference diff --git a/installers/npm/package-lock.json b/installers/npm/package-lock.json index fbb0d7d24..58ba92495 100644 --- a/installers/npm/package-lock.json +++ b/installers/npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "@apollo/rover", - "version": "0.1.8", + "version": "0.1.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@apollo/rover", - "version": "0.1.8", + "version": "0.1.7", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/installers/npm/package.json b/installers/npm/package.json index 21d6766da..6d7ef3a6e 100644 --- a/installers/npm/package.json +++ b/installers/npm/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/rover", - "version": "0.1.8", + "version": "0.1.7", "description": "The new Apollo CLI", "main": "index.js", "bin": { From 80a465cdcc1c2940624b1804004fb43ad47d3b9d Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Wed, 7 Jul 2021 18:43:24 -0500 Subject: [PATCH 5/6] chore: update CI runner to node 16 npm 7 (#668) --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 72e91fdbd..81e0bf096 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: - name: Install Node and npm uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '16' - name: Install Rust if: matrix.rust From acea451898ec1b13d5616afd3e213ecaec9a0411 Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Wed, 7 Jul 2021 18:58:16 -0500 Subject: [PATCH 6/6] release: v0.1.8 (#669) --- CHANGELOG.md | 42 +++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 6 +-- docs/source/getting-started.md | 4 +- installers/binstall/scripts/nix/install.sh | 2 +- .../binstall/scripts/windows/install.ps1 | 2 +- installers/npm/package-lock.json | 4 +- installers/npm/package.json | 2 +- 9 files changed, 54 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5873b1390..1b85fc954 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,48 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## 🛠 Maintenance ## 📚 Documentation --> +# [0.1.8] 2021-07-07 + +## 🚀 Features + +- **Adds _preview_ support for `@tag` and `@inaccessible` directives - [EverlastingBugstopper], [pull/631]** + + **Preview** support for composing subgraphs with `@tag` and/or `@inaccessible` core features using `rover supergraph compose`. Note that `@apollo/gateway >= 0.33` is required when using **preview** support for these core features. + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/631]: https://github.com/apollographql/rover/pull/631 + +- **Auto-decode gzipped responses - [EverlastingBugstopper], [pull/650]** + + If your GraphQL server responds with an introspection response compressed with brotli, it will now be decoded automatically instead of failing the command. + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/650]: https://github.com/apollographql/rover/pull/650 + +## 🐛 Fixes + +- **Use built-in root certificates and re-use HTTP connection pool - [EverlastingBugstopper], [issue/645] [pull/649]** + + Rover now uses local CA Certificates along with your operating system's native TLS implementation instead of the Rust-based WebPKI implementation. + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/649]: https://github.com/apollographql/rover/pull/649 + [issue/645]: https://github.com/apollographql/rover/issues/645 + +## 🛠 Maintenance + +- **Re-use HTTP connection pool - [EverlastingBugstopper], [pull/650]** + + Rover will now create and reuse the same HTTP connection pool for subsequent requests, which should slightly improve performance. + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/650]: https://github.com/apollographql/rover/pull/650 + +- **Removes unused dependencies - [EverlastingBugstopper], [pull/651]** + + [EverlastingBugstopper]: https://github.com/EverlastingBugstopper + [pull/651]: https://github.com/apollographql/rover/pull/651 + # [0.1.7] 2021-06-29 ## 🚀 Features diff --git a/Cargo.lock b/Cargo.lock index e7b64a0bf..cfac782a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1921,7 +1921,7 @@ dependencies = [ [[package]] name = "rover" -version = "0.1.7" +version = "0.1.8" dependencies = [ "ansi_term 0.12.1", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index dfd7a0ef0..c8eaaa9c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" name = "rover" readme = "README.md" repository = "https://github.com/apollographql/rover/" -version = "0.1.7" +version = "0.1.8" resolver = "2" [[bin]] diff --git a/README.md b/README.md index fb69e7c32..1e3f692b5 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ rover graph publish --schema ./path-to-valid-schema test@cats ## Command-line options ```console -Rover 0.1.7 +Rover 0.1.8 Rover - Your Graph Companion Read the getting started guide by running: @@ -118,7 +118,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -curl -sSL https://rover.apollo.dev/nix/v0.1.7 | sh +curl -sSL https://rover.apollo.dev/nix/v0.1.8 | sh ``` You will need `curl` installed on your system to run the above installation commands. You can get the latest version from [the curl downloads page](https://curl.se/download.html). @@ -136,7 +136,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -iwr 'https://rover.apollo.dev/win/v0.1.7' | iex +iwr 'https://rover.apollo.dev/win/v0.1.8' | iex ``` #### npm installer diff --git a/docs/source/getting-started.md b/docs/source/getting-started.md index be35cda4e..2270f6460 100644 --- a/docs/source/getting-started.md +++ b/docs/source/getting-started.md @@ -20,7 +20,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -curl -sSL https://rover.apollo.dev/nix/v0.1.7 | sh +curl -sSL https://rover.apollo.dev/nix/v0.1.8 | sh ``` You will need `curl` installed on your system to run the above installation commands. You can get the latest version from [the curl downloads page](https://curl.se/download.html). @@ -38,7 +38,7 @@ To install a specific version of Rover (note the `v` prefixing the version numbe > Note: If you're installing Rover in a CI environment, it's best to target a specific version rather than using the latest URL, since future major breaking changes could affect CI workflows otherwise. ```bash -iwr 'https://rover.apollo.dev/win/v0.1.7' | iex +iwr 'https://rover.apollo.dev/win/v0.1.8' | iex ``` ### `npm` installer diff --git a/installers/binstall/scripts/nix/install.sh b/installers/binstall/scripts/nix/install.sh index 6969cb7b3..75f18dfb7 100755 --- a/installers/binstall/scripts/nix/install.sh +++ b/installers/binstall/scripts/nix/install.sh @@ -16,7 +16,7 @@ BINARY_DOWNLOAD_PREFIX="https://github.com/apollographql/rover/releases/download # Rover version defined in root cargo.toml # Note: this line is built automatically # in build.rs. Don't touch it! -PACKAGE_VERSION="v0.1.7" +PACKAGE_VERSION="v0.1.8" download_binary_and_run_installer() { downloader --check diff --git a/installers/binstall/scripts/windows/install.ps1 b/installers/binstall/scripts/windows/install.ps1 index 3851b6948..ba28b94dc 100644 --- a/installers/binstall/scripts/windows/install.ps1 +++ b/installers/binstall/scripts/windows/install.ps1 @@ -9,7 +9,7 @@ # version found in Rover's Cargo.toml # Note: this line is built automatically # in build.rs. Don't touch it! -$package_version = 'v0.1.7' +$package_version = 'v0.1.8' function Install-Binary() { $old_erroractionpreference = $ErrorActionPreference diff --git a/installers/npm/package-lock.json b/installers/npm/package-lock.json index 58ba92495..fbb0d7d24 100644 --- a/installers/npm/package-lock.json +++ b/installers/npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "@apollo/rover", - "version": "0.1.7", + "version": "0.1.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@apollo/rover", - "version": "0.1.7", + "version": "0.1.8", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/installers/npm/package.json b/installers/npm/package.json index 6d7ef3a6e..21d6766da 100644 --- a/installers/npm/package.json +++ b/installers/npm/package.json @@ -1,6 +1,6 @@ { "name": "@apollo/rover", - "version": "0.1.7", + "version": "0.1.8", "description": "The new Apollo CLI", "main": "index.js", "bin": {