Fail build on missing ssh key
L
Luke Blaney
Currently, an attempt to add a non-existent ssh key won't fail. Usually this results in the build failing much later on which that key is used, and often happens in a way that's hard to debug. I'd like the "Installing additional ssh keys" step to fail if one or more of the specified fingerprints are not found.Worked ExampleAdd the following code to your config:steps: - add_ssh_keys: fingerprints: - "b7:35:a6:4e:9b:0d:6d:d4:78:1e:9a:97:2a:66:6b:be"But do not add the corresponding key to the project settings.Current behaviour✅Installing additional ssh keysThere are no configured ssh keys to installAnd then the job proceeds on to the next step.Desired behaviour❗Installing additional ssh keysThe key "b7:35:a6:4e:9b:0d:6d:d4:78:1e:9a:97:2a:66:6b:be" was not found in the project settingsAnd then the job fails at that point.Backwards CompatibilityI'm aware that this change wouldn't be backwards compatible. I'd be happy for an additional key to be introduced to enable the new behaviour, for example:steps: - add_ssh_keys: fingerprints: - "b7:35:a6:4e:9b:0d:6d:d4:78:1e:9a:97:2a:66:6b:be" fail-if-missing: true
CCI-I-1517