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

Ability to ignore specific files/folders/symlinks #1425

Open
Algomorph opened this issue Nov 12, 2024 · 2 comments
Open

Ability to ignore specific files/folders/symlinks #1425

Algomorph opened this issue Nov 12, 2024 · 2 comments
Labels
elaborate Further elaboration is needed

Comments

@Algomorph
Copy link

Algomorph commented Nov 12, 2024

Is your feature request related to a problem? Please describe.

Yes. Part of the project I'm working on is using Bazel, and hence Bazel IDE plugin(s), which -- only on the developer's machine -- tend to write symlinks inside the repository's directory on disk. These link to system files that gitlab-ci-local doesn't have the permissions to read, which is a very common situation if the Bazel build is referencing system files/folders.

That is, when I run gitlab-ci-local --list I'm seeing:

Error: EACCES: permission denied, scandir '/home/greg/Builds/physiology/edge/bazel-edge/external/linux_opencv/share/mblinux'
    at Object.readdirSync (node:fs:1507:26)
    at Object.readdirSync (pkg/prelude/bootstrap.js:1306:35)
    at readdirWithFileTypes (/snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.scandir/out/providers/sync.js:16:33)
    at Object.Bq (/snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.scandir/out/providers/sync.js:10:16)
    at Sp.Kq (/snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.scandir/out/index.js:18:17)
    at Sp._handleDirectory (/snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.walk/out/readers/sync.js:28:34)
    at Sp._handleQueue (/snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.walk/out/readers/sync.js:23:18)
    at Sp.read (/snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.walk/out/readers/sync.js:15:14)
    at kp.read (/snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.walk/out/providers/sync.js:11:29)
    at rd.wD (/snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.walk/out/index.js:20:21)

Describe the solution you'd like
Either an --exclude-from-scan CLI argument, an EXCLUDE_FROM_SCAN variable that can be set in .gitlab-ci-local/.env (or the like), or (better) both, which allows to exclude files from the nodelib/fs.walk scan (e.g. by using deepFilter and the like). Disclaimer: I'm don't have the expertise w/ gitlab-ci-local internals to say how exactly the argument/variable should be named.

Describe alternatives you've considered
I'm currently wrapping gitlab-ci-local with the following script (that temporarily removes the IDE-generated symlink edge/bazel-edge):

#!/bin/bash

# Read the target of the symlink and store it in a file
link_target=$(readlink edge/bazel-edge)
echo "$link_target" > .edge-link-target

# Remove the symlink
rm edge/bazel-edge

# Run gitlab-ci-local with the original arguments
gitlab-ci-local "$@"

# Restore the symlink regardless of the exit status
ln -s "$link_target" edge/bazel-edge

# Remove the temporary file
rm .edge-link-target
@ANGkeith
Copy link
Collaborator

ANGkeith commented Jan 12, 2025

Not a Bazel user... can't really replicate it..

could you provide a minimal way to replicating the issue ?

@ANGkeith ANGkeith added the elaborate Further elaboration is needed label Jan 12, 2025
@Algomorph
Copy link
Author

@ANGkeith thanks for looking into this. I've been trying real hard for about an hour now to replicate the link / directory structure to make a simple project fail, but so far I've failed to do so. The monorepo we're experiencing this on is way-too-large and way-too-proprietary for me to be able to share anything from there, but perhaps you have some insights about which cases /snapshot/firecow-gitlab-ci-local/node_modules/@nodelib/fs.walk/out/index.js:20:21 from the trace above would be run?

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

No branches or pull requests

2 participants