Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: failure in GitLab with "Error: fatal: Invalid revision range" #4103

Open
1 of 4 tasks
abitrolly opened this issue Jul 25, 2024 · 4 comments
Open
1 of 4 tasks

bug: failure in GitLab with "Error: fatal: Invalid revision range" #4103

abitrolly opened this issue Jul 25, 2024 · 4 comments

Comments

@abitrolly
Copy link
Contributor

abitrolly commented Jul 25, 2024

Steps to Reproduce

I am not sure if it is dup of #885 or not, but I've got this failure here https://gitlab.com/gitlab-community/modelops/applied-ml/code-suggestions/ai-assist/-/jobs/7430104908

$ npm install --save-dev @commitlint/config-conventional @commitlint/cli
added 125 packages in 9s
28 packages are looking for funding
  run `npm fund` for details
$ echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
$ npx commitlint --from="$CI_MERGE_REQUEST_DIFF_BASE_SHA" --help-url 'https://www.conventionalcommits.org/en'
file:///builds/gitlab-community/modelops/applied-ml/code-suggestions/ai-assist/node_modules/@commitlint/cli/lib/cli.js:127
        throw err;
        ^
Error: fatal: Invalid revision range 6e97dc894774a3d16b9d6abf5bf762ee240abd08..HEAD
    at Transform.transform [as _transform] (/builds/gitlab-community/modelops/applied-ml/code-suggestions/ai-assist/node_modules/git-raw-commits/index.js:100:36)
    at Transform._write (node:internal/streams/transform:171:8)
    at writeOrBuffer (node:internal/streams/writable:570:12)
    at _write (node:internal/streams/writable:499:10)
    at Writable.write (node:internal/streams/writable:508:10)
    at Socket.ondata (node:internal/streams/readable:1007:22)
    at Socket.emit (node:events:532:35)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
Node.js v22.5.1


The commit from "Invalid revision range" is here https://gitlab.com/gitlab-community/modelops/applied-ml/code-suggestions/ai-assist/-/commit/6e97dc894774a3d16b9d6abf5bf762ee240abd08 and it precedes the MR, so I am not sure what this error is about.

Current Behavior

No response

Expected Behavior

Expected actionable error message.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Context

No response

commitlint --version

i don't know

git --version

i don't know

node --version

v22.5.1

@abitrolly abitrolly added the bug label Jul 25, 2024
@abitrolly
Copy link
Contributor Author

Okay. #885 (comment) pinpoints the problem.

The default git depth in GitLab pipelines is 20 (https://docs.gitlab.com/ee/ci/pipelines/settings.html#limit-the-number-of-changes-fetched-during-clone).

And there are exactly 20 commits in my MR.
image

So the solution to my problem is to remove git depth limitation in the lint job (https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/merge_requests/1143).

  variables:
    GIT_DEPTH: 0

The proper fix on commitlint side is to detect this condition, and show user the fix. On GitLab side - to ensure that MR default clone depth always includes parent commit.

@escapedcat
Copy link
Member

Might be already good to add a comment to the docs first

@abitrolly
Copy link
Contributor Author

@escapedcat #4105

escapedcat pushed a commit that referenced this issue Jul 26, 2024
* docs: remove GitLab clone depth limitation

See #4103

* docs: remove stage config from GitLab

Let's keep the example minimal.
@abitrolly
Copy link
Contributor Author

Opened an issue in GitLab for long term fix https://gitlab.com/gitlab-org/gitlab/-/issues/474701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants