mdubourg001 / glci

🦊 Test your Gitlab CI Pipelines changes locally using Docker.
568 stars 17 forks source link

Local includes without / does not work #2

Closed frwickst closed 3 years ago

frwickst commented 3 years ago

Example:

If I have a .gitlab-ci.yml file that starts with

include:
  - local: '.gitlab-ci-base-template.yml'

and that file is in the same folder as .gitlab-ci.yml, then glci tries to fetch it from the incorrect path. It seems like it expects the import to start with /.

This will lead to the following issue:

(node:70849) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '<redacted...>/<folder_with_gitlab-ci.yml>.gitlab-ci-base-template.yml'
    at Object.openSync (fs.js:476:3)
    at Object.readFileSync (fs.js:377:35)
    at main (<redacted...>/.config/yarn/global/node_modules/glci/dist/cli.min.js:206:44)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:70849) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:70849) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Say that I'm in /test and I want to import .base.yml then it will try to include /tests.base.yml.