From 9a8420b8b1c6c1fbc4ac1a288cd7f4afe2c8d7e1 Mon Sep 17 00:00:00 2001
From: Neil-Jocelyn Schark <neil-jocelyn.schark@stud.h-da.de>
Date: Wed, 20 Apr 2022 13:07:12 +0000
Subject: [PATCH] Unify pipeline

See merge request danet/gosdn!289
---
 .gitlab-ci.yml                                | 4 ++++
 .gitlab/ci/.build-container.yml               | 2 --
 .gitlab/ci/.integration-test-containerlab.yml | 8 --------
 .gitlab/ci/.integration-test.yml              | 4 ----
 .gitlab/ci/.security-and-compliance-ci.yml    | 8 --------
 5 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 85103f02b..5b4b6eaeb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,10 @@ variables:
     CEOS_IMAGE: "${CI_PCONTAINERS_REGISTRY_IMAGE}/ceos:4.28.0F"
     GOLANG_VERSION: "1.18"
 
+workflow:
+  rules:
+    - if: $CI_PIPELINE_SOURCE == 'push'
+
 stages:
     - build
     - test
diff --git a/.gitlab/ci/.build-container.yml b/.gitlab/ci/.build-container.yml
index d4122a622..b29f906ea 100644
--- a/.gitlab/ci/.build-container.yml
+++ b/.gitlab/ci/.build-container.yml
@@ -27,8 +27,6 @@ build-testing-image:
 
 build-image:
     rules:
-        - if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
-          when: never
         - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
           variables:
               TAG: $CI_DEFAULT_BRANCH
diff --git a/.gitlab/ci/.integration-test-containerlab.yml b/.gitlab/ci/.integration-test-containerlab.yml
index 8498e1bbf..169ef2217 100644
--- a/.gitlab/ci/.integration-test-containerlab.yml
+++ b/.gitlab/ci/.integration-test-containerlab.yml
@@ -5,10 +5,6 @@ variables:
 
 containerlab-deploy:
     stage: integration-test
-    rules:
-        - if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
-          when: never
-        - when: on_success
     tags:
         - shell-containerlab
     needs: ["build-image", "build-testing-image"]
@@ -43,10 +39,6 @@ containerlab-deploy:
 
 
 containerlab-destroy:
-    rules:
-        - if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
-          when: never
-        - when: always
     stage: integration-test
     tags:
         - shell-containerlab
diff --git a/.gitlab/ci/.integration-test.yml b/.gitlab/ci/.integration-test.yml
index 2f6ee1b73..ae7525b17 100644
--- a/.gitlab/ci/.integration-test.yml
+++ b/.gitlab/ci/.integration-test.yml
@@ -1,10 +1,6 @@
 .integration-test: &integration-test
     image: $GOSDN_TESTING_IMAGE
     stage: integration-test
-    rules:
-        - if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
-          when: never
-        - when: on_success
     needs:
         ["containerlab-deploy"]
     variables:
diff --git a/.gitlab/ci/.security-and-compliance-ci.yml b/.gitlab/ci/.security-and-compliance-ci.yml
index 97b3cf69a..adede9dbd 100644
--- a/.gitlab/ci/.security-and-compliance-ci.yml
+++ b/.gitlab/ci/.security-and-compliance-ci.yml
@@ -1,9 +1,5 @@
 .rules: &rules
     stage: analyze
-    rules:
-        - if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
-          when: never
-        - when: always
     needs: []
 
 sast:
@@ -36,10 +32,6 @@ semgrep-sast:
 
 container_scanning:
     stage: analyze
-    rules:
-        - if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
-          when: never
-        - when: always
     variables:
         DOCKER_IMAGE: "${GOSDN_IMAGE}"
         DOCKER_USER: "${CI_REGISTRY_USER}"
-- 
GitLab