From b713a597c99bc8c1ff5b66642cc41a641dd62ba3 Mon Sep 17 00:00:00 2001
From: Miguel Prada <miguel.prada@tecnalia.com>
Date: Mon, 18 Dec 2023 17:04:56 +0100
Subject: [PATCH] Modify python job logic

Create hidden templates in core and make conditionally make them visible in auto-rules
---
 ci-templates/auto-rules/no-default.yml |  6 ++++--
 ci-templates/python.yml                | 13 +++++--------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml
index 6515130..6171018 100644
--- a/ci-templates/auto-rules/no-default.yml
+++ b/ci-templates/auto-rules/no-default.yml
@@ -49,7 +49,8 @@ industrial_ci_humble:
     - if: $DEFAULT_DISTRO == "humble"
     - if: $BUILD_HUMBLE
 
-.py3_template:
+py3_template:
+  extends: .py3_template
   rules:
     - if: $DEFAULT_DISTRO == "noetic"
       when: always
@@ -61,7 +62,8 @@ industrial_ci_humble:
       when: always
   when: always
 
-.py2_template:
+py2_template:
+  extends: .py2_template
   rules:
     - if: $DEFAULT_DISTRO == "kinetic"
       when: always
diff --git a/ci-templates/python.yml b/ci-templates/python.yml
index e4d00ed..61d476a 100644
--- a/ci-templates/python.yml
+++ b/ci-templates/python.yml
@@ -22,42 +22,39 @@
     - bandit -r . || RET=1
     - safety check || RET=1
     - exit $RET
-  when: always
   allow_failure: true
 
 .py3_template:
   image: python:3-alpine
   variables:
     PYTHON_VERSION: python3
-  when: never
 
 .py2_template:
   image: python:2-alpine
   variables:
     PYTHON_VERSION: python2
-  when: always
 
-py3-flake8:
+.py3-flake8:
   extends:
     - .flake8_template
     - .py3_template
 
-py2-flake8:
+.py2-flake8:
   extends:
     - .flake8_template
     - .py2_template
 
-py3-flake8_extended:
+.py3-flake8_extended:
   extends:
     - .flake8_extended_template
     - .py3_template
 
-py2-flake8_extended:
+.py2-flake8_extended:
   extends:
     - .flake8_extended_template
     - .py2_template
 
-py3-security:
+.py3-security:
   extends:
     - .security_template
     - .py3_template
-- 
GitLab