From a756be797e808f9f1c5f9f238bc65ea42633a149 Mon Sep 17 00:00:00 2001 From: Stacky McStackface Date: Tue, 4 Feb 2025 09:16:18 +0000 Subject: [PATCH 1/2] chore: Generated commit to update templated files since the last template run up to stackabletech/operator-templating@90012815baf2df730635fa27cf9a7992fe676225 Reference-to: stackabletech/operator-templating@9001281 (Fix pre-commit hook) --- .github/workflows/pr_pre-commit.yaml | 2 +- .pre-commit-config.yaml | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr_pre-commit.yaml b/.github/workflows/pr_pre-commit.yaml index ec55fe78..bdc3ddfd 100644 --- a/.github/workflows/pr_pre-commit.yaml +++ b/.github/workflows/pr_pre-commit.yaml @@ -6,7 +6,7 @@ on: env: CARGO_TERM_COLOR: always - RUST_TOOLCHAIN_VERSION: "1.82.0" + RUST_TOOLCHAIN_VERSION: "nightly-2025-01-15" HADOLINT_VERSION: "v2.12.0" PYTHON_VERSION: "3.12" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a36fdcb7..c5bd8ad1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,10 +17,6 @@ repos: - repo: https://github.com/doublify/pre-commit-rust rev: eeee35a89e69d5772bdee97db1a6a898467b686e # 1.0 hooks: - - id: fmt - # Pinning to a specific rustc version, so that we get consistent formatting - entry: RUSTUP_TOOLCHAIN=nightly-2025-01-15 cargo fmt - args: ["--all", "--", "--check"] - id: clippy args: ["--all-targets", "--", "-D", "warnings"] @@ -78,3 +74,10 @@ repos: entry: cargo test stages: [pre-commit, pre-merge-commit, manual] pass_filenames: false + + - id: cargo-rustfmt + name: cargo-rustfmt + language: system + entry: cargo +nightly-2025-01-15 fmt --all -- --check + stages: [pre-commit] + pass_filenames: false From d27dd5232ff09409f7bc01fd2c56fb475d3997e8 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 4 Feb 2025 10:55:16 +0100 Subject: [PATCH 2/2] chore: Apply formatting --- rust/crd/src/affinity.rs | 8 ++++---- rust/operator-binary/src/controller.rs | 11 ++++------- rust/operator-binary/src/discovery.rs | 11 +++++------ rust/operator-binary/src/kerberos.rs | 3 ++- rust/operator-binary/src/product_logging.rs | 4 ++-- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/rust/crd/src/affinity.rs b/rust/crd/src/affinity.rs index ecaf78f9..434499a5 100644 --- a/rust/crd/src/affinity.rs +++ b/rust/crd/src/affinity.rs @@ -21,12 +21,9 @@ pub fn get_affinity(cluster_name: &str, role: &HiveRole) -> StackableAffinityFra #[cfg(test)] mod tests { - use super::*; - - use rstest::rstest; use std::collections::BTreeMap; - use crate::HiveCluster; + use rstest::rstest; use stackable_operator::{ commons::affinity::StackableAffinity, k8s_openapi::{ @@ -35,6 +32,9 @@ mod tests { }, }; + use super::*; + use crate::HiveCluster; + #[rstest] #[case(HiveRole::MetaStore)] fn test_affinity_defaults(#[case] role: HiveRole) { diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index 14bc310c..35af5fa1 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -37,15 +37,16 @@ use stackable_operator::{ commons::{ product_image_selection::ResolvedProductImage, rbac::build_rbac_resources, - s3::{S3AccessStyle, S3ConnectionSpec}, + s3::{S3AccessStyle, S3ConnectionSpec, S3Error}, tls_verification::TlsClientDetailsError, }, k8s_openapi::{ api::{ apps::v1::{StatefulSet, StatefulSetSpec}, core::v1::{ - ConfigMap, ConfigMapVolumeSource, EmptyDirVolumeSource, Probe, Service, - ServicePort, ServiceSpec, TCPSocketAction, Volume, + ConfigMap, ConfigMapVolumeSource, EmptyDirVolumeSource, EnvVar, EnvVarSource, + Probe, SecretKeySelector, Service, ServicePort, ServiceSpec, TCPSocketAction, + Volume, }, }, apimachinery::pkg::{ @@ -80,10 +81,6 @@ use stackable_operator::{ time::Duration, utils::{cluster_info::KubernetesClusterInfo, COMMON_BASH_TRAP_FUNCTIONS}, }; -use stackable_operator::{ - commons::s3::S3Error, - k8s_openapi::api::core::v1::{EnvVar, EnvVarSource, SecretKeySelector}, -}; use strum::EnumDiscriminants; use tracing::warn; diff --git a/rust/operator-binary/src/discovery.rs b/rust/operator-binary/src/discovery.rs index 326b4c39..5e3f268a 100644 --- a/rust/operator-binary/src/discovery.rs +++ b/rust/operator-binary/src/discovery.rs @@ -1,16 +1,15 @@ -use crate::controller::build_recommended_labels; +use std::{collections::BTreeSet, num::TryFromIntError}; use snafu::{OptionExt, ResultExt, Snafu}; use stackable_hive_crd::{HiveCluster, HiveRole, ServiceType, HIVE_PORT, HIVE_PORT_NAME}; -use stackable_operator::commons::product_image_selection::ResolvedProductImage; use stackable_operator::{ builder::{configmap::ConfigMapBuilder, meta::ObjectMetaBuilder}, - k8s_openapi::api::core::v1::ConfigMap, - k8s_openapi::api::core::v1::{Endpoints, Service, ServiceSpec}, + commons::product_image_selection::ResolvedProductImage, + k8s_openapi::api::core::v1::{ConfigMap, Endpoints, Service, ServiceSpec}, kube::{runtime::reflector::ObjectRef, Resource}, }; -use std::collections::BTreeSet; -use std::num::TryFromIntError; + +use crate::controller::build_recommended_labels; #[derive(Snafu, Debug)] pub enum Error { diff --git a/rust/operator-binary/src/kerberos.rs b/rust/operator-binary/src/kerberos.rs index f70d032d..aa95d69e 100644 --- a/rust/operator-binary/src/kerberos.rs +++ b/rust/operator-binary/src/kerberos.rs @@ -1,3 +1,5 @@ +use std::collections::BTreeMap; + use indoc::formatdoc; use snafu::{ResultExt, Snafu}; use stackable_hive_crd::{HiveCluster, HiveRole, HIVE_SITE_XML, STACKABLE_CONFIG_DIR}; @@ -16,7 +18,6 @@ use stackable_operator::{ kube::ResourceExt, utils::cluster_info::KubernetesClusterInfo, }; -use std::collections::BTreeMap; #[derive(Snafu, Debug)] #[allow(clippy::enum_variant_names)] // all variants have the same prefix: `Add` diff --git a/rust/operator-binary/src/product_logging.rs b/rust/operator-binary/src/product_logging.rs index 7ed70087..0af87dfc 100644 --- a/rust/operator-binary/src/product_logging.rs +++ b/rust/operator-binary/src/product_logging.rs @@ -1,5 +1,3 @@ -use crate::controller::MAX_HIVE_LOG_FILES_SIZE; - use snafu::{OptionExt, ResultExt, Snafu}; use stackable_hive_crd::{ Container, HiveCluster, HIVE_METASTORE_LOG4J2_PROPERTIES, STACKABLE_LOG_DIR, @@ -17,6 +15,8 @@ use stackable_operator::{ role_utils::RoleGroupRef, }; +use crate::controller::MAX_HIVE_LOG_FILES_SIZE; + #[derive(Snafu, Debug)] pub enum Error { #[snafu(display("object has no namespace"))]