Skip to content

Assertion Error in bash completion when local include glob is empty #1867

Description

@galyfray

Minimal .gitlab-ci.yml illustrating the issue

---
include:
  - local: '.gitlab/ci/templates/**.gitlab-ci.yml'

Expected behavior
No crash

Host information
Fedora WSL2
NodeJs 22.22.0
gitlab-ci-local 4.72.0

Additional context

    triggerUncaughtException(err, true /* fromPromise */);
    ^

AssertionError [ERR_ASSERTION]: Local include file cannot be found .gitlab/ci/templates/**.gitlab-ci.yml
    at new AssertionError (node:internal/assert/assertion_error:376:5)
    at F6.init (file:///usr/local/lib/node_modules/gitlab-ci-local/dist/index.js:255:7367)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Z0.init (file:///usr/local/lib/node_modules/gitlab-ci-local/dist/index.js:261:2396)
    at async Z0.create (file:///usr/local/lib/node_modules/gitlab-ci-local/dist/index.js:261:1197) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: undefined,
  operator: undefined,
  diff: 'simple'
}

Node.js v22.22.0
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

AssertionError [ERR_ASSERTION]: Local include file cannot be found .gitlab/ci/templates/**.gitlab-ci.yml
    at new AssertionError (node:internal/assert/assertion_error:376:5)
    at F6.init (file:///usr/local/lib/node_modules/gitlab-ci-local/dist/index.js:255:7367)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Z0.init (file:///usr/local/lib/node_modules/gitlab-ci-local/dist/index.js:261:2396)
    at async Z0.create (file:///usr/local/lib/node_modules/gitlab-ci-local/dist/index.js:261:1197) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: undefined,
  operator: undefined,
  diff: 'simple'
}

Node.js v22.22.0

Gitlab does not seems to care when an include glob turns out to be empty, I use this feature for my template of .gitlab-ci.yml.
I would undstand a linting output to raise this as a potential issue, but a crash in the completion is quite unexpected :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions