diff --git a/templates/build-debian-package.yml b/templates/build-debian-package.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2J1aWxkLWRlYmlhbi1wYWNrYWdlLnltbA==..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2J1aWxkLWRlYmlhbi1wYWNrYWdlLnltbA== 100644
--- a/templates/build-debian-package.yml
+++ b/templates/build-debian-package.yml
@@ -1,6 +1,8 @@
 ---
+include: 'templates/template.yml'
+
 variables:
   PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}"
 
 
 build-debian:
@@ -2,8 +4,9 @@
 variables:
   PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}"
 
 
 build-debian:
+  extends: .retry
   stage: build-debian-package
   image: logilab/infra/dockerfiles/buildpackage
   tags:
@@ -22,6 +25,7 @@
       - repo
 
 upload-deb-to-heptapod:
+  extends: .retry
   stage: upload-deb-to-heptapod
   image: curlimages/curl:latest
   tags:
diff --git a/templates/build-docker-image.yml b/templates/build-docker-image.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2J1aWxkLWRvY2tlci1pbWFnZS55bWw=..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2J1aWxkLWRvY2tlci1pbWFnZS55bWw= 100644
--- a/templates/build-docker-image.yml
+++ b/templates/build-docker-image.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 image_build:
@@ -2,4 +4,5 @@
 image_build:
+  extends: .retry
   stage: release
   image:
     name: gcr.io/kaniko-project/executor:debug
@@ -17,6 +20,7 @@
     - if: '$CI_COMMIT_REF_NAME != "branch/default"'
 
 image_build_latest:
+  extends: .retry
   stage: release
   image:
     name: gcr.io/kaniko-project/executor:debug
@@ -35,6 +39,7 @@
     - if: '$CI_COMMIT_REF_NAME == "branch/default"'
 
 image_build_tag:
+  extends: .retry
   stage: release
   image:
     name: gcr.io/kaniko-project/executor:debug
diff --git a/templates/create-release-on-heptapod-including-debian-package.yml b/templates/create-release-on-heptapod-including-debian-package.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2NyZWF0ZS1yZWxlYXNlLW9uLWhlcHRhcG9kLWluY2x1ZGluZy1kZWJpYW4tcGFja2FnZS55bWw=..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2NyZWF0ZS1yZWxlYXNlLW9uLWhlcHRhcG9kLWluY2x1ZGluZy1kZWJpYW4tcGFja2FnZS55bWw= 100644
--- a/templates/create-release-on-heptapod-including-debian-package.yml
+++ b/templates/create-release-on-heptapod-including-debian-package.yml
@@ -1,5 +1,7 @@
 ---
 
-include: 'templates/create-release-on-heptapod.yml'
+include:
+  - 'templates/create-release-on-heptapod.yml'
+  - 'templates/template.yml'
 
 create-release-on-heptapod:
@@ -4,5 +6,6 @@
 
 create-release-on-heptapod:
+  extends: .retry
   script:
     - |
       release-cli create --name "Release $CI_COMMIT_TAG"
diff --git a/templates/create-release-on-heptapod.yml b/templates/create-release-on-heptapod.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2NyZWF0ZS1yZWxlYXNlLW9uLWhlcHRhcG9kLnltbA==..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2NyZWF0ZS1yZWxlYXNlLW9uLWhlcHRhcG9kLnltbA== 100644
--- a/templates/create-release-on-heptapod.yml
+++ b/templates/create-release-on-heptapod.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 create-release-on-heptapod:
@@ -2,4 +4,5 @@
 create-release-on-heptapod:
+  extends: .retry
   stage: release
   image: registry.gitlab.com/gitlab-org/release-cli:latest
   tags:
diff --git a/templates/lint/black.yml b/templates/lint/black.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2xpbnQvYmxhY2sueW1s..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2xpbnQvYmxhY2sueW1s 100644
--- a/templates/lint/black.yml
+++ b/templates/lint/black.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 black:
@@ -2,4 +4,5 @@
 black:
+  extends: .retry
   interruptible: true
   image: ${CI_REGISTRY}/cubicweb/dockerfiles/python-logilab:latest
   except:
diff --git a/templates/lint/check-manifest.yml b/templates/lint/check-manifest.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2xpbnQvY2hlY2stbWFuaWZlc3QueW1s..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2xpbnQvY2hlY2stbWFuaWZlc3QueW1s 100644
--- a/templates/lint/check-manifest.yml
+++ b/templates/lint/check-manifest.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 check-manifest:
@@ -2,4 +4,5 @@
 check-manifest:
+  extends: .retry
   interruptible: true
   image: ${CI_REGISTRY}/cubicweb/dockerfiles/python-logilab:latest
   except:
diff --git a/templates/lint/flake8.yml b/templates/lint/flake8.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2xpbnQvZmxha2U4LnltbA==..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2xpbnQvZmxha2U4LnltbA== 100644
--- a/templates/lint/flake8.yml
+++ b/templates/lint/flake8.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 flake8:
@@ -2,4 +4,5 @@
 flake8:
+  extends: .retry
   interruptible: true
   image: ${CI_REGISTRY}/cubicweb/dockerfiles/python-logilab:latest
   except:
diff --git a/templates/lint/mypy.yml b/templates/lint/mypy.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2xpbnQvbXlweS55bWw=..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2xpbnQvbXlweS55bWw= 100644
--- a/templates/lint/mypy.yml
+++ b/templates/lint/mypy.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 mypy:
@@ -2,4 +4,5 @@
 mypy:
+  extends: .retry
   interruptible: true
   image: ${CI_REGISTRY}/cubicweb/dockerfiles/python-logilab:latest
   except:
diff --git a/templates/lint/safety.yml b/templates/lint/safety.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2xpbnQvc2FmZXR5LnltbA==..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2xpbnQvc2FmZXR5LnltbA== 100644
--- a/templates/lint/safety.yml
+++ b/templates/lint/safety.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 safety:
@@ -2,4 +4,5 @@
 safety:
+  extends: .retry
   interruptible: true
   allow_failure: true
   stage: lint
diff --git a/templates/lint/yamllint.yml b/templates/lint/yamllint.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL2xpbnQveWFtbGxpbnQueW1s..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL2xpbnQveWFtbGxpbnQueW1s 100644
--- a/templates/lint/yamllint.yml
+++ b/templates/lint/yamllint.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 yamllint:
@@ -2,4 +4,5 @@
 yamllint:
+  extends: .retry
   interruptible: true
   image: ${CI_REGISTRY}/cubicweb/dockerfiles/python-logilab:latest
   tags:
diff --git a/templates/template.yml b/templates/template.yml
new file mode 100644
index 0000000000000000000000000000000000000000..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL3RlbXBsYXRlLnltbA==
--- /dev/null
+++ b/templates/template.yml
@@ -0,0 +1,10 @@
+---
+
+.retry:
+  retry:
+    max: 2
+    when:
+      - runner_system_failure
+      - stuck_or_timeout_failure
+      - api_failure
+      - scheduler_failure
diff --git a/templates/tests/py27.yml b/templates/tests/py27.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL3Rlc3RzL3B5MjcueW1s..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL3Rlc3RzL3B5MjcueW1s 100644
--- a/templates/tests/py27.yml
+++ b/templates/tests/py27.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 py27:
@@ -2,4 +4,5 @@
 py27:
+  extends: .retry
   interruptible: true
   before_script:
     - pip install tox
diff --git a/templates/tests/py3.yml b/templates/tests/py3.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL3Rlc3RzL3B5My55bWw=..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL3Rlc3RzL3B5My55bWw= 100644
--- a/templates/tests/py3.yml
+++ b/templates/tests/py3.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 py3:
@@ -2,4 +4,5 @@
 py3:
+  extends: .retry
   interruptible: true
   image: ${CI_REGISTRY}/cubicweb/dockerfiles/bullseye-slim-pg13
   stage: tests
diff --git a/templates/upload-python-package-to-heptapod.yml b/templates/upload-python-package-to-heptapod.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL3VwbG9hZC1weXRob24tcGFja2FnZS10by1oZXB0YXBvZC55bWw=..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL3VwbG9hZC1weXRob24tcGFja2FnZS10by1oZXB0YXBvZC55bWw= 100644
--- a/templates/upload-python-package-to-heptapod.yml
+++ b/templates/upload-python-package-to-heptapod.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 upload-python-package-to-heptapod:
@@ -2,4 +4,5 @@
 upload-python-package-to-heptapod:
+  extends: .retry
   stage: publish
   image: python
   tags:
diff --git a/templates/upload-to-pypi.yml b/templates/upload-to-pypi.yml
index 3227c616982b9fcc0935b6b7ef7bf4370352c8da_dGVtcGxhdGVzL3VwbG9hZC10by1weXBpLnltbA==..9d9ce3ac468d092b437165c8d540085986e30b83_dGVtcGxhdGVzL3VwbG9hZC10by1weXBpLnltbA== 100644
--- a/templates/upload-to-pypi.yml
+++ b/templates/upload-to-pypi.yml
@@ -1,2 +1,4 @@
 ---
+include: 'templates/template.yml'
+
 pypi-publish:
@@ -2,4 +4,5 @@
 pypi-publish:
+  extends: .retry
   stage: publish
   image: ${CI_REGISTRY}/cubicweb/dockerfiles/python-logilab:latest
   tags: