From 2eac9319930cdb3d993b8ccce721d55dfb02d1fa Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Sat, 14 Aug 2021 00:03:17 +0200 Subject: [PATCH 1/4] Print startu diagnostic information using the built crate --- Cargo.lock | 188 +++++++++++++++++++++++++++++++++++++++++--- crd/Cargo.toml | 2 +- operator/Cargo.toml | 2 +- server/Cargo.toml | 8 +- server/build.rs | 3 + server/src/main.rs | 14 +++- 6 files changed, 203 insertions(+), 14 deletions(-) create mode 100644 server/build.rs diff --git a/Cargo.lock b/Cargo.lock index 7447786..dc1b3ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,6 +80,17 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da1976d75adbe5fbc88130ecd119529cf1cc6a93ae1546d8696ee66f0d21af1" +[[package]] +name = "built" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f346b6890a0dfa7266974910e7df2d5088120dd54721b9b0e5aae1ae5e05715" +dependencies = [ + "cargo-lock", + "chrono", + "git2", +] + [[package]] name = "bumpalo" version = "3.7.0" @@ -92,11 +103,26 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +[[package]] +name = "cargo-lock" +version = "7.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb04b88bd5b2036e30704f95c6ee16f3b5ca3b4ca307da2889d9006648e5c88" +dependencies = [ + "semver", + "serde", + "toml", + "url", +] + [[package]] name = "cc" version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -479,6 +505,19 @@ dependencies = [ "wasi", ] +[[package]] +name = "git2" +version = "0.13.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "659cd14835e75b64d9dba5b660463506763cf0aa6cb640aeeb0e98d841093490" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "url", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -608,6 +647,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indexmap" version = "1.7.0" @@ -644,6 +694,15 @@ dependencies = [ "regex", ] +[[package]] +name = "jobserver" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5ca711fd837261e14ec9e674f092cbb931d3fa1482b017ae59328ddc6f3212b" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.52" @@ -791,6 +850,30 @@ version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765" +[[package]] +name = "libgit2-sys" +version = "0.12.22+1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89c53ac117c44f7042ad8d8f5681378dfbc6010e49ec2c0d1f11dfedc7a4a1c3" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libz-sys" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linked-hash-map" version = "0.5.4" @@ -817,9 +900,9 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" @@ -1300,6 +1383,9 @@ name = "semver" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +dependencies = [ + "serde", +] [[package]] name = "serde" @@ -1438,7 +1524,39 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "stackable-operator" version = "0.1.0-nightly" -source = "git+https://github.com/stackabletech/operator-rs.git?branch=main#732baf5351058e6e507e34756e987407aba87cbe" +source = "git+https://github.com/stackabletech/operator-rs.git?branch=built_info#c5364ca4d4ae750e9fcc9f8f64175b83c72abc15" +dependencies = [ + "async-trait", + "backoff", + "chrono", + "clap", + "const_format", + "either", + "futures", + "json-patch", + "k8s-openapi", + "kube", + "kube-runtime", + "lazy_static", + "product-config", + "rand", + "regex", + "schemars", + "serde", + "serde_json", + "serde_yaml", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "tracing-subscriber", + "uuid", +] + +[[package]] +name = "stackable-operator" +version = "0.1.0-nightly" +source = "git+https://github.com/stackabletech/operator-rs.git?branch=main#1d3f3ef477a3e76c5c51d275510bf689339e8ae0" dependencies = [ "async-trait", "backoff", @@ -1483,7 +1601,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "stackable-operator", + "stackable-operator 0.1.0-nightly (git+https://github.com/stackabletech/operator-rs.git?branch=built_info)", "stackable-spark-common", "stackable-spark-test-utils", "strum", @@ -1505,7 +1623,7 @@ dependencies = [ "semver", "serde", "serde_json", - "stackable-operator", + "stackable-operator 0.1.0-nightly (git+https://github.com/stackabletech/operator-rs.git?branch=built_info)", "stackable-spark-common", "stackable-spark-crd", "stackable-spark-test-utils", @@ -1519,8 +1637,9 @@ dependencies = [ name = "stackable-spark-operator-server" version = "0.1.0-nightly" dependencies = [ + "built", "serde_yaml", - "stackable-operator", + "stackable-operator 0.1.0-nightly (git+https://github.com/stackabletech/operator-rs.git?branch=built_info)", "stackable-spark-crd", "stackable-spark-operator", "tokio", @@ -1535,7 +1654,7 @@ dependencies = [ "kube", "serde", "serde_yaml", - "stackable-operator", + "stackable-operator 0.1.0-nightly (git+https://github.com/stackabletech/operator-rs.git?branch=main)", "stackable-spark-crd", "stackable-spark-operator", ] @@ -1647,11 +1766,26 @@ dependencies = [ "winapi", ] +[[package]] +name = "tinyvec" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + [[package]] name = "tokio" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c" +checksum = "01cf844b23c6131f624accf65ce0e4e9956a8bb329400ea5bcc26ae3a5c20b0b" dependencies = [ "autocfg", "libc", @@ -1721,6 +1855,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + [[package]] name = "tower" version = "0.4.8" @@ -1868,6 +2011,21 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "unicode-bidi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.8.0" @@ -1892,6 +2050,18 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + [[package]] name = "uuid" version = "0.8.2" diff --git a/crd/Cargo.toml b/crd/Cargo.toml index c3cf242..afd3e63 100644 --- a/crd/Cargo.toml +++ b/crd/Cargo.toml @@ -8,7 +8,7 @@ version = "0.1.0" [dependencies] product-config = { git = "https://github.com/stackabletech/product-config.git", branch = "main" } -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "built_info" } stackable-spark-common = { path = "../common" } k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_20"] } diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 7c3f711..1916a62 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -8,7 +8,7 @@ license = "OSL-3.0" [dependencies] product-config = { git = "https://github.com/stackabletech/product-config.git", branch = "main" } -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "built_info" } stackable-spark-common = { path = "../common" } stackable-spark-crd = { path = "../crd" } diff --git a/server/Cargo.toml b/server/Cargo.toml index 6c69c47..3d0bc33 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,13 +1,14 @@ [package] name = "stackable-spark-operator-server" -description = "Stackable Spark Operator" +description = "Stackable Operator for Apache Spark" version = "0.1.0-nightly" authors = ["Malte Sander "] edition = "2018" license = "OSL-3.0" +build = "build.rs" [dependencies] -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "built_info" } stackable-spark-crd = { path = "../crd" } stackable-spark-operator = { path = "../operator" } @@ -15,6 +16,9 @@ serde_yaml = "0.8" tokio = { version = "1.9", features = ["macros", "rt-multi-thread"] } tracing = "0.1" +[build-dependencies] +built = { version = "0.5", features = ["chrono", "git2"] } + [package.metadata.deb] maintainer-scripts = "packaging/debian/" systemd-units = { enable = false } diff --git a/server/build.rs b/server/build.rs new file mode 100644 index 0000000..d8f91cb --- /dev/null +++ b/server/build.rs @@ -0,0 +1,3 @@ +fn main() { + built::write_built_file().expect("Failed to acquire build-time information"); +} diff --git a/server/src/main.rs b/server/src/main.rs index 5f9c4d2..1ace901 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -4,11 +4,23 @@ use stackable_spark_crd::SparkCluster; use stackable_spark_crd::{Restart, Start, Stop}; use tracing::{error, info}; +mod built_info { + // The file has been placed there by the build script. + include!(concat!(env!("OUT_DIR"), "/built.rs")); +} + #[tokio::main] async fn main() -> Result<(), error::Error> { stackable_operator::logging::initialize_logging("SPARK_OPERATOR_LOG"); - info!("Starting Stackable Operator for Apache Spark"); + stackable_operator::utils::print_startup_string( + built_info::PKG_DESCRIPTION, + built_info::PKG_VERSION, + built_info::GIT_VERSION, + built_info::TARGET, + built_info::BUILT_TIME_UTC, + built_info::RUSTC_VERSION, + ); let client = client::create_client(Some("spark.stackable.tech".to_string())).await?; From a19ce5c4440d15ae7beacae506575228c374f347 Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Sat, 14 Aug 2021 00:10:17 +0200 Subject: [PATCH 2/4] unused import --- server/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main.rs b/server/src/main.rs index 1ace901..e1dc03c 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -2,7 +2,7 @@ use stackable_operator::crd::CustomResourceExt; use stackable_operator::{client, error}; use stackable_spark_crd::SparkCluster; use stackable_spark_crd::{Restart, Start, Stop}; -use tracing::{error, info}; +use tracing::error; mod built_info { // The file has been placed there by the build script. From d883ff2d7c3c8f4dc7a9f9e8bb691f7cee9065f5 Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Mon, 16 Aug 2021 16:58:07 +0200 Subject: [PATCH 3/4] Use main branch of operator --- Cargo.lock | 40 ++++------------------------------------ crd/Cargo.toml | 2 +- operator/Cargo.toml | 2 +- server/Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dc1b3ab..9bae023 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1521,38 +1521,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "stackable-operator" -version = "0.1.0-nightly" -source = "git+https://github.com/stackabletech/operator-rs.git?branch=built_info#c5364ca4d4ae750e9fcc9f8f64175b83c72abc15" -dependencies = [ - "async-trait", - "backoff", - "chrono", - "clap", - "const_format", - "either", - "futures", - "json-patch", - "k8s-openapi", - "kube", - "kube-runtime", - "lazy_static", - "product-config", - "rand", - "regex", - "schemars", - "serde", - "serde_json", - "serde_yaml", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "tracing-subscriber", - "uuid", -] - [[package]] name = "stackable-operator" version = "0.1.0-nightly" @@ -1601,7 +1569,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "stackable-operator 0.1.0-nightly (git+https://github.com/stackabletech/operator-rs.git?branch=built_info)", + "stackable-operator", "stackable-spark-common", "stackable-spark-test-utils", "strum", @@ -1623,7 +1591,7 @@ dependencies = [ "semver", "serde", "serde_json", - "stackable-operator 0.1.0-nightly (git+https://github.com/stackabletech/operator-rs.git?branch=built_info)", + "stackable-operator", "stackable-spark-common", "stackable-spark-crd", "stackable-spark-test-utils", @@ -1639,7 +1607,7 @@ version = "0.1.0-nightly" dependencies = [ "built", "serde_yaml", - "stackable-operator 0.1.0-nightly (git+https://github.com/stackabletech/operator-rs.git?branch=built_info)", + "stackable-operator", "stackable-spark-crd", "stackable-spark-operator", "tokio", @@ -1654,7 +1622,7 @@ dependencies = [ "kube", "serde", "serde_yaml", - "stackable-operator 0.1.0-nightly (git+https://github.com/stackabletech/operator-rs.git?branch=main)", + "stackable-operator", "stackable-spark-crd", "stackable-spark-operator", ] diff --git a/crd/Cargo.toml b/crd/Cargo.toml index afd3e63..c3cf242 100644 --- a/crd/Cargo.toml +++ b/crd/Cargo.toml @@ -8,7 +8,7 @@ version = "0.1.0" [dependencies] product-config = { git = "https://github.com/stackabletech/product-config.git", branch = "main" } -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "built_info" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } stackable-spark-common = { path = "../common" } k8s-openapi = { version = "0.12.0", default-features = false, features = ["v1_20"] } diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 1916a62..7c3f711 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -8,7 +8,7 @@ license = "OSL-3.0" [dependencies] product-config = { git = "https://github.com/stackabletech/product-config.git", branch = "main" } -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "built_info" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } stackable-spark-common = { path = "../common" } stackable-spark-crd = { path = "../crd" } diff --git a/server/Cargo.toml b/server/Cargo.toml index 3d0bc33..d338429 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -8,7 +8,7 @@ license = "OSL-3.0" build = "build.rs" [dependencies] -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "built_info" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } stackable-spark-crd = { path = "../crd" } stackable-spark-operator = { path = "../operator" } From 8181bc9223818b4f7b16a68a9d7e153c5e398c66 Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Mon, 16 Aug 2021 17:02:22 +0200 Subject: [PATCH 4/4] Use main branch of operator --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9bae023..8f84ece 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,9 +76,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bitflags" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da1976d75adbe5fbc88130ecd119529cf1cc6a93ae1546d8696ee66f0d21af1" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "built" @@ -161,9 +161,9 @@ dependencies = [ [[package]] name = "const_format" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f4087b5a1164f92255f8b301c88fc8627e5abf5e25b5476f84b02e4b47795d" +checksum = "49aad96768495418a04c9349327f32f2cd7e9bf8ac6b142534466048721c8ff5" dependencies = [ "const_format_proc_macros", ] @@ -1524,7 +1524,7 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "stackable-operator" version = "0.1.0-nightly" -source = "git+https://github.com/stackabletech/operator-rs.git?branch=main#1d3f3ef477a3e76c5c51d275510bf689339e8ae0" +source = "git+https://github.com/stackabletech/operator-rs.git?branch=main#8bdfc7bfe2cb5d654e89c0743faaad5fe252eb44" dependencies = [ "async-trait", "backoff",