From a3862b075b46356b41db5fec3a473a47c3a99cd7 Mon Sep 17 00:00:00 2001
From: "Benguria Elguezabal, Gorka" <gorka.benguria@tecnalia.com>
Date: Wed, 15 May 2024 17:12:33 +0200
Subject: [PATCH] adds tags to the used jobs

---
 templates/gitlab-ci-python.yml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/templates/gitlab-ci-python.yml b/templates/gitlab-ci-python.yml
index 0491472..8acc487 100644
--- a/templates/gitlab-ci-python.yml
+++ b/templates/gitlab-ci-python.yml
@@ -175,6 +175,23 @@ spec:
     mypy-files:
       description: Files or directories to analyse
       default: ''
+    py-package-job-tags:
+      description: tags to filter applicable runners for py-package job
+      type: array
+      default: []
+    py-pytest-job-tags:
+      description: tags to filter applicable runners for py-pytest job
+      type: array
+      default: []
+    py-ruff-job-tags:
+      description: tags to filter applicable runners for py-ruff job
+      type: array
+      default: []
+    py-release-job-tags:
+      description: tags to filter applicable runners for py-release job
+      type: array
+      default: []
+
 ---
 # default workflow rules: Merge Request pipelines
 workflow:
@@ -860,6 +877,7 @@ py-package:
     expire_in: 1 day
   rules:
     - if: '$PYTHON_PACKAGE_ENABLED == "true"'
+  tags: $[[ inputs.py-package-job-tags ]]
 
 py-lint:
   extends: .python-base
@@ -954,6 +972,7 @@ py-ruff:
     - if: '$RUFF_ENABLED != "true"'
       when: never
     - !reference [.test-policy, rules]
+  tags: $[[ inputs.py-ruff-job-tags ]]
 
 py-mypy:
   extends: .python-base
@@ -1044,6 +1063,7 @@ py-pytest:
     - if: '$PYTEST_ENABLED != "true"'
       when: never
     - !reference [.test-policy, rules]
+  tags: $[[ inputs.py-pytest-job-tags ]]
 
 py-nosetests:
   extends: .python-base
@@ -1231,6 +1251,7 @@ py-release:
     - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF || $CI_COMMIT_REF_NAME =~ $INTEG_REF'
       when: manual
       allow_failure: true
+  tags: $[[ inputs.py-release-job-tags ]]
 
 # (auto from release tag): publishes the Python package(s) to a PyPi registry
 py-publish:
-- 
GitLab