From 34fd393d83e14903619260e81cd9fa4b514c4024 Mon Sep 17 00:00:00 2001 From: Stacky McStackface Date: Tue, 4 Feb 2025 09:16:27 +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 ec55fe7..bdc3ddf 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 a36fdcb..c5bd8ad 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 c429c8fc232548e3497ff04ab69cbcd5d0ba363a Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 4 Feb 2025 10:33:44 +0100 Subject: [PATCH 2/2] chore: Apply formatting --- rust/operator-binary/src/main.rs | 15 +++--- .../src/restart_controller/statefulset.rs | 49 ++++++++++--------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index b8ffbba..1f793ca 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -1,15 +1,16 @@ mod restart_controller; use built_info::PKG_VERSION; -use futures::pin_mut; -use stackable_operator::cli::{Command, ProductOperatorRun}; - use clap::{crate_description, crate_version, Parser}; -use stackable_operator::commons::{ - authentication::AuthenticationClass, - s3::{S3Bucket, S3Connection}, +use futures::pin_mut; +use stackable_operator::{ + cli::{Command, ProductOperatorRun}, + commons::{ + authentication::AuthenticationClass, + s3::{S3Bucket, S3Connection}, + }, + CustomResourceExt, }; -use stackable_operator::CustomResourceExt; mod built_info { include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/rust/operator-binary/src/restart_controller/statefulset.rs b/rust/operator-binary/src/restart_controller/statefulset.rs index 526dec5..b321331 100644 --- a/rust/operator-binary/src/restart_controller/statefulset.rs +++ b/rust/operator-binary/src/restart_controller/statefulset.rs @@ -1,30 +1,35 @@ -use std::collections::BTreeMap; -use std::sync::atomic::AtomicBool; -use std::sync::Arc; -use std::time::Duration; +use std::{ + collections::BTreeMap, + sync::{atomic::AtomicBool, Arc}, + time::Duration, +}; use futures::{stream, Stream, StreamExt, TryStream}; use serde_json::json; use snafu::{ResultExt, Snafu}; -use stackable_operator::client::Client; -use stackable_operator::k8s_openapi::api::apps::v1::StatefulSet; -use stackable_operator::k8s_openapi::api::core::v1::{ - ConfigMap, EnvFromSource, EnvVar, PodSpec, Secret, Volume, -}; -use stackable_operator::kube; -use stackable_operator::kube::api::{PartialObjectMeta, Patch, PatchParams}; -use stackable_operator::kube::core::{error_boundary, DeserializeGuard, DynamicObject}; -use stackable_operator::kube::runtime::controller::{ - trigger_self, trigger_with, Action, ReconcileRequest, -}; -use stackable_operator::kube::runtime::events::{Recorder, Reporter}; -use stackable_operator::kube::runtime::reflector::{ObjectRef, Store}; -use stackable_operator::kube::runtime::{ - applier, metadata_watcher, reflector, watcher, Config, WatchStreamExt, +use stackable_operator::{ + client::Client, + k8s_openapi::api::{ + apps::v1::StatefulSet, + core::v1::{ConfigMap, EnvFromSource, EnvVar, PodSpec, Secret, Volume}, + }, + kube, + kube::{ + api::{PartialObjectMeta, Patch, PatchParams}, + core::{error_boundary, DeserializeGuard, DynamicObject}, + runtime::{ + applier, + controller::{trigger_self, trigger_with, Action, ReconcileRequest}, + events::{Recorder, Reporter}, + metadata_watcher, reflector, + reflector::{ObjectRef, Store}, + watcher, Config, WatchStreamExt, + }, + Resource, ResourceExt, + }, + logging::controller::{report_controller_reconciled, ReconcilerError}, + namespace::WatchNamespace, }; -use stackable_operator::kube::{Resource, ResourceExt}; -use stackable_operator::logging::controller::{report_controller_reconciled, ReconcilerError}; -use stackable_operator::namespace::WatchNamespace; use strum::{EnumDiscriminants, IntoStaticStr}; const FULL_CONTROLLER_NAME: &str = "statefulset.restarter.commons.stackable.tech";