hydra-queue-runner: Get store mode configuration from hydra.conf
[?]
Feb 22, 2016, 4:23 PM
V2UCCYN3B6266BDKGSXQDRSW4HKY673GINM3VI3MORXZ7OYDJBXACDependencies
- [2]
GJV2J5HXPool local store connections - [3]
K5G5GZY7Guard against concurrent invocations of hydra-queue-runner - [4]
SOB276BAKeep some statistics for the binary cache stores - [*]
24BMQDZAStart of single-process hydra-queue-runner - [*]
5AIYUMTBBasic remote building - [*]
HJOEIMLRRefactor - [*]
OG3Z3QGCNamespace cleanup
Change contents
- edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 25
/* Read hydra.conf. */auto hydraConfigFile = getEnv("HYDRA_CONFIG");if (pathExists(hydraConfigFile)) {for (auto line : tokenizeString<Strings>(readFile(hydraConfigFile), "\n")) {line = trim(string(line, 0, line.find('#')));auto eq = line.find('=');if (eq == std::string::npos) continue;auto key = trim(std::string(line, 0, eq));auto value = trim(std::string(line, eq + 1));if (key == "") continue; - edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 41
hydraConfig[key] = value;}} - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 749
#if 0auto store = make_ref<LocalBinaryCacheStore>(getLocalStore(),"/home/eelco/Misc/Keys/test.nixos.org/secret","/home/eelco/Misc/Keys/test.nixos.org/public","/tmp/binary-cache");#endifauto storeMode = hydraConfig["store_mode"]; - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 751[3.4620]→[3.4620:4675](∅→∅),[3.4675]→[2.715:866](∅→∅),[2.866]→[3.4853:4896](∅→∅),[3.4853]→[3.4853:4896](∅→∅)
auto store = std::make_shared<S3BinaryCacheStore>([this]() { return this->getLocalStore(); },"/home/eelco/hydra/secret","/home/eelco/hydra/public","nix-test-cache");store->init();_destStore = store;if (storeMode == "direct" || storeMode == "") {_destStore = openStore();}else if (storeMode == "local-binary-cache") {auto dir = hydraConfig["binary_cache_dir"];if (dir == "")throw Error("you must set ‘binary_cache_dir’ in hydra.conf");auto store = make_ref<LocalBinaryCacheStore>([this]() { return this->getLocalStore(); },"/home/eelco/Misc/Keys/test.nixos.org/secret","/home/eelco/Misc/Keys/test.nixos.org/public",dir);store->init();_destStore = std::shared_ptr<LocalBinaryCacheStore>(store);}else if (storeMode == "s3-binary-cache") {auto bucketName = hydraConfig["binary_cache_s3_bucket"];if (bucketName == "")throw Error("you must set ‘binary_cache_s3_bucket’ in hydra.conf");auto store = make_ref<S3BinaryCacheStore>([this]() { return this->getLocalStore(); },hydraConfig["binary_cache_secret_key_file"],hydraConfig["binary_cache_public_key_file"],bucketName);store->init();_destStore = std::shared_ptr<S3BinaryCacheStore>(store);} - edit in src/hydra-queue-runner/state.hh at line 264[9.437][8.4416]
std::map<std::string, std::string> hydraConfig;