Best-effort config validation
What does this MR do?
This MR adds a mechanism for simple config validation based on JSON schema. Validation is best-effort and failures are only printed as a warning to help find configuration mistakes.
Why was this MR needed?
Many common configuration mistakes are not obvious. It can take hours to find a simple typo.
E.g. an empty runner URL will show this error repeatedly:
ERROR: Checking for jobs... error runner=LMPaaTzF status=only http or https scheme supported
With this change the user will also see this:
WARNING: There might be a problem with your config
jsonschema: '/runners/0/url' does not validate with https://gitlab.com/gitlab-org/gitlab-runner/common/config#/$ref/properties/runners/items/$ref/properties/url/minLength: length must be >= 1, but got 0
Or if they use an invalid shell, it will give them a list of valid ones:
jsonschema: '/runners/0/shell' does not validate with https://gitlab.com/gitlab-org/gitlab-runner/common/config#/$ref/properties/runners/items/$ref/properties/shell/enum: value must be one of "bash", "sh", "cmd", "pwsh", "powershell", ""
What's the best way to test this MR?
Run it with an invalid config!