diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ee7df4177b93e997ab2ef6187d293d7b82056859..698c883e47df7ce52c3d53f85edc91a10ecadec1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,6 +15,11 @@ stages:
 .breaking_tests: &breaking_tests
     allow_failure: true
 
+variables:
+    GIT_DEPTH: 10                       # No need to clone all the history
+    SRC_DIR: $CI_PROJECT_DIR            # Where the sources are
+    WORK_DIR: $HOME/CI_$CI_PIPELINE_ID  # Where we will work, so that it's not erased
+
 #################################################
 ### Initialization and Finalization #############
 #################################################
@@ -23,7 +28,7 @@ env_sanitize:
     <<: *main_tests
     stage: initialization
     script:
-        - mkdir -p $CI_PROJECT_DIR/{build.clang,build.gcc,install.clang,install.gcc}
+        - mkdir -p $WORK_DIR/{build.clang,build.gcc,install.clang,install.gcc}
         - echo "Env is intialized"
 
 env_finalize:
@@ -31,7 +36,7 @@ env_finalize:
     stage: finalization
     allow_failure: true
     when: on_success
-    script: rm -rf $CI_PROJECT_DIR
+    script: rm -rf $WORK_DIR
 
 #################################################
 ### Configures ##################################
diff --git a/scripts/validate.bash b/scripts/validate.bash
index d83ffc50aad6acfe8ec2fd889a6b043744e1928b..7d817ee8a0ab190edeebefdeb929ea64580b8c5b 100755
--- a/scripts/validate.bash
+++ b/scripts/validate.bash
@@ -14,12 +14,17 @@ LKT_DIR="$PWD"              # The project directory
 LKT_CONFIGURE_OPTIONS=""    # Options to pass to the configure command
 LKT_CORE_NUMBER=4           # Number of cores to use with make
 LKT_TEST=""                 # Which tests to perform
+LKT_SRC=$SRC_DIR            # Where to find the sources of lektor
+
+# Below: global variables that will be initialized latter
+LKT_INSTALL=""              # Install folder of lektor
+LKT_BUILD=""                # Build folder of lektor
 
 ### AVAILABLE TESTS ##########################################################
 
 function test_simple ()
 {
-    check_cd $LKT_DIR/install.$LKT_COMPILER/
+    check_cd $LKT_INSTALL
     ./lektord &
     local _child_pid=$!
     ./lkt pwd=hashire adm kil
@@ -84,9 +89,7 @@ SQLITE3=$(which sqlite3)
 # - LKT_CONFIGURE_OPTIONS   Options to pass to the configure command         #
 function do_configure ()
 {
-    check_cd $LKT_DIR
-    mkdir {build,install}.$LKT_COMPILER
-    check_cd build.$LKT_COMPILER
+    check_cd $LKT_BUILD
     check_configure                                                          \
         --prefix=$LKT_DIR/install.$LKT_COMPILER                              \
         $LKT_CONFIGURE_OPTIONS
@@ -99,7 +102,7 @@ function do_configure ()
 # - LKT_COMPILER            The compiler used to build                       #
 function do_build ()
 {
-    check_cd $LKT_DIR/build.$LKT_COMPILER
+    check_cd $LKT_BUILD
     check_make -j$LKT_CORE_NUMBER
     check_make install
     check_cd $LKT_DIR
@@ -132,7 +135,6 @@ function do_steps ()
 # - LKT_DIR                 The project root directory                       #
 function do_launch ()
 {
-    check_cd $LKT_DIR
     for test in $LKT_TEST ; do
         case "$test" in
             simple)     test_simple;;
@@ -185,6 +187,12 @@ for arg in $* ; do
     esac
 done
 
+### GLOBALS THAT NEEDS ARGUMENTS TO BE INITIALIZED ###########################
+# - LKT_INSTALL             Where lektor will be installed                   #
+# - LKT_BUILD               Where lektor will be configured                  #
+LKT_INSTALL=$WORK_DIR/install.$LKT_COMPILER
+LKT_BUILD=$WORK_DIR/build.$LKT_COMPILER
+
 ### DO OUR STUFF HERE ########################################################
 process_args
 do_steps