Skip to content

Retrieve GitLab predefined variables from environment when posting quality gate results

Current situation

If the opentf-ctl get qualitygate command is used in a GitLab MR pipeline and the user wants to post the quality gate results to the related MR, he must explicitly pass the GitLab server, project ID and MR IID values in the command options. In order to do that, he uses three GitLab predefined environment variables, which, in fact, could be retrieved directly from the execution environment.

Desired outcome

If get qualitygate command contains a --plugin gitlab:... parameter, but no server, project and/or MR IID definition, we have to try to retrieve a respective environment variable values in order to post the results.