From 1281b420cf1b9aacad75a0d95e61a262052f83b3 Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Fri, 26 Jan 2024 06:51:00 +0100
Subject: [PATCH] Rules in container scanning

---
 .gitlab-ci.yml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8469e42..76f0072 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -116,6 +116,14 @@ container_scanning:
     CS_SCHEMA_MODEL: 15
     # Used for remediation
     GIT_STRATEGY: fetch
+  # FIXME: because we are using rules with the include, but override here, we also have to have the same rules here
+  rules:
+    - changes:
+        - Dockerfile
+        - .gitlab-ci.yml
+        - src/gitlab-tofu.sh
+    - if: $CI_COMMIT_TAG
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
 
 gitlab-opentofu-image:deploy:with-opentofu-version:
   extends: .opentofu-versions
-- 
GitLab