diff --git a/bob/devtools/data/gitlab-ci/docs.yaml b/bob/devtools/data/gitlab-ci/docs.yaml
index 4e8af61e1572733f347353e0d97ff9a76cf35a17..ade9700e623f307e98be92bd7206eac425aedcff 100644
--- a/bob/devtools/data/gitlab-ci/docs.yaml
+++ b/bob/devtools/data/gitlab-ci/docs.yaml
@@ -29,8 +29,8 @@ stages:
     - python3 bootstrap.py -vv channel base
     - source ${CONDA_ROOT}/etc/profile.d/conda.sh
     - conda activate base
-    - if [[ "${CI_RUNNER_TAGS}" =~ bob.*docker\|docker.*bob ]]; then git config --global --add safe.directory ${CI_PROJECT_DIR}; fi
     - conda clean --all
+    - git config --global --add safe.directory ${CI_PROJECT_DIR}
   cache:
     paths:
       - .cache/torch
diff --git a/bob/devtools/data/gitlab-ci/nightlies.yaml b/bob/devtools/data/gitlab-ci/nightlies.yaml
index 162b0d838d54c2f5ebe2b5b18cc8098ffcd160d8..49681f2f53f58b5f372413613f1cdc27785eeb3f 100644
--- a/bob/devtools/data/gitlab-ci/nightlies.yaml
+++ b/bob/devtools/data/gitlab-ci/nightlies.yaml
@@ -21,7 +21,6 @@ stages:
     - curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
     - python3 bootstrap.py -vv channel base
     - source ${CONDA_ROOT}/etc/profile.d/conda.sh
-    - if [[ "${CI_RUNNER_TAGS}" =~ bob.*docker\|docker.*bob ]]; then git config --global --add safe.directory ${CI_PROJECT_DIR}; fi
     - conda activate base
     - conda clean --all
   cache:
@@ -48,6 +47,19 @@ stages:
   variables:
     # The version of cuda at Idiap
     CONDA_OVERRIDE_CUDA: "11.6"
+  before_script:
+    - !reference [.bootstrap, before_script]
+    - git config --global --add safe.directory ${CI_PROJECT_DIR}
+    - bdt ci check -vv
+
+.build_macos_template:
+  extends: .build_template
+  tags:
+    - bob
+    - macos
+  before_script:
+    - !reference [.bootstrap, before_script]
+    - bdt ci check -vv
 
 build_linux_39:
   extends: .build_linux_template
@@ -64,50 +76,45 @@ build_linux_310:
     key: 'build-py310'
 
 build_macos_intel_39:
-  extends: .build_template
+  extends: .build_macos_template
   variables:
     PYTHON_VERSION: "3.9"
   tags:
-    - bob
-    - macos
+    - !reference [.build_macos_template, tags]
     - intel
   cache:
     key: 'build-py39'
 
 build_macos_intel_310:
-  extends: .build_template
+  extends: .build_macos_template
   variables:
     PYTHON_VERSION: "3.10"
   tags:
-    - bob
-    - macos
+    - !reference [.build_macos_template, tags]
     - intel
   cache:
     key: 'build-py310'
 
 build_macos_arm_39:
-  extends: .build_template
+  extends: .build_macos_template
   variables:
     PYTHON_VERSION: "3.9"
   tags:
-    - bob
-    - macos
+    - !reference [.build_macos_template, tags]
     - arm
   cache:
     key: 'build-py39'
 
 build_macos_arm_310:
-  extends: .build_template
+  extends: .build_macos_template
   variables:
     PYTHON_VERSION: "3.10"
   tags:
-    - bob
-    - macos
+    - !reference [.build_macos_template, tags]
     - arm
   cache:
     key: 'build-py310'
 
-
 # Periodic cleanup of beta packages
 .cleanup_template:
   extends: .bootstrap
diff --git a/bob/devtools/data/gitlab-ci/noarch.yaml b/bob/devtools/data/gitlab-ci/noarch.yaml
index a20e6975948106893e59efa509cea157555b12ca..3edaa22ff6e123fee2279bdeb0cf42b47c0b5ed6 100644
--- a/bob/devtools/data/gitlab-ci/noarch.yaml
+++ b/bob/devtools/data/gitlab-ci/noarch.yaml
@@ -23,10 +23,7 @@ stages:
     - curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
     - python3 bootstrap.py -vv channel base
     - source ${CONDA_ROOT}/etc/profile.d/conda.sh
-    # for conda inspect during builds (on macos)
-    - if [[ "${CI_RUNNER_TAGS}" =~ bob.*docker\|docker.*bob ]]; then git config --global --add safe.directory ${CI_PROJECT_DIR}; fi
     - conda activate base
-    - bdt ci check -vv
     - conda clean --all
   cache:
     paths:
@@ -59,6 +56,10 @@ build_linux:
   variables:
     PYTHON_VERSION: "3.10"
     BUILD_EGG: "true"
+  before_script:
+    - !reference [.bootstrap, before_script]
+    - git config --global --add safe.directory ${CI_PROJECT_DIR}
+    - bdt ci check -vv
   script:
     - bdt ci build -vv
     - bdt ci readme -vv dist/*.zip
@@ -83,6 +84,9 @@ build_macos_intel:
     - bob
     - macos
     - intel
+  before_script:
+    - !reference [.bootstrap, before_script]
+    - bdt ci check -vv
 
 
 build_macos_arm:
@@ -95,6 +99,9 @@ build_macos_arm:
     - bob
     - macos
     - arm
+  before_script:
+    - !reference [.bootstrap, before_script]
+    - bdt ci check -vv
 
 
 # Test targets (not normally used)
diff --git a/bob/devtools/data/gitlab-ci/python-package.yaml b/bob/devtools/data/gitlab-ci/python-package.yaml
index b0edd1b235392d7ff83b98b6c24abf9c80b95b54..4fba94e2f9eaac1f7725f71c04fe2411b1ff1855 100644
--- a/bob/devtools/data/gitlab-ci/python-package.yaml
+++ b/bob/devtools/data/gitlab-ci/python-package.yaml
@@ -26,7 +26,7 @@ build:
     - docker
   stage: build
   before_script:
-    - if [[ "${CI_RUNNER_TAGS}" =~ bob.*docker\|docker.*bob ]]; then git config --global --add safe.directory ${CI_PROJECT_DIR}; fi
+    - git config --global --add safe.directory ${CI_PROJECT_DIR}
     - pip install twine pre-commit sphinx sphinx-rtd-theme
   script:
     - "[ -r .pre-commit-config.yaml ] && pre-commit run --all-files --show-diff-on-failure --verbose"
diff --git a/bob/devtools/data/gitlab-ci/single-package.yaml b/bob/devtools/data/gitlab-ci/single-package.yaml
index 329977c0239bba1c1f0ee6987e31f1058206ec2e..d05d1bb2167489415d501d01a42d880b6eb7a5fe 100644
--- a/bob/devtools/data/gitlab-ci/single-package.yaml
+++ b/bob/devtools/data/gitlab-ci/single-package.yaml
@@ -23,8 +23,8 @@ stages:
     - curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
     - python3 bootstrap.py -vv channel base
     - source ${CONDA_ROOT}/etc/profile.d/conda.sh
-    # for conda inspect during builds (on macos)
     - conda activate base
+    - conda clean --all
   cache:
     paths:
       - miniconda.sh