Missing test results in Merge Requests using "latest" Terraform template
Summary
When using the "latest" Terraform template, only the kics-iac-sast job results are appearing in Merge Requests. The other job results are running
in a duplicate pipeline, and their failures (if any) do not show up in the Merge Request status.
Steps to reproduce
- Create a Terraform project in GitLab.com or self-hosted GitLab 15.3. Configure pipelines using the "latest" Terraform template:
include: - template: Terraform.latest.gitlab-ci.yml variables: # If not using GitLab's HTTP backend, remove this line and specify TF_HTTP_* variables TF_STATE_NAME: default TF_CACHE_KEY: default - Open an MR with any change (including an empty commit).
- Inspect the pipeline linked from the MR. It will only show the results for the
kics-iac-sastjob.
Example Project
This MR demonstrates the duplicate pipelines: morgan_delagrange/terraform-pipeline-bug!1
What is the current bug behavior?
The MR only shows the status of the kics-iac-sast job.
What is the expected correct behavior?
The MR shows the status of the kics-iac-sast, fmt, validate and build jobs.
Relevant logs and/or screenshots
Output of checks
This bugs happens on GitLab.com or self-hosted GitLab 15.3.
Results of GitLab environment info
N/A
Results of GitLab application Check
N/A
Possible fixes
This is the change that causes the bug: !94429 (merged). The change to
the rules for the kics-iac-sast job is causing duplicate pipelines for the "latest" Terraform template.
Possible fixes:
- Revert the above change
- Update jobs in the "latest" Terraform pipeline to run in MRs rather than in the branch
- Update the Terraform pipeline documentation (https://docs.gitlab.com/ee/user/infrastructure/iac/)
to add workflow rules that prevent duplicate pipelines. Something like this should work:
However, this option is not ideal, because it will require manual updates to pipelines for GitLab users.
workflow: rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS when: never - if: $CI_COMMIT_BRANCH
