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

Gitlab Support #65

Open
btd1337 opened this issue Aug 7, 2024 · 1 comment
Open

Gitlab Support #65

btd1337 opened this issue Aug 7, 2024 · 1 comment

Comments

@btd1337
Copy link

btd1337 commented Aug 7, 2024

Is it possible to add GitLab CI support?

@waynethompson
Copy link

waynethompson commented Dec 18, 2024

I would also like to see this.

Using eslint 8 I have added plugin plugin:diff/ci to .eslintrc.js.

I have tried to add to my .gitlab-ci.yml file

variables:
    ESLINT_PLUGIN_DIFF_COMMIT: $CI_COMMIT_SHA

But the pipeline fails with the error

Error: Failed to load plugin 'diff' declared in '.eslintrc.js': Command failed: git diff --diff-algorithm=histogram --diff-filter=ACM --find-renames=100% --name-only --no-ext-diff --relative origin/4a7f61a60b7832978759985188381440647524b4 --
fatal: bad revision 'origin/4a7f61a60b7832978759985188381440647524b4'
Referenced from: /builds/project/.eslintrc.js
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:891:11)
    at Object.execFileSync (node:child_process:927:15)
    at getDiffFileList (/builds/project/node_modules/eslint-plugin-diff/dist/git.js:63:10)
    at getProcessors (/builds/project/node_modules/eslint-plugin-diff/dist/processors.js:84:52)
    at Object.<anonymous> (/builds/project/node_modules/eslint-plugin-diff/dist/processors.js:91:43)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)

It would seem that if we can find the correct predefined variables and replace $CI_COMMIT_SHA with the correct variable it should work.

https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

Also tried this variable but it did not work:
CI_MERGE_REQUEST_DIFF_BASE_SHA - The base SHA of the merge request diff.

When I used $CI_COMMIT_SHORT_SHA I get the error:

Error: Failed to load plugin 'diff' declared in '.eslintrc.js': Command failed: git fetch --quiet origin a8efa4b3
fatal: couldn't find remote ref a8efa4b3

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

No branches or pull requests

2 participants