Skip to content

New 'configuration' sub-command with 'valiate' sub-command

Pavlo Strokov requested to merge ps-gitaly-valiate-configuration into master

In order to improve developers experience in using Gitaly the new 'configuration' sub-command is added. It has 'validate' sub-command and the purpose of it to validate provided configuration before starting the service. The output lists all the problems of the configuration in JSON format into STDOUT. The structure of object includes 'key' which is a path to the field where the problem detected and the 'message' with an explanation of the problem.

Part of: #4650 (closed)

Example of output:

  • empty configuration, almost all validation errors are reported
{
  "errors": [
    {
      "message": "none of \"socket_path\", \"listen_addr\" or \"tls_listen_addr\" is set"
    },
    {
      "key": [
        "bin_dir"
      ],
      "message": "blank or empty"
    },
    {
      "key": [
        "storage"
      ],
      "message": "not set"
    },
    {
      "key": [
        "ruby",
        "dir"
      ],
      "message": "not set"
    },
    {
      "key": [
        "gitlab",
        "url"
      ],
      "message": "blank or empty"
    },
    {
      "key": [
        "gitlab",
        "secret_file"
      ],
      "message": "doesn't exist: \".gitlab_shell_secret\""
    },
    {
      "key": [
        "gitlab-shell",
        "dir"
      ],
      "message": "blank or empty"
    }
  ]
}
  • bad toml file format (some = value without quotes):
{
  "errors": [
    {
      "message": "line 1 column 8: toml: incomplete number"
    }
  ]
}
  • bad value for the specific field ([pack_objects_limiting]\nmax_queue_wait = 'invalid')
{
  "errors": [
    {
      "message": "line 2 column 18: toml: time: invalid duration \"invalid\""
    }
  ]
}
Edited by Pavlo Strokov

Merge request reports