From 9a13ef415d77d733cf06f5ff7ab759418910270e Mon Sep 17 00:00:00 2001
From: Dorian Turba <froggit.commit.z3jqj@simplelogin.com>
Date: Mon, 17 Jul 2023 17:59:50 +0200
Subject: [PATCH] update black to work with optional dep

---
 .gitlab-ci.yml                                | 1 -
 templates/python/code_quality/black/black.yml | 9 +++------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ed1bc02..8956968 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,7 +32,6 @@ black:
     stage: templates
     variables:
         PROJECT_PATH: "tests/black_project"
-        PYTHON_SETUP: "pip install ${PROJECT_PATH} black"
     only:
         changes:
             - .gitlab-ci.yml
diff --git a/templates/python/code_quality/black/black.yml b/templates/python/code_quality/black/black.yml
index ef0a05e..a49b10c 100644
--- a/templates/python/code_quality/black/black.yml
+++ b/templates/python/code_quality/black/black.yml
@@ -2,14 +2,11 @@ black:
     image: python:${IMAGE_TAG}
     stage: code_quality
     variables:
-        IMAGE_TAG: "latest"
+        IMAGE_TAG: !reference [.python_install, variables, IMAGE_TAG]
         PROJECT_PATH: "."
-        PYTHON_SETUP: "pip install ${PROJECT_PATH}[CODE_QUALITY]"
+        PYTHON_SETUP: "pip install ${PROJECT_PATH}[QUALITY]"
     script:
-        - python --version  # Debug
-        - python -m venv venv --upgrade-deps || python -m venv venv  # upgrade-deps is not supported before 3.9
-        - source venv/bin/activate
-        - ${PYTHON_SETUP}
+        - !reference [.python_install, script]
         - black ${PROJECT_PATH} --check --diff --quiet
     only:
         changes:
-- 
GitLab