This helps reproduce the behavior mentioned in oxsecurity/megalinter#2744 which is not backwards compatible with V6.
Setting up a test image locally:
docker pull artifacts.open.ch/public-docker-virtual/oxsecurity/megalinter-ci_light:v7
docker run -it \
--entrypoint bash \
-v $PWD:/test \
artifacts.open.ch/public-docker-virtual/oxsecurity/megalinter-ci_light:v7
Both shell scripts team1/test.sh
and team2/test.sh
have an issue detected by shellcheck. However only team 1 is included using the relative repo path: ^(team1/)
The expected lint output is: 1 issue found in team1/test.sh
.
Reproducing the changes in the image:
# Create a setup with 2 team folders each with a script (GIST wont allow folders)
mkdir -p /src/team1 /src/team2
pushd /src
git init
cp /test/test.sh /src/team1
cp /test/test.sh /src/team2
cp /test/mega-linter.yaml /src/
popd
# Current V7 behavior: all paths are absolute relative regex do not work:
DEFAULT_WORKSPACE="/src" MEGALINTER_CONFIG="/src/mega-linter.yaml" /entrypoint.sh
# Include change:
git apply /test/relativepath.patch
# With change to pass relative paths to the linters (which themselves should handle both relative and workspace/abs paths when filtering)
DEFAULT_WORKSPACE="/src" MEGALINTER_CONFIG="/src/mega-linter.yaml" /entrypoint.sh