diff --git a/gitlab/functions.sh b/gitlab/functions.sh
index 55afc3aee2d93928dce2a529208da08ea1ea723c..8c353b7e095cf571c913145e528a80bb8d06264f 100644
--- a/gitlab/functions.sh
+++ b/gitlab/functions.sh
@@ -428,9 +428,3 @@ LANG="en_US.UTF-8"
 LC_ALL="${LANG}"
 export_env LANG
 export_env LC_ALL
-
-# ask conda to cache and build in the project directory
-CONDA_ENVS_PATH="conda-env"
-CONDA_BLD_PATH="conda-env"
-export_env CONDA_ENVS_PATH
-export_env CONDA_BLD_PATH
diff --git a/templates/gitlab-ci.yml b/templates/gitlab-ci.yml
index 5e885e32f216140e0b6aa166d97e955465cfc493..85415d506592af2d9aa4e4bbca8c49c8fdf752b6 100644
--- a/templates/gitlab-ci.yml
+++ b/templates/gitlab-ci.yml
@@ -16,14 +16,8 @@ stages:
 # Build targets
 .build_template: &build_job
   stage: build
-  script:
-    - ./_ci/build.sh
-
-.build_linux_template: &linux_build_job
-  <<: *build_job
   before_script:
-    - export CONDA_FOLDER=/opt/miniconda
-    - export PATH=/opt/miniconda/bin:$PATH
+    - export PATH=${CONDA_FOLDER}:$PATH
     - mkdir _ci
     - curl https://curl.haxx.se/ca/cacert.pem > _ci/cacert.pem
     - export CURL_CA_BUNDLE=`pwd`/_ci/cacert.pem
@@ -31,6 +25,11 @@ stages:
     - curl "https://gitlab.idiap.ch/bob/bob.admin/raw/condapackage/gitlab/install.sh" > _ci/install.sh
     - chmod 755 _ci/install.sh
     - ./_ci/install.sh _ci condapackage
+  script:
+    - ./_ci/build.sh
+
+.build_linux_template: &linux_build_job
+  <<: *build_job
   artifacts:
     expire_in: 1 week
     paths:
@@ -44,19 +43,11 @@ stages:
     paths:
       - ${CONDA_ENVS_PATH}/.pkgs/*.tar.bz2
       - ${CONDA_ENVS_PATH}/.pkgs/urls.txt
+  variables: &linux_variables
+    CONDA_FOLDER: "/opt/miniconda"
 
 .build_macosx_template: &macosx_build_job
   <<: *build_job
-  before_script:
-    - export CONDA_FOLDER=$CI_PROJECT_DIR/${CONDA_ENVS_PATH}
-    - export PATH=$CI_PROJECT_DIR/${CONDA_ENVS_PATH}/bin:$PATH
-    - mkdir _ci
-    - curl https://curl.haxx.se/ca/cacert.pem > _ci/cacert.pem
-    - export CURL_CA_BUNDLE=`pwd`/_ci/cacert.pem
-    - export SSL_CERT_FILE=`pwd`/_ci/cacert.pem
-    - curl "https://gitlab.idiap.ch/bob/bob.admin/raw/condapackage/gitlab/install.sh" > _ci/install.sh
-    - chmod 755 _ci/install.sh
-    - ./_ci/install.sh _ci condapackage
   artifacts:
     expire_in: 1 week
     paths:
@@ -69,21 +60,26 @@ stages:
     paths:
       - miniconda.sh
       - ${CONDA_ENVS_PATH}/pkgs/
+  variables: &macosx_variables
+    CONDA_FOLDER: "${CI_PROJECT_DIR}/${CONDA_ENVS_PATH}"
 
 
 build_linux_27:
   <<: *linux_build_job
   variables:
+    <<: * linux_variables
     PYTHON_VERSION: "2.7"
 
 build_linux_35:
   <<: *linux_build_job
   variables:
+    <<: * linux_variables
     PYTHON_VERSION: "3.5"
 
 build_linux_36:
   <<: *linux_build_job
   variables:
+    <<: * linux_variables
     PYTHON_VERSION: "3.6"
     BUILD_EGG: "true"
   artifacts:
@@ -96,16 +92,19 @@ build_linux_36:
 build_macosx_27:
   <<: *macosx_build_job
   variables:
+    <<: * macosx_variables
     PYTHON_VERSION: "2.7"
 
 build_macosx_35:
   <<: *macosx_build_job
   variables:
+    <<: * macosx_variables
     PYTHON_VERSION: "3.5"
 
 build_macosx_36:
   <<: *macosx_build_job
   variables:
+    <<: * macosx_variables
     PYTHON_VERSION: "3.6"