diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6e83c8b4cd4464043f7c31d3fc00abffb6223ec5..90b602b1140f3ef8af29ab3c4e024048f8379f9d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,60 +22,9 @@ native-build:
   script:
     - ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-gcc
 
-.build-common:
+build:ubuntu-llvm:
   extends: .general
   stage: build
   image: registry.orfeo-toolbox.org/gbonnefille/otb-build-env/otb-ubuntu-shark:18.04
-  before_script:
-    # ccache configuration
-    - mkdir -p ccache
-    - export CCACHE_BASEDIR=${PWD}
-    - export CCACHE_DIR=${PWD}/ccache
-    - echo "max_size = 3G" > ccache/ccache.conf
-    - echo "run_second_cpp = true" >> ccache/ccache.conf
-    - echo "compiler_check = content" >> ccache/ccache.conf
-    - echo "sloppiness = time_macros" >> ccache/ccache.conf
   script:
     - ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-shark
-  cache:
-    key: "ubuntu-18.04-llvm-shark"
-    paths:
-      - ccache/
-
-build-wip:
-  extends: .build-common
-  variables:
-    OTB_CI_PROFILE: 'wip'
-  except:
-    - merge_requests
-    - develop
-    - /^release-[0-9]+\.[0-9]+$/
-  cache:
-    policy: pull
-
-build-mr:
-  extends: .build-common
-  variables:
-    OTB_CI_PROFILE: 'mr'
-  only:
-    - merge_requests
-  cache:
-    policy: pull
-
-build-develop:
-  extends: .build-common
-  variables:
-    OTB_CI_PROFILE: 'develop'
-  only:
-    - develop
-  cache:
-    policy: pull-push
-
-build-release:
-  extends: .build-common
-  variables:
-    OTB_CI_PROFILE: 'release'
-  only:
-    - /^release-[0-9]+\.[0-9]+$/
-  cache:
-    policy: pull
diff --git a/CI/main_ci.cmake b/CI/main_ci.cmake
index 92fb427c3fded046e52b1506abac912f09caf076..b3e4467133ec92857db6589964fbb5733e1b84cd 100644
--- a/CI/main_ci.cmake
+++ b/CI/main_ci.cmake
@@ -26,15 +26,22 @@ set (ENV{LANG} "C") # Only ascii output
 set (CTEST_BUILD_CONFIGURATION "Release")
 set (CTEST_CMAKE_GENERATOR "Ninja")
 
-# Find the build name
+# Find the build name and CI profile
+set(ci_profile wip)
 set(ci_mr_source "$ENV{CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}")
 set(ci_mr_target "$ENV{CI_MERGE_REQUEST_TARGET_BRANCH_NAME}")
 set(ci_ref_name "$ENV{CI_COMMIT_REF_NAME}")
 set (CTEST_BUILD_NAME "$ENV{CI_COMMIT_SHORT_SHA}")
 if(ci_mr_source AND ci_mr_target)
   set (CTEST_BUILD_NAME "${CTEST_BUILD_NAME} (${ci_mr_source} to ${ci_mr_target})")
+  set(ci_profile mr)
 elseif(ci_ref_name)
   set (CTEST_BUILD_NAME "${CTEST_BUILD_NAME} (${ci_ref_name})")
+  if("${ci_ref_name}" STREQUAL "develop")
+    set(ci_profile develop)
+  elseif("${ci_ref_name}" MATCHES "^release-[0-9]+\\.[0-9]+\$")
+    set(ci_profile release)
+  endif()
 endif()
 
 set (CTEST_SITE "${IMAGE_NAME}")
@@ -52,7 +59,7 @@ set (CMAKE_COMMAND "cmake")
 set (OTB_DATA_ROOT "${OTB_SOURCE_DIR}/otb-data/") # todo
 set (OTB_LARGEINPUT_ROOT "") # todo
 
-message(STATUS "CI profile : $ENV{OTB_CI_PROFILE}")
+message(STATUS "CI profile : ${ci_profile}")
 
 #The following file set the CONFIGURE_OPTIONS variable
 set (CONFIGURE_OPTIONS  "")