Skip to content

Commit 66f8019

Browse files
committed
fix(install): set image to latest if version is missing
1 parent af836cf commit 66f8019

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

justfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ extract-from-digests:
7979
rm /tmp/bins/kty
8080

8181
set-version:
82-
git grep -l "{{ version_placeholder }}" | grep -v "justfile" | xargs -I {} sed -i'.tmp' -e 's/{{ version_placeholder }}/{{ version }}/g' {}
82+
git grep -l "{{ version_placeholder }}" | \
83+
grep -v "justfile" | \
84+
grep -v ".rs" | \
85+
xargs -I {} sed -i'.tmp' -e 's/{{ version_placeholder }}/{{ version }}/g' {}
8386

8487
helm-build:
8588
helm package helm --dependency-update --destination /tmp/chart

src/cli/resources.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ use serde::Serialize;
1010
use super::namespace;
1111
use crate::resources::{install, DynamicClient, GetGvk, MANAGER};
1212

13-
const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
13+
lazy_static::lazy_static! {
14+
static ref VERSION: &'static str = option_env!("CARGO_PKG_VERSION")
15+
.map(|v| if v.contains("0.0.0-UNSTABLE") { "latest" } else { v })
16+
.unwrap_or("latest");
17+
}
1418

1519
#[derive(Parser, Container)]
1620
pub struct Resources {
@@ -91,7 +95,7 @@ pub struct Install {
9195
#[arg(from_global)]
9296
namespace: Option<String>,
9397

94-
#[arg(long, default_value_t = format!("ghcr.io/grampelberg/kty:{}", VERSION.unwrap_or("latest")))]
98+
#[arg(long, default_value_t = format!("ghcr.io/grampelberg/kty:{}", VERSION.to_string()))]
9599
image: String,
96100
}
97101

0 commit comments

Comments
 (0)