From f5d6d50fa3bbba1edb61e905a9ccff3cbe264d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFs=20Postula?= Date: Thu, 4 Jul 2024 17:51:31 +0200 Subject: [PATCH] feat: for nightly binaries check version based on date --- Cargo.lock | 3 ++- Cargo.toml | 3 ++- src/commands/check_workspace/binary.rs | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4ddeed..5bd82e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -247,12 +247,13 @@ dependencies = [ [[package]] name = "cargo-fslabscli" -version = "1.5.1" +version = "1.6.0" dependencies = [ "anyhow", "assert_fs", "base64 0.21.7", "cargo_metadata", + "chrono", "clap", "console", "convert_case", diff --git a/Cargo.toml b/Cargo.toml index 464b7a9..2ad9f18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-fslabscli" -version = "1.5.1" +version = "1.6.0" edition = "2021" authors = ["FSLABS DevOps Gods"] repository = "https://github.com/ForesightMiningSoftwareCorporation/fslabsci" @@ -41,6 +41,7 @@ ignore = "0.4.22" object_store = { version = "0.9.1", features = ["azure"]} toml = "0.8.12" convert_case = "0.6.0" +chrono = "0.4" [dev-dependencies] assert_fs = "1.1.1" testcontainers = "0.15" diff --git a/src/commands/check_workspace/binary.rs b/src/commands/check_workspace/binary.rs index 6bd5b61..01d80a8 100644 --- a/src/commands/check_workspace/binary.rs +++ b/src/commands/check_workspace/binary.rs @@ -1,3 +1,4 @@ +use chrono::prelude::*; use indexmap::IndexMap; use object_store::{ azure::{MicrosoftAzure, MicrosoftAzureBuilder}, @@ -99,9 +100,21 @@ impl PackageMetadataFslabsCiPublishBinary { let Some(object_store) = store else { return Ok(()); }; + // Nightly version should be current date + + let rc_version = match release_channel.as_ref() { + "nightly" => { + if name.ends_with("_launcher") { + version.clone() + } else { + Utc::now().date_naive().to_string() + } + } + _ => version.clone(), + }; log::debug!( "BINARY: checking if version {} of {} already exists {:?}", - version, + rc_version, name, self ); @@ -113,7 +126,7 @@ impl PackageMetadataFslabsCiPublishBinary { }; let blob_path = Path::from(format!( "{}/{}/{}-{}-{}-v{}{}", - name, release_channel, name, target, toolchain, version, extension + name, release_channel, name, target, toolchain, rc_version, extension )); match object_store.get_client().head(&blob_path).await { Ok(_) => {}