diff --git a/.github/workflows/pr_pipeline.yml b/.github/workflows/pr_pipeline.yml index 12cfef62..0d06d578 100644 --- a/.github/workflows/pr_pipeline.yml +++ b/.github/workflows/pr_pipeline.yml @@ -29,7 +29,7 @@ jobs: run: cargo test - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v4.1.0 + uses: gittools/actions/gitversion/setup@v4.2.0 - name: Create GitVersion.yml run: | @@ -40,9 +40,13 @@ jobs: no-bump-message: '(none|skip|no-release|trivial|docs|documentation|style|refactor|chore|chore\(deps\)|test):' EOF - - name: Determine Version + - name: Run GitVersion id: gitversion - uses: gittools/actions/gitversion/execute@v4.1.0 + uses: gittools/actions/gitversion/execute@v4.2.0 + + - name: Display GitVersion majorMinorPatch + run: | + echo "majorMinorPatch : ${{ env.majorMinorPatch }}" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e6a5e1e..89a268e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: run: cargo test - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v4.1.0 + uses: gittools/actions/gitversion/setup@v4.2.0 - name: Create GitVersion.yml run: | @@ -40,9 +40,13 @@ jobs: no-bump-message: '(none|skip|no-release|trivial|docs|documentation|style|refactor|chore|chore\(deps\)|test):' EOF - - name: Determine Version + - name: Run GitVersion id: gitversion - uses: gittools/actions/gitversion/execute@v4.1.0 + uses: gittools/actions/gitversion/execute@v4.2.0 + + - name: Display GitVersion majorMinorPatch + run: | + echo "majorMinorPatch : ${{ env.majorMinorPatch }}" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/Cargo.lock b/Cargo.lock index fe8d11a2..0ed1c329 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -104,9 +104,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.43" +version = "1.2.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2" +checksum = "35900b6c8d709fb1d854671ae27aeaa9eec2f8b01b364e1619a40da3e6fe2afe" dependencies = [ "find-msvc-tools", "shlex", @@ -241,7 +241,7 @@ dependencies = [ [[package]] name = "gitlab-tokens-exporter" -version = "2.5.1" +version = "2.5.2" dependencies = [ "axum", "chrono", @@ -501,9 +501,9 @@ checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "iri-string" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" dependencies = [ "memchr", "serde", @@ -730,9 +730,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -861,9 +861,9 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustls" -version = "0.23.34" +version = "0.23.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9586e9ee2b4f8fab52a0048ca7334d7024eef48e2cb9407e3497bb7cab7fa7" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" dependencies = [ "once_cell", "ring", @@ -1032,9 +1032,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.108" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", @@ -1252,9 +1252,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "unicode-ident" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "untrusted" @@ -1384,9 +1384,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b130c0d2d49f8b6889abc456e795e82525204f27c42cf767cf0d7734e089b8" +checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" dependencies = [ "rustls-pki-types", ] diff --git a/Cargo.toml b/Cargo.toml index 0b8c0559..440f85ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gitlab-tokens-exporter" -version = "2.5.1" +version = "2.5.2" edition = "2024" description = "Export gitlab tokens remaining validity days as prometheus metrics" license = "Apache-2.0 license" diff --git a/Dockerfile b/Dockerfile index 4cc1ad75..265a4b0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.90.0-alpine3.22 AS builder +FROM rust:1.91.1-alpine3.22 AS builder RUN apk update && apk add --no-cache musl-dev diff --git a/src/gitlab/token.rs b/src/gitlab/token.rs index f545051f..5040c92b 100644 --- a/src/gitlab/token.rs +++ b/src/gitlab/token.rs @@ -19,7 +19,6 @@ pub enum AccessLevel { } impl Display for AccessLevel { - #[expect(clippy::min_ident_chars, reason = "Parameter name from std trait")] #[expect(clippy::absolute_paths, reason = "Use a specific Result type")] fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { write!( @@ -95,10 +94,6 @@ pub enum AccessTokenScope { #[expect(clippy::absolute_paths, reason = "Specific Trait and Result type")] impl core::fmt::Display for AccessTokenScope { - #[expect( - clippy::min_ident_chars, - reason = "Using the default function parameter name" - )] fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { match *self { Self::AiFeatures => write!(f, "ai_features"), @@ -187,10 +182,6 @@ pub enum PersonalAccessTokenScope { #[expect(clippy::absolute_paths, reason = "Specific Trait and Result type")] impl core::fmt::Display for PersonalAccessTokenScope { - #[expect( - clippy::min_ident_chars, - reason = "Using the default function parameter name" - )] fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { match *self { Self::AdminMode => write!(f, "admin_mode"), diff --git a/src/state_actor.rs b/src/state_actor.rs index f654f1f9..e9a9cf86 100644 --- a/src/state_actor.rs +++ b/src/state_actor.rs @@ -482,47 +482,46 @@ pub async fn gitlab_tokens_actor( // We now wait for some messages loop { - let msg = receiver.recv().await; - if let Some(msg_value) = msg { - match msg_value { - Message::Get { respond_to } => { - debug!("received Message::Get"); - respond_to.send(state.clone()).unwrap_or_else(|_| { - warn!("Failed to send reponse : oneshot channel was closed"); - }); - } - Message::Update => { - // We are going to spawn a async task to get the data from gitlab. - // This task will send us Message::Set with the result to - // update our 'state' variable - debug!("received Message::Update"); - tokio::spawn(get_gitlab_data( - gitlab_connection.clone(), - owned_entities_only, - sender.clone(), - max_concurrent_requests, - skip_users_tokens, - skip_non_expiring_tokens, - )); - } - Message::Set(gitlab_data) => { - debug!("received Message::Set"); - match gitlab_data { - Ok(data) => { - if data.is_empty() { - warn!("No token has been found"); - state = ActorState::NoToken; - } else { - state = ActorState::Loaded(data); - } + let Some(msg) = receiver.recv().await else { + error!("recv failed"); + break; + }; + + match msg { + Message::Get { respond_to } => { + debug!("received Message::Get"); + respond_to.send(state.clone()).unwrap_or_else(|_| { + warn!("Failed to send reponse : oneshot channel was closed"); + }); + } + Message::Update => { + // We are going to spawn a async task to get the data from gitlab. + // This task will send us Message::Set with the result to + // update our 'state' variable + debug!("received Message::Update"); + tokio::spawn(get_gitlab_data( + gitlab_connection.clone(), + owned_entities_only, + sender.clone(), + max_concurrent_requests, + skip_users_tokens, + skip_non_expiring_tokens, + )); + } + Message::Set(gitlab_data) => { + debug!("received Message::Set"); + match gitlab_data { + Ok(data) => { + if data.is_empty() { + warn!("No token has been found"); + state = ActorState::NoToken; + } else { + state = ActorState::Loaded(data); } - Err(err) => state = ActorState::Error(err), } + Err(err) => state = ActorState::Error(err), } } - } else { - error!("recv failed"); - break; } } }