Setting report name does not work if stage extends "remote" template.
Hey there! First of all thanks for your gitlab report helper lib's!
When i tested this i encountered an issue when the stage documented in the gitlab-ci of a repo extends a template definition from a remote source:
so, lets say we have a remote-ci-template-repo somewhere containing a baz.yml
with this content:
# audits dependencies
.yarn_audit:
extends:
- .foo
- .bar
image: $NODE_IMAGE_VERSION
allow_failure: true
script:
- npx gitlab-yarn-audit
artifacts:
expire_in: 2 days
reports:
dependency_scanning: gl-dependency-scanning.json
And the project repo has this in it's gitlab-ci file
include:
- project: remote-ci-template-repo
file: baz.yml
dependency scanning:
extends:
- .yarn_audit
the current logic throws:
/cache/.npm/_npx/43bb380c67467683/node_modules/gitlab-artifact-report/gitlab-artifact-report.js:26
throw new Error(`${msg}, but no value was found.`);
^
Error: Expected dependency scanning.artifacts.reports.dependency_scanning to be one exact path, but no value was found.
Since it only tries to read the key from the .gitlab-ci
of the repository the pipeline is run in it does not know *.artifacts.reports.dependency_scanning
.
This could be made more flexible if you would add an env var as another option to provide the file name like you kind of did in the other report based plugins (e.g ESLINT_CODE_QUALITY_REPORT
-> YARN_AUDIT_REPORT
).
Currently the only workaround is to define the artifacts
prop in the gitlab-ci of the repo that runs the pipeline.
Just an observation in case anyone else runs into this issue.