diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 840ff32904892b831800a3340ae7ad8b0d21cb4c..a0e00f8a57d1195d7fb21a6d0b0c6a5222c5f5ca 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,14 +26,20 @@ build-job:       # This job runs in the build stage, which runs first.
   tags:
     - build
   script:
+    - |
+      if [ "$DEBUG" = true ]; do
+        set -x
+      fi
     - echo "Compiling the code..."
     - echo "Compile complete."
-    - set -x
     - |
       echo line1
       echo line2
       echo line3
-    - set +x
+    - |
+      if [ "$DEBUG" = true ]; do 
+        set +x
+      fi
 
 lint-test-job:   # This job also runs in the test stage.
   stage: test    # It can run at the same time as unit-test-job (in parallel).