From 8ac460c05668590b7713f05fc571fc7b3fe2f4b4 Mon Sep 17 00:00:00 2001
From: Clement Bois <clement.bois@orange.com>
Date: Thu, 5 Dec 2024 16:04:48 +0000
Subject: [PATCH] fix: semgrep subdir

---
 templates/gitlab-ci-node.yml | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/templates/gitlab-ci-node.yml b/templates/gitlab-ci-node.yml
index 434d470..ebb279a 100644
--- a/templates/gitlab-ci-node.yml
+++ b/templates/gitlab-ci-node.yml
@@ -787,14 +787,13 @@ node-semgrep:
   stage: test
   before_script:
     - *node-scripts
-    - cd $NODE_PROJECT_DIR
-    - mkdir -p -m 777 reports
+    - mkdir -p -m 777 ${NODE_PROJECT_DIR}/reports
     - setup_semgrep_rules
   script:
     - >- 
-      semgrep ci ${TRACE+--verbose} ${NODE_SEMGREP_ARGS}
-      --gitlab-sast-output=reports/node-semgrep.gitlab.json
-      ${DEFECTDOJO_SEMGREP_REPORTS:+--json-output=reports/node-semgrep.native.json}
+      semgrep ci ${TRACE+--verbose} ${NODE_SEMGREP_ARGS} --subdir ${NODE_PROJECT_DIR}
+      --gitlab-sast-output=${NODE_PROJECT_DIR}/reports/node-semgrep.gitlab.json
+      ${DEFECTDOJO_SEMGREP_REPORTS:+--json-output=${NODE_PROJECT_DIR}/reports/node-semgrep.native.json}
   artifacts:
     name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
     when: always
-- 
GitLab