Skip to content

Commit 34a9f8e

Browse files
authored
1.19.5 (#846)
* start 1.19.5 * deploy 1.19.5-dev-1 * avoid execute_and_poll error when update is already complete or has no id * improve image tagging customization * 1.19.5 release
1 parent 494d01a commit 34a9f8e

File tree

15 files changed

+230
-132
lines changed

15 files changed

+230
-132
lines changed

Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
]
99

1010
[workspace.package]
11-
version = "1.19.4"
11+
version = "1.19.5"
1212
edition = "2024"
1313
authors = ["mbecker20 <[email protected]>"]
1414
license = "GPL-3.0-or-later"

bin/core/src/api/execute/build.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use komodo_client::{
2727
build::{Build, BuildConfig},
2828
builder::{Builder, BuilderConfig},
2929
deployment::DeploymentState,
30-
komodo_timestamp,
30+
komodo_timestamp, optional_string,
3131
permission::PermissionLevel,
3232
repo::Repo,
3333
update::{Log, Update},
@@ -290,12 +290,10 @@ impl Resolve<ExecuteArgs> for RunBuild {
290290
repo,
291291
registry_tokens,
292292
replacers: secret_replacers.into_iter().collect(),
293-
// Push a commit hash tagged image
294-
additional_tags: if update.commit_hash.is_empty() {
295-
Default::default()
296-
} else {
297-
vec![update.commit_hash.clone()]
298-
},
293+
// To push a commit hash tagged image
294+
commit_hash: optional_string(&update.commit_hash),
295+
// Unused for now
296+
additional_tags: Default::default(),
299297
}) => res.context("failed at call to periphery to build"),
300298
_ = cancel.cancelled() => {
301299
info!("build cancelled during build, cleaning up builder");

bin/core/src/api/execute/deployment.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use komodo_client::{
1212
deployment::{
1313
Deployment, DeploymentImage, extract_registry_domain,
1414
},
15-
get_image_names, komodo_timestamp, optional_string,
15+
komodo_timestamp, optional_string,
1616
permission::PermissionLevel,
1717
server::Server,
1818
update::{Log, Update},
@@ -115,7 +115,7 @@ impl Resolve<ExecuteArgs> for Deploy {
115115
let (version, registry_token) = match &deployment.config.image {
116116
DeploymentImage::Build { build_id, version } => {
117117
let build = resource::get::<Build>(build_id).await?;
118-
let image_names = get_image_names(&build);
118+
let image_names = build.get_image_names();
119119
let image_name = image_names
120120
.first()
121121
.context("No image name could be created")
@@ -249,7 +249,7 @@ pub async fn pull_deployment_inner(
249249
let (image, account, token) = match deployment.config.image {
250250
DeploymentImage::Build { build_id, version } => {
251251
let build = resource::get::<Build>(&build_id).await?;
252-
let image_names = get_image_names(&build);
252+
let image_names = build.get_image_names();
253253
let image_name = image_names
254254
.first()
255255
.context("No image name could be created")

bin/periphery/src/api/build.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use interpolate::Interpolator;
1212
use komodo_client::entities::{
1313
EnvironmentVar, all_logs_success,
1414
build::{Build, BuildConfig},
15-
environment_vars_from_str, get_image_names, optional_string,
15+
environment_vars_from_str, optional_string,
1616
to_path_compatible_name,
1717
update::Log,
1818
};
@@ -25,9 +25,7 @@ use resolver_api::Resolve;
2525
use tokio::fs;
2626

2727
use crate::{
28-
build::{
29-
image_tags, parse_build_args, parse_secret_args, write_dockerfile,
30-
},
28+
build::{parse_build_args, parse_secret_args, write_dockerfile},
3129
config::periphery_config,
3230
docker::docker_login,
3331
helpers::{parse_extra_args, parse_labels},
@@ -126,8 +124,9 @@ impl Resolve<super::Args> for build::Build {
126124
mut build,
127125
repo: linked_repo,
128126
registry_tokens,
129-
additional_tags,
130127
mut replacers,
128+
commit_hash,
129+
additional_tags,
131130
} = self;
132131

133132
let mut logs = Vec::new();
@@ -145,8 +144,6 @@ impl Resolve<super::Args> for build::Build {
145144
name,
146145
config:
147146
BuildConfig {
148-
version,
149-
image_tag,
150147
build_path,
151148
dockerfile_path,
152149
build_args,
@@ -265,8 +262,6 @@ impl Resolve<super::Args> for build::Build {
265262

266263
// Get command parts
267264

268-
let image_names = get_image_names(&build);
269-
270265
// Add VERSION to build args (if not already there)
271266
let mut build_args = environment_vars_from_str(build_args)
272267
.context("Invalid build_args")?;
@@ -291,9 +286,9 @@ impl Resolve<super::Args> for build::Build {
291286

292287
let buildx = if *use_buildx { " buildx" } else { "" };
293288

294-
let image_tags =
295-
image_tags(&image_names, image_tag, version, &additional_tags)
296-
.context("Failed to parse image tags into command")?;
289+
let image_tags = build
290+
.get_image_tags_as_arg(commit_hash.as_deref(), &additional_tags)
291+
.context("Failed to parse image tags into command")?;
297292

298293
let maybe_push = if should_push { " --push" } else { "" };
299294

bin/periphery/src/build.rs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
use anyhow::{Context, anyhow};
77
use formatting::format_serror;
88
use komodo_client::{
9-
entities::{EnvironmentVar, Version, update::Log},
9+
entities::{EnvironmentVar, update::Log},
1010
parsers::QUOTE_PATTERN,
1111
};
1212

@@ -52,34 +52,6 @@ pub async fn write_dockerfile(
5252
}
5353
}
5454

55-
pub fn image_tags(
56-
image_names: &[String],
57-
custom_tag: &str,
58-
version: &Version,
59-
additional: &[String],
60-
) -> anyhow::Result<String> {
61-
let Version { major, minor, .. } = version;
62-
let custom_tag = if custom_tag.is_empty() {
63-
String::new()
64-
} else {
65-
format!("-{custom_tag}")
66-
};
67-
68-
let mut res = String::new();
69-
70-
for image_name in image_names {
71-
write!(
72-
&mut res,
73-
" -t {image_name}:latest{custom_tag} -t {image_name}:{version}{custom_tag} -t {image_name}:{major}.{minor}{custom_tag} -t {image_name}:{major}{custom_tag}"
74-
)?;
75-
for tag in additional {
76-
write!(&mut res, " -t {image_name}:{tag}{custom_tag}")?;
77-
}
78-
}
79-
80-
Ok(res)
81-
}
82-
8355
pub fn parse_build_args(build_args: &[EnvironmentVar]) -> String {
8456
build_args
8557
.iter()

0 commit comments

Comments
 (0)