Skip to content

Commit 8c8c3ac

Browse files
committed
rename app_version_label to app_version_label_value
1 parent e38c0b8 commit 8c8c3ac

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

crates/stackable-operator/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
88

99
- BREAKING: Fix bug where `ResolvedProductImage::app_version_label` could not be used as a label value because it can contain invalid characters.
1010
This is the case when referencing custom images via a `@sha256:...` hash. As such, the `product_image_selection::resolve` function is now fallible.
11+
The `ResolvedProductImage` field `app_version_label` was renamed to `app_version_label_value` to match its type ([#1076]).
1112

1213
[#1076]: https://github.com/stackabletech/operator-rs/pull/1076
1314

crates/stackable-operator/src/commons/product_image_selection.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub struct ResolvedProductImage {
7777
pub product_version: String,
7878

7979
/// App version formatted for Labels
80-
pub app_version_label: LabelValue,
80+
pub app_version_label_value: LabelValue,
8181

8282
/// Image to be used for the product image e.g. `oci.stackable.tech/sdp/superset:1.4.1-stackable2.1.0`
8383
pub image: String,
@@ -126,11 +126,11 @@ impl ProductImage {
126126
let image_tag_or_hash = image.tag.or(image.hash).unwrap_or("latest".to_string());
127127

128128
let app_version = format!("{}-{}", product_version, image_tag_or_hash);
129-
let app_version_label = Self::prepare_app_version_label(&app_version)?;
129+
let app_version_label_value = Self::prepare_app_version_label_value(&app_version)?;
130130

131131
Ok(ResolvedProductImage {
132132
product_version,
133-
app_version_label,
133+
app_version_label_value,
134134
image: image_selection.custom.clone(),
135135
image_pull_policy,
136136
pull_secrets,
@@ -161,10 +161,10 @@ impl ProductImage {
161161
"{repo}/{image_base_name}:{product_version}-stackable{stackable_version}",
162162
);
163163
let app_version = format!("{product_version}-stackable{stackable_version}");
164-
let app_version_label = Self::prepare_app_version_label(&app_version)?;
164+
let app_version_label_value = Self::prepare_app_version_label_value(&app_version)?;
165165
Ok(ResolvedProductImage {
166166
product_version,
167-
app_version_label,
167+
app_version_label_value,
168168
image,
169169
image_pull_policy,
170170
pull_secrets,
@@ -189,7 +189,7 @@ impl ProductImage {
189189
}
190190
}
191191

192-
fn prepare_app_version_label(app_version: &str) -> Result<LabelValue, Error> {
192+
fn prepare_app_version_label_value(app_version: &str) -> Result<LabelValue, Error> {
193193
let mut formatted_app_version = app_version.to_string();
194194
// Labels cannot have more than `LABEL_VALUE_MAX_LEN` characters.
195195
formatted_app_version.truncate(LABEL_VALUE_MAX_LEN);
@@ -220,7 +220,7 @@ mod tests {
220220
"#,
221221
ResolvedProductImage {
222222
image: "oci.stackable.tech/sdp/superset:1.4.1-stackable23.7.42".to_string(),
223-
app_version_label: "1.4.1-stackable23.7.42".parse().expect("static app version label is always valid"),
223+
app_version_label_value: "1.4.1-stackable23.7.42".parse().expect("static app version label is always valid"),
224224
product_version: "1.4.1".to_string(),
225225
image_pull_policy: "Always".to_string(),
226226
pull_secrets: None,
@@ -234,7 +234,7 @@ mod tests {
234234
"#,
235235
ResolvedProductImage {
236236
image: "oci.stackable.tech/sdp/superset:1.4.1-stackable0.0.0-dev".to_string(),
237-
app_version_label: "1.4.1-stackable0.0.0-dev".parse().expect("static app version label is always valid"),
237+
app_version_label_value: "1.4.1-stackable0.0.0-dev".parse().expect("static app version label is always valid"),
238238
product_version: "1.4.1".to_string(),
239239
image_pull_policy: "Always".to_string(),
240240
pull_secrets: None,
@@ -248,7 +248,7 @@ mod tests {
248248
"#,
249249
ResolvedProductImage {
250250
image: "oci.stackable.tech/sdp/superset:1.4.1-stackable0.0.0-dev".to_string(),
251-
app_version_label: "1.4.1-stackable0.0.0-dev".parse().expect("static app version label is always valid"),
251+
app_version_label_value: "1.4.1-stackable0.0.0-dev".parse().expect("static app version label is always valid"),
252252
product_version: "1.4.1".to_string(),
253253
image_pull_policy: "Always".to_string(),
254254
pull_secrets: None,
@@ -263,7 +263,7 @@ mod tests {
263263
"#,
264264
ResolvedProductImage {
265265
image: "oci.stackable.tech/sdp/superset:1.4.1-stackable2.1.0".to_string(),
266-
app_version_label: "1.4.1-stackable2.1.0".parse().expect("static app version label is always valid"),
266+
app_version_label_value: "1.4.1-stackable2.1.0".parse().expect("static app version label is always valid"),
267267
product_version: "1.4.1".to_string(),
268268
image_pull_policy: "Always".to_string(),
269269
pull_secrets: None,
@@ -279,7 +279,7 @@ mod tests {
279279
"#,
280280
ResolvedProductImage {
281281
image: "my.corp/myteam/stackable/trino:1.4.1-stackable2.1.0".to_string(),
282-
app_version_label: "1.4.1-stackable2.1.0".parse().expect("static app version label is always valid"),
282+
app_version_label_value: "1.4.1-stackable2.1.0".parse().expect("static app version label is always valid"),
283283
product_version: "1.4.1".to_string(),
284284
image_pull_policy: "Always".to_string(),
285285
pull_secrets: None,
@@ -294,7 +294,7 @@ mod tests {
294294
"#,
295295
ResolvedProductImage {
296296
image: "my.corp/myteam/stackable/superset".to_string(),
297-
app_version_label: "1.4.1-latest".parse().expect("static app version label is always valid"),
297+
app_version_label_value: "1.4.1-latest".parse().expect("static app version label is always valid"),
298298
product_version: "1.4.1".to_string(),
299299
image_pull_policy: "Always".to_string(),
300300
pull_secrets: None,
@@ -309,7 +309,7 @@ mod tests {
309309
"#,
310310
ResolvedProductImage {
311311
image: "my.corp/myteam/stackable/superset:latest-and-greatest".to_string(),
312-
app_version_label: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
312+
app_version_label_value: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
313313
product_version: "1.4.1".to_string(),
314314
image_pull_policy: "Always".to_string(),
315315
pull_secrets: None,
@@ -324,7 +324,7 @@ mod tests {
324324
"#,
325325
ResolvedProductImage {
326326
image: "127.0.0.1:8080/myteam/stackable/superset".to_string(),
327-
app_version_label: "1.4.1-latest".parse().expect("static app version label is always valid"),
327+
app_version_label_value: "1.4.1-latest".parse().expect("static app version label is always valid"),
328328
product_version: "1.4.1".to_string(),
329329
image_pull_policy: "Always".to_string(),
330330
pull_secrets: None,
@@ -339,7 +339,7 @@ mod tests {
339339
"#,
340340
ResolvedProductImage {
341341
image: "127.0.0.1:8080/myteam/stackable/superset:latest-and-greatest".to_string(),
342-
app_version_label: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
342+
app_version_label_value: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
343343
product_version: "1.4.1".to_string(),
344344
image_pull_policy: "Always".to_string(),
345345
pull_secrets: None,
@@ -354,7 +354,7 @@ mod tests {
354354
"#,
355355
ResolvedProductImage {
356356
image: "oci.stackable.tech/sdp/superset@sha256:85fa483aa99b9997ce476b86893ad5ed81fb7fd2db602977eb8c42f76efc1098".to_string(),
357-
app_version_label: "1.4.1-sha256-85fa483aa99b9997ce476b86893ad5ed81fb7fd2db602977eb".parse().expect("static app version label is always valid"),
357+
app_version_label_value: "1.4.1-sha256-85fa483aa99b9997ce476b86893ad5ed81fb7fd2db602977eb".parse().expect("static app version label is always valid"),
358358
product_version: "1.4.1".to_string(),
359359
image_pull_policy: "Always".to_string(),
360360
pull_secrets: None,
@@ -370,7 +370,7 @@ mod tests {
370370
"#,
371371
ResolvedProductImage {
372372
image: "my.corp/myteam/stackable/superset:latest-and-greatest".to_string(),
373-
app_version_label: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
373+
app_version_label_value: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
374374
product_version: "1.4.1".to_string(),
375375
image_pull_policy: "Always".to_string(),
376376
pull_secrets: None,
@@ -386,7 +386,7 @@ mod tests {
386386
"#,
387387
ResolvedProductImage {
388388
image: "my.corp/myteam/stackable/superset:latest-and-greatest".to_string(),
389-
app_version_label: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
389+
app_version_label_value: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
390390
product_version: "1.4.1".to_string(),
391391
image_pull_policy: "IfNotPresent".to_string(),
392392
pull_secrets: None,
@@ -402,7 +402,7 @@ mod tests {
402402
"#,
403403
ResolvedProductImage {
404404
image: "my.corp/myteam/stackable/superset:latest-and-greatest".to_string(),
405-
app_version_label: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
405+
app_version_label_value: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
406406
product_version: "1.4.1".to_string(),
407407
image_pull_policy: "Always".to_string(),
408408
pull_secrets: None,
@@ -418,7 +418,7 @@ mod tests {
418418
"#,
419419
ResolvedProductImage {
420420
image: "my.corp/myteam/stackable/superset:latest-and-greatest".to_string(),
421-
app_version_label: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
421+
app_version_label_value: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
422422
product_version: "1.4.1".to_string(),
423423
image_pull_policy: "Never".to_string(),
424424
pull_secrets: None,
@@ -437,7 +437,7 @@ mod tests {
437437
"#,
438438
ResolvedProductImage {
439439
image: "my.corp/myteam/stackable/superset:latest-and-greatest".to_string(),
440-
app_version_label: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
440+
app_version_label_value: "1.4.1-latest-and-greatest".parse().expect("static app version label is always valid"),
441441
product_version: "1.4.1".to_string(),
442442
image_pull_policy: "Always".to_string(),
443443
pull_secrets: Some(vec![LocalObjectReference{name: "myPullSecrets1".to_string()}, LocalObjectReference{name: "myPullSecrets2".to_string()}]),

crates/stackable-operator/src/crd/git_sync/v1alpha1_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ mod tests {
374374

375375
let resolved_product_image = ResolvedProductImage {
376376
image: "oci.stackable.tech/sdp/product:latest".to_string(),
377-
app_version_label: "1.0.0-latest"
377+
app_version_label_value: "1.0.0-latest"
378378
.parse()
379379
.expect("static app version label is always valid"),
380380
product_version: "1.0.0".to_string(),
@@ -441,7 +441,7 @@ mod tests {
441441

442442
let resolved_product_image = ResolvedProductImage {
443443
image: "oci.stackable.tech/sdp/product:latest".to_string(),
444-
app_version_label: "1.0.0-latest"
444+
app_version_label_value: "1.0.0-latest"
445445
.parse()
446446
.expect("static app version label is always valid"),
447447
product_version: "1.0.0".to_string(),

crates/stackable-operator/src/product_logging/framework.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ sinks:
13821382
///
13831383
/// # let resolved_product_image = ResolvedProductImage {
13841384
/// # product_version: "1.0.0".into(),
1385-
/// # app_version_label: "1.0.0".parse().expect("static app version label is always valid"),
1385+
/// # app_version_label_value: "1.0.0".parse().expect("static app version label is always valid"),
13861386
/// # image: "oci.stackable.tech/sdp/my-product:1.0.0-stackable1.0.0".into(),
13871387
/// # image_pull_policy: "Always".into(),
13881388
/// # pull_secrets: None,

0 commit comments

Comments
 (0)