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

Root bundle folders in Docker break folder ignore paths #1415

Closed
nevumx opened this issue Feb 18, 2025 · 0 comments · Fixed by #1418
Closed

Root bundle folders in Docker break folder ignore paths #1415

nevumx opened this issue Feb 18, 2025 · 0 comments · Fixed by #1418
Labels
bug Something isn't working

Comments

@nevumx
Copy link

nevumx commented Feb 18, 2025

Mounting a bundle folder on the root of a regal docker container breaks ignore paths that are folder-wide.

For example, running regal in docker like:

docker run \
    --rm \
    --mount "type=bind,src=${PWD}/policies,dst=/policies,readonly" \
    --mount "type=bind,src=${PWD}/.regal,dst=/.regal,readonly" \
    ghcr.io/styrainc/regal:latest \
    lint \
    /policies

Will not allow folder rules like:

rules:
  performance:
    non-loop-expression:
      ignore:
        files:
          - polices/role/*

but will allow file rules like:

rules:
  performance:
    non-loop-expression:
      ignore:
        files:
          - some_file.rego

A workaround is to use a nonroot folder like:

docker run \
    --rm \
    --mount "type=bind,src=${PWD}/policies,dst=/home/nonroot/policies,readonly" \
    --mount "type=bind,src=${PWD}/.regal,dst=/home/nonroot/.regal,readonly" \
    ghcr.io/styrainc/regal:latest \
    lint \
    /home/nonroot/policies
@anderseknert anderseknert added the bug Something isn't working label Feb 19, 2025
charlieegan3 added a commit to charlieegan3/regal that referenced this issue Feb 24, 2025
When the root is also the root of the filesystem, the linter will  now
handle ignore patterns correctly.

Fixes StyraInc#1415

Signed-off-by: Charlie Egan <[email protected]>
charlieegan3 added a commit to charlieegan3/regal that referenced this issue Feb 24, 2025
When the root is also the root of the filesystem, the linter will  now
handle ignore patterns correctly.

Fixes StyraInc#1415

Signed-off-by: Charlie Egan <[email protected]>
charlieegan3 added a commit to charlieegan3/regal that referenced this issue Feb 24, 2025
When the root is also the root of the filesystem, the linter will  now
handle ignore patterns correctly.

Fixes StyraInc#1415

Signed-off-by: Charlie Egan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants