hercules-ci / hercules-ci-agent

https://hercules-ci.com build and deployment agent
Apache License 2.0
97 stars 19 forks source link

agent service is started successfully but crashes during job when secrets.json is incorrect #511

Open brainrake opened 1 year ago

brainrake commented 1 year ago

Description

Agent service starts successfully but then crashes on job if secrets.json has incorrect layout.

To Reproduce

Example secrets.json:

{ "example": { "condition": ..., "data": "FAIL" } }

Expected behavior

Crash on service startup.

Logs

On job in web ui:

FatalError {fatalErrorMessage = "Could not parse secrets file as configured on agent."} (worker: ExitFailure 1)

Platform / Version

NixOS x86_64-linux, hercules-ci-agent 0.9.11

roberth commented 1 year ago

secrets.json is intentionally a mutable file, so checking it at startup is not a guarantee that it will keep working.

"Strictness" like that is a double-edged sword. It can help find problems early, but it also stops a larger system from working at all. Unless it only affects half a cluster? Is that even realistic?

I would accept a PR, but prefer to solve the root cause, which is the need to write and deploy a local file at all. EDIT: although that needs work to be done on my end.