From 7bb5c67cb6208ea83ee86d695920c5c2a0cedd7a Mon Sep 17 00:00:00 2001
From: Christian Winter <c.winter@kit.edu>
Date: Mon, 30 Oct 2023 12:10:30 +0000
Subject: [PATCH] set the dependencies right

---
 .gitlab-ci.yml       | 52 +++++++++++++++++++++++++++++---------------
 tp_herwig/Dockerfile |  2 --
 2 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 13d2b95..9507b8b 100755
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,53 +8,69 @@ variables:
 .common_build:
   image: docker:latest
   stage: 🏗️ build_and_push
-  rules:
-    - changes: 
-      - $IMAGE_NAME/Dockerfile
-      - basis/*
   before_script:
     - docker login -u "$DOCKER_HUB_USER" -p $DOCKER_TOKEN
   script:
       - docker build -t "$DOCKER_HUB_USER/etp_$IMAGE_NAME" $IMAGE_NAME --no-cache;
       - docker push "$DOCKER_HUB_USER/etp_$IMAGE_NAME";
 
-.extend_build_image:
-  extends:
-    - .common_build
-  needs:  # if the build_and_push step basis has to be done, then make the other build_and_push steps dependend of it
-    - job: basis
-      optional: true # only run if basis is added to the pipeline (depends on the rules).
-
 basis:
   variables:
     IMAGE_NAME: "basis"
   extends:
     - .common_build
+  rules: # only execute if Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
 
 tp:
   variables:
     IMAGE_NAME: "tp"
   extends:
-    - .extend_build_image
+    - .common_build
+  needs:  # if the build_and_push step basis has to be done, then make the other build_and_push steps dependend of it
+    - job: basis
+      optional: true # only run if basis is added to the pipeline (depends on the rules).
+  rules: # only execute if Dockerfile or basis/Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
+      - basis/*
 
 python311:
   variables:
     IMAGE_NAME: "python311"
   extends:
-    - .extend_build_image
-
+    - .common_build
+  rules: # only execute if Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
+      
 basis_jupytermachine:
   variables:
     IMAGE_NAME: "basis_jupytermachine"
   extends:
-    - .extend_build_image
-
+    - .common_build
+  needs:  # if the build_and_push step basis has to be done, then make the other build_and_push steps dependend of it
+    - job: basis
+      optional: true # only run if basis is added to the pipeline (depends on the rules).
+  rules: # only execute if Dockerfile or basis/Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
+      - basis/*
+      
 tp_herwig:
   variables:
     IMAGE_NAME: "tp_herwig"
   extends:
-    - .extend_build_image
-
+    - .common_build
+  needs:  # if the build_and_push step basis has to be done, then make the other build_and_push steps dependend of it
+    - job: tp
+      optional: true # only run if basis is added to the pipeline (depends on the rules).
+  rules: # only execute if Dockerfile or tp/Dockerfile was changed
+    - changes: 
+      - $IMAGE_NAME/Dockerfile
+      - tp/*
+      
 create_jupytermachine_version:
   stage: create_jupytermachine_version
   image: docker:latest
diff --git a/tp_herwig/Dockerfile b/tp_herwig/Dockerfile
index 5e34ea7..fca31f7 100644
--- a/tp_herwig/Dockerfile
+++ b/tp_herwig/Dockerfile
@@ -2,8 +2,6 @@ FROM jeppelt/etp_tp:latest
 
 USER root
 
-RUN python3 -m pip install bash_kernel
-
 RUN mkdir /herwig
 ENV INSTALL_LOC=/herwig
 
-- 
GitLab