Skip to content

Add MR labels when the qualitygate results are sent to the GitLab

Current situation

The qualitygate results may now be sent to the respective GitLab merge request as note. It will be interesting to label these MR to allow for better filtering.

Desired outcome

The gitlab plugin has the possibility to label related merge request depending on the quality gate result.

A new get qualitygate ... --plugin option is created : gitlab:label={prefix}. If specified, the related merge request will be labeled:

  • {prefix}::Passed (if the quality gate result is SUCCESS),
  • {prefix}::Failed (if it is FAILURE), or
  • {prefix}::No test (if there are no test within the quality gate scope).

It other terms, the following command:

opentf-ctl get qualitygate {workflow_id} -m {mode} {mandatory --plugin gitlab:... options} --plugin gitlab:label=QualityGate

will produce the following result if the quality gate returns FAILURE:

image

When gitlab:plugin=default is specified, the label prefix defaults to QualityGate.

If the {prefix}::Passed/Failed/No test labels exist at the project level, this labels will be used. Otherwise, new label(s) will be created.

Edited by Maria Einman