From b26c67c4e7210c73b217d87e23772c610316ee0d Mon Sep 17 00:00:00 2001
From: Kiran Patel <kiranpatel11@gmail.com>
Date: Wed, 19 Oct 2022 02:37:32 +0000
Subject: [PATCH] fix: add MAVEN_DEPENDENCY_CHECK_DISABLED variable

---
 README.md                     | 2 ++
 templates/gitlab-ci-maven.yml | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/README.md b/README.md
index 73635b6..182a245 100644
--- a/README.md
+++ b/README.md
@@ -108,6 +108,8 @@ It is bound to the `test` stage, and uses the following variables:
 | Name                  | description                            | default value     |
 | --------------------- | -------------------------------------- | ----------------- |
 | `MAVEN_DEPENDENCY_CHECK_ARGS` | Maven arguments for Dependency Check job | `org.owasp:dependency-check-maven:check -DretireJsAnalyzerEnabled=false -DassemblyAnalyzerEnabled=false` |
+| `MAVEN_DEPENDENCY_CHECK_DISABLED` | Set to `true` to disable this job | _none_ |
+
 
 A Dependency Check is a quite long operation and therefore the job is configured to be ran __manually__ by default.
 
diff --git a/templates/gitlab-ci-maven.yml b/templates/gitlab-ci-maven.yml
index aca1f4b..db8fa13 100644
--- a/templates/gitlab-ci-maven.yml
+++ b/templates/gitlab-ci-maven.yml
@@ -459,6 +459,9 @@ mvn-dependency-check:
     paths:
       - "${MAVEN_PROJECT_DIR}/**/target/dependency-check-report.*"
   rules:
+    # exclude if disable
+    - if: '$MAVEN_DEPENDENCY_CHECK_DISABLED == "true"'
+      when: never
     # on schedule: auto
     - if: '$CI_PIPELINE_SOURCE == "schedule"'
       allow_failure: true
-- 
GitLab