From 0e26288dd6b27ce3e4b92ab5c21e6a73d1152902 Mon Sep 17 00:00:00 2001
From: Pierre Smeyers <pierre.smeyers@gmail.com>
Date: Fri, 6 Dec 2024 08:52:12 +0100
Subject: [PATCH] fix: semgrep subdir

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

diff --git a/templates/gitlab-ci-golang.yml b/templates/gitlab-ci-golang.yml
index 14b9045..0ea3a0a 100644
--- a/templates/gitlab-ci-golang.yml
+++ b/templates/gitlab-ci-golang.yml
@@ -735,14 +735,13 @@ go-semgrep:
   stage: test
   before_script:
     - *go-scripts
-    - cd $GO_PROJECT_DIR
-    - mkdir -p -m 777 reports
+    - mkdir -p -m 777 ${GO_PROJECT_DIR}/reports
     - setup_semgrep_rules
   script:
     - >-
-      semgrep ci ${TRACE+--verbose} ${GO_SEMGREP_ARGS}
-      --gitlab-sast-output=reports/golang-semgrep.gitlab.json
-      ${DEFECTDOJO_SEMGREP_REPORTS:+--json-output=reports/golang-semgrep.native.json}
+      semgrep ci ${TRACE+--verbose} ${GO_SEMGREP_ARGS} --subdir ${GO_PROJECT_DIR}
+      --gitlab-sast-output=${GO_PROJECT_DIR}/reports/golang-semgrep.gitlab.json
+      ${DEFECTDOJO_SEMGREP_REPORTS:+--json-output=${GO_PROJECT_DIR}/reports/golang-semgrep.native.json}
   artifacts:
     name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $ĈI_COMMIT_REF_SLUG"
     when: "always"
-- 
GitLab