Skip to content

Commit

Permalink
Fix error: failed to select a version for router-bridge (#4946)
Browse files Browse the repository at this point in the history
router-bridge was added as a dendency of router-fuzz in a recent PR, but
the dependency in apollo-router had been upgraded in the meantime. This
switches to specify common dependencies in the workspace, so that
version numbers are de-duplicated.

Note that `Cargo.lock` is not changed by this PR.

<!-- start metadata -->
---

**Checklist**

Complete the checklist (and note appropriate exceptions) before the PR
is marked ready-for-review.

- [ ] Changes are compatible[^1]
- [ ] Documentation[^2] completed
- [ ] Performance impact assessed and acceptable
- Tests added and passing[^3]
    - [ ] Unit Tests
    - [ ] Integration Tests
    - [ ] Manual Tests

**Exceptions**

*Note any exceptions here*

**Notes**

[^1]: It may be appropriate to bring upcoming changes to the attention
of other (impacted) groups. Please endeavour to do this before seeking
PR approval. The mechanism for doing this will vary considerably, so use
your judgement as to how and when to do this.
[^2]: Configuration is an important part of many changes. Where
applicable please try to document configuration examples.
[^3]: Tick whichever testing boxes are applicable. If you are adding
Manual Tests, please document the manual testing (extensively) in the
Exceptions.
  • Loading branch information
SimonSapin authored Apr 12, 2024
1 parent 847d055 commit ad8e0c6
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 51 deletions.
File renamed without changes.
30 changes: 30 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,33 @@ incremental = false
[profile.release-dhat]
inherits = "release"
debug = 1

# Dependencies used in more than one place are specified here in order to keep versions in sync:
# https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table
[workspace.dependencies]
apollo-compiler = "=1.0.0-beta.15"
apollo-parser = "0.7.6"
apollo-smith = { version = "0.5.0", features = ["parser-impl"] }
async-trait = "0.1.77"
http = "0.2.11"
once_cell = "1.19.0"
reqwest = { version = "0.11.24", default-features = false, features = [
"rustls-tls",
"rustls-native-certs",
"gzip",
"json",
"stream",
] }

# note: this dependency should _always_ be pinned, prefix the version with an `=`
router-bridge = "=0.5.18+v2.7.2"

schemars = { version = "0.8.16", features = ["url"] }
serde = { version = "1.0.197", features = ["derive", "rc"] }
serde_json = { version = "1.0.114", features = [
"preserve_order",
"float_roundtrip",
] }
serde_json_bytes = { version = "0.2.2", features = ["preserve_order"] }
tokio = { version = "1.36.0", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
14 changes: 6 additions & 8 deletions apollo-router-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@ edition = "2021"
license = "Elastic-2.0"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
apollo-router = { path = "../apollo-router" }
criterion = { version = "0.5", features = ["async_tokio", "async_futures"] }
memory-stats = "1.1.0"
once_cell = "1"
serde_json = { version = "1", features = ["preserve_order", "float_roundtrip"] }
tokio = { version = "1", features = ["full"] }
tower = "0.4"
once_cell.workspace = true
serde_json.workspace = true
tokio.workspace = true
tower.workspace = true

[build-dependencies]
apollo-smith = { version = "0.5.0", features = ["parser-impl"] }
apollo-parser = "0.7.6"
apollo-smith.workspace = true
apollo-parser.workspace = true
arbitrary = "1.3.2"

[[bench]]
Expand Down
52 changes: 26 additions & 26 deletions apollo-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ features = ["docs_rs"]
askama = "0.12.1"
access-json = "0.1.0"
anyhow = "1.0.80"
apollo-compiler = "=1.0.0-beta.15"
apollo-compiler.workspace = true
apollo-federation = "=0.0.10"
arc-swap = "1.6.0"
async-channel = "1.9.0"
Expand All @@ -74,7 +74,7 @@ async-compression = { version = "0.4.6", features = [
"gzip",
"deflate",
] }
async-trait = "0.1.77"
async-trait.workspace = true
axum = { version = "0.6.20", features = ["headers", "json", "original-uri"] }
base64 = "0.21.7"
bloomfilter = "1.0.13"
Expand Down Expand Up @@ -104,7 +104,7 @@ fred = { version = "7.1.2", features = ["enable-rustls"] }
futures = { version = "0.3.30", features = ["thread-pool"] }
graphql_client = "0.13.0"
hex = { version = "0.4.3", features = ["serde"] }
http = "0.2.11"
http.workspace = true
http-body = "0.4.6"
heck = "0.4.1"
humantime = "2.1.0"
Expand Down Expand Up @@ -179,37 +179,27 @@ proteus = "0.5.0"
rand = "0.8.5"
rhai = { version = "=1.17.1", features = ["sync", "serde", "internals"] }
regex = "1.10.3"
reqwest = { version = "0.11.24", default-features = false, features = [
"rustls-tls",
"rustls-native-certs",
"gzip",
"json",
"stream",
] }
# note: this dependency should _always_ be pinned, prefix the version with an `=`
router-bridge = "=0.5.18+v2.7.2"
reqwest.workspace = true
router-bridge.workspace = true
rust-embed = "8.2.0"
rustls = "0.21.10"
rustls-native-certs = "0.6.3"
rustls-pemfile = "1.0.4"
schemars = { version = "0.8.16", features = ["url"] }
schemars.workspace = true
shellexpand = "3.1.0"
sha2 = "0.10.8"
semver = "1.0.22"
serde = { version = "1.0.197", features = ["derive", "rc"] }
serde.workspace = true
serde_derive_default = "0.1"
serde_json_bytes = { version = "0.2.2", features = ["preserve_order"] }
serde_json = { version = "1.0.114", features = [
"preserve_order",
"float_roundtrip",
] }
serde_json_bytes.workspace = true
serde_json.workspace = true
serde_urlencoded = "0.7.1"
serde_yaml = "0.8.26"
static_assertions = "1.1.0"
strum_macros = "0.25.3"
sys-info = "0.9.1"
thiserror = "1.0.57"
tokio = { version = "1.36.0", features = ["full"] }
tokio.workspace = true
tokio-stream = { version = "0.1.14", features = ["sync", "net"] }
tokio-util = { version = "0.7.10", features = ["net", "codec", "time"] }
tonic = { version = "0.9.2", features = [
Expand All @@ -218,7 +208,7 @@ tonic = { version = "0.9.2", features = [
"tls-roots",
"gzip",
] }
tower = { version = "0.4.13", features = ["full"] }
tower.workspace = true
tower-http = { version = "0.4.4", features = [
"add-extension",
"trace",
Expand Down Expand Up @@ -273,7 +263,9 @@ uname = "0.1.1"

[target.'cfg(unix)'.dependencies]
uname = "0.1.1"
hyperlocal = { version = "0.8.0", default-features = false, features = ["client"] }
hyperlocal = { version = "0.8.0", default-features = false, features = [
"client",
] }

[target.'cfg(target_os = "linux")'.dependencies]
tikv-jemallocator = "0.5"
Expand All @@ -293,10 +285,15 @@ maplit = "1.0.2"
memchr = { version = "2.7.1", default-features = false }
mockall = "0.11.4"
num-traits = "0.2.18"
once_cell = "1.19.0"
once_cell.workspace = true
opentelemetry-stdout = { version = "0.1.0", features = ["trace"] }
opentelemetry = { version = "0.20.0", features = ["testing"] }
opentelemetry-proto = { version="0.5.0", features = ["metrics", "trace", "gen-tonic-messages", "with-serde"] }
opentelemetry-proto = { version = "0.5.0", features = [
"metrics",
"trace",
"gen-tonic-messages",
"with-serde",
] }
p256 = "0.13.2"
rand_core = "0.6.4"
reqwest = { version = "0.11.24", default-features = false, features = [
Expand Down Expand Up @@ -333,12 +330,15 @@ wiremock = "0.5.22"
rstack = { version = "0.3.3", features = ["dw"], default-features = false }

[target.'cfg(unix)'.dev-dependencies]
hyperlocal = { version = "0.8.0", default-features = false, features = ["client", "server"] }
hyperlocal = { version = "0.8.0", default-features = false, features = [
"client",
"server",
] }

[build-dependencies]
tonic-build = "0.9.2"
basic-toml = "0.1"
serde_json = "1.0.114"
serde_json.workspace = true

[[test]]
name = "integration_tests"
Expand Down
13 changes: 11 additions & 2 deletions apollo-router/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@ mod studio;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let cargo_manifest: serde_json::Value = basic_toml::from_str(
&fs::read_to_string(PathBuf::from(&env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"))
.expect("could not read Cargo.toml"),
&fs::read_to_string(
PathBuf::from(&env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("Cargo.toml"),
)
.expect("could not read Cargo.toml"),
)
.expect("could not parse Cargo.toml");

let router_bridge = cargo_manifest
.get("workspace")
.expect("Cargo.toml does not contain workspace")
.as_object()
.expect("Cargo.toml workspace key is not an object")
.get("dependencies")
.expect("Cargo.toml does not contain dependencies")
.as_object()
Expand Down
13 changes: 11 additions & 2 deletions apollo-router/src/query_planner/bridge_query_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1484,11 +1484,20 @@ mod tests {
#[test]
fn router_bridge_dependency_is_pinned() {
let cargo_manifest: serde_json::Value = basic_toml::from_str(
&fs::read_to_string(PathBuf::from(&env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"))
.expect("could not read Cargo.toml"),
&fs::read_to_string(
PathBuf::from(&env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("Cargo.toml"),
)
.expect("could not read Cargo.toml"),
)
.expect("could not parse Cargo.toml");
let router_bridge_version = cargo_manifest
.get("workspace")
.expect("Cargo.toml does not contain workspace")
.as_object()
.expect("Cargo.toml workspace key is not an object")
.get("dependencies")
.expect("Cargo.toml does not contain dependencies")
.as_object()
Expand Down
26 changes: 13 additions & 13 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ cargo-fuzz = true

[dependencies]
libfuzzer-sys = "0.4"
apollo-compiler = "=1.0.0-beta.15"
apollo-smith = { version = "0.5.0", features = ["parser-impl"] }
apollo-parser = "0.7.6"
apollo-compiler.workspace = true
apollo-smith.workspace = true
apollo-parser.workspace = true
env_logger = "0.10.2"
log = "0.4"
reqwest = { version = "0.11", default-features = false, features = ["json", "blocking"] }
router-bridge = "=0.5.17+v2.7.2"
serde_json = "1"
tokio = { version = "1.36.0", features = ["full"] }
reqwest = { workspace = true, features = ["json", "blocking"] }
router-bridge.workspace = true
serde_json.workspace = true
tokio.workspace = true

[dev-dependencies]
anyhow = "1"
apollo-router = { path = "../apollo-router" }
async-trait = "0.1"
schemars = { version = "0.8", features = ["url"] }
serde = "1"
serde_json_bytes = "0.2"
tower = { version = "0.4", features = ["full"] }
http = "0.2"
async-trait.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json_bytes.workspace = true
tower.workspace = true
http.workspace = true

[[example]]
name = "usage_reporting_router"
Expand Down

0 comments on commit ad8e0c6

Please sign in to comment.