James E. Blair c4c13b1ff4 Provide config error information for dependency cycles
When a dependency cycle causes a config error and reports, we omit information
about the error itself since the same message is used for all changes in the
cycle, and it may be confusing to leave a config error message on a change that
is not directly responsible for the error.

However, this leaves something to be desired in that the user must then
closely examine each change, or look for line comments, to determine the source
of the error.

To improve this, we will now generate the reporting message with the actual
change that is being reported in mind.  This will allow us to leave an extended
message on the change that directly caused the error, and an abbreviated one on
the other changes in the cycle.

To further help users get to the right change, we will also annotate the list
of changes in the cycle to indicate which ones have config errors.

The result will look something like this for a change in a cycle
without a config error (this report has no file comments):

    This change is part of a dependency cycle that failed.

    Related changes:
      - http://localhost:55777/1
      - http://localhost:55777/2 (config error)

And like this for the other change with the error (this report
would have file comments if any were generated, but not in the
 case of this specific error):

    Zuul encountered a syntax error while parsing its
    configuration in the repo org/project1 on branch master.  The
    problem was:

      Configuration item has more than one key.  Each zuul.yaml
      configuration file must be a list of dictionaries with a
      single key, for example:

      - job:
          name: foo

      - project:
          name: bar

      Ensure that every item in the list is a dictionary with only
      one key (in this example, 'job' and 'project').  This error
      may be caused by insufficient indentation of the keys under
      the configuration item ('name' in this example).

      The incorrect values are around:

      foo: null
      project: null

    Related changes:
      - http://localhost:55777/1
      - http://localhost:55777/2 (config error)

Change-Id: Ib1804786406dd841533cc3fab31af37ec3449b69
2024-10-14 15:55:19 -07:00
..