Skip to content

Commit 685e016

Browse files
loispostulafslabs-bot[bot]
authored andcommitted
fix(publish): decouple Docker secret passing from USER_AGENT requirement
The cargo registry secrets (TOKEN, NAME) were only passed to Docker builds when both USER_AGENT and TOKEN were present. Sparse registries (like FSL) don't set USER_AGENT, causing the entire secret block to be skipped and Docker builds to fail with missing /run/secrets/.
1 parent 1cf9aaf commit 685e016

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
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
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
66
name = "cargo-fslabscli"
77
publish = ["fsl"]
88
repository = "https://github.com/fslabs/fslabsci"
9-
version = "2.41.0"
9+
version = "2.41.1"
1010

1111
[package.metadata.fslabs.publish.binary]
1212
name = "FSLABS Cli tool"

src/commands/publish/mod.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,25 +1150,26 @@ async fn do_publish_package(params: DoPublishParams) -> PublishResult {
11501150
));
11511151
}
11521152

1153-
if let (Ok(user_agent), Ok(token)) = (
1154-
env::var(format!("{main_registry_prefix}_USER_AGENT")),
1155-
env::var(format!("{main_registry_prefix}_TOKEN")),
1156-
) {
1157-
let user_agent_env = format!("{main_registry_prefix}_USER_AGENT");
1153+
if let Ok(token) = env::var(format!("{main_registry_prefix}_TOKEN")) {
11581154
let token_env = format!("{main_registry_prefix}_TOKEN");
11591155
let name_env = format!("{main_registry_prefix}_NAME");
1160-
envs.insert(user_agent_env.clone(), user_agent);
11611156
envs.insert(token_env.clone(), token);
11621157
envs.insert(name_env.clone(), common_options.cargo_main_registry.clone());
1163-
args.push(format!(
1164-
"--secret id=cargo_private_registry_user_agent,env={user_agent_env}"
1165-
));
11661158
args.push(format!(
11671159
"--secret id=cargo_private_registry_token,env={token_env}"
11681160
));
11691161
args.push(format!(
11701162
"--secret id=cargo_private_registry_name,env={name_env}"
11711163
));
1164+
1165+
// USER_AGENT is only set for git-based registries, not sparse ones (e.g. FSL)
1166+
if let Ok(user_agent) = env::var(format!("{main_registry_prefix}_USER_AGENT")) {
1167+
let user_agent_env = format!("{main_registry_prefix}_USER_AGENT");
1168+
envs.insert(user_agent_env.clone(), user_agent);
1169+
args.push(format!(
1170+
"--secret id=cargo_private_registry_user_agent,env={user_agent_env}"
1171+
));
1172+
}
11721173
}
11731174
args.push(context.clone());
11741175
// First we build

0 commit comments

Comments
 (0)