hydra: use BindsTo= and auto-restart for hydra-init to fix services stuck on dependency failure#1080
Open
Senthil455 wants to merge 2 commits into
Open
hydra: use BindsTo= and auto-restart for hydra-init to fix services stuck on dependency failure#1080Senthil455 wants to merge 2 commits into
Senthil455 wants to merge 2 commits into
Conversation
…n MDM bootstrap The activate-user script is deprecated in nix-darwin and will be removed in 25.11. The deprecation warning advises using darwin-rebuild activate instead, which handles both user and system activation. This change: - Adds mdm-bootstrap.sh, a proper bootstrap script for MDM-provisioned Mac builders that uses darwin-rebuild activate instead of the legacy activate-user + activate sequence - Updates the macs/README.md with MDM bootstrap documentation Fixes NixOS#1043
…tuck on dependency failure hydra-server, hydra-evaluator, and hydra-queue-runner have Requires=hydra-init.service, but hydra-init itself lacks Restart= (defaults to 'no'). If hydra-init fails transiently (e.g. database not ready), the dependent services also fail with 'Dependency failed' and never recover because: 1. hydra-init has no auto-restart, so it stays permanently failed 2. Even if hydra-init were retried and succeeded, the dependent services' start jobs already failed and would not be re-triggered Fix by: - Adding Restart=on-failure + RestartSec=5s to hydra-init so transient failures are retried automatically - Changing requires to bindsTo on dependent services so they are automatically restarted when hydra-init recovers Applies to both production (build/hydra.nix) and staging (non-critical-infra/hosts/staging-hydra/hydra.nix). Fixes NixOS#367
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #367 - Hydra services never restart after
hydra-init.servicefails.Problem
When
hydra-init.servicefails transiently (e.g. database not yet ready),hydra-server,hydra-evaluator, andhydra-queue-runnerall fail withDependency failedbecause they haveRequires=hydra-init.service. The services never recover because:hydra-inithas no auto-restart: It isType=oneshotwithRemainAfterExit=truebut noRestart=setting, so it defaults toRestart=no. Once it fails, it stays permanently in failed state.hydra-initwere retried and eventually succeeded, the dependent services' start jobs already failed. WithRequires=, systemd does not automatically restart dependents when the dependency recovers.Solution
1. Auto-restart
hydra-initon failureThis ensures transient failures (database not ready, network hiccup) are retried automatically.
2. Use
BindsTo=instead ofRequires=BindsTo=creates a stronger lifecycle binding: whenhydra-inittransitions from failed to active (after a successful retry), systemd automatically restarts the bound services. The upstream module'sRequires=stays in place (harmless,BindsTois a superset).Files Changed
build/hydra.nix(production): AddedserviceConfig.RestartandRestartSectohydra-init; addedbindsTotohydra-server,hydra-evaluator, andhydra-queue-runnernon-critical-infra/hosts/staging-hydra/hydra.nix(staging): Same changes forhydra-init,hydra-server, andhydra-evaluator(staging uses the separatehydra-queue-runner-devservice from the Rust queue-runner module, which does not haveRequires=hydra-init.service)