Skip to content

Commit 7fe1c31

Browse files
authored
Merge pull request #1684 from NixOS/token-paths
feat: support passing multiple token files to queue-runner
2 parents 723093b + 5335230 commit 7fe1c31

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

nixos-modules/queue-runner-module.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ in
121121
type = lib.types.ints.positive;
122122
default = 5;
123123
};
124-
tokenListPath = lib.mkOption {
125-
description = "Path to a list of allowed authentication tokens.";
124+
tokenPaths = lib.mkOption {
125+
description = "List of paths of allowed authentication tokens.";
126126
type = lib.types.nullOr (lib.types.listOf lib.types.path);
127127
default = null;
128128
};

subprojects/hydra-queue-runner/src/config.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ struct AppConfig {
249249
#[serde(default = "default_concurrent_upload_limit")]
250250
concurrent_upload_limit: usize,
251251

252-
token_list_path: Option<std::path::PathBuf>,
252+
token_paths: Option<Vec<std::path::PathBuf>>,
253253

254254
#[serde(default = "default_enable_fod_checker")]
255255
enable_fod_checker: bool,
@@ -323,10 +323,17 @@ impl TryFrom<AppConfig> for PreparedApp {
323323
let hydra_log_dir = val.hydra_data_dir.join("build-logs");
324324
let lockfile = val.hydra_data_dir.join("queue-runner/lock");
325325

326-
let token_list = val.token_list_path.and_then(|p| {
327-
fs_err::read_to_string(p)
328-
.map(|s| s.lines().map(|t| t.trim().to_string()).collect())
329-
.ok()
326+
let token_list = val.token_paths.and_then(|l| {
327+
l.iter()
328+
.map(|p| {
329+
fs_err::read_to_string(p)
330+
.map(|s| s.trim().to_string())
331+
.inspect_err(|e| {
332+
tracing::warn!("Failed to load token file, skipping file. Err={e}");
333+
})
334+
.ok()
335+
})
336+
.collect()
330337
});
331338

332339
Ok(Self {

0 commit comments

Comments
 (0)