diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5bcef7ee45c46840bf7b5cd63e9e25f749aae531..33801198850b74336525bada46b5e6ef09a7eb7f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -83,10 +83,15 @@ ubuntu-llvm:
     - git lfs install --skip-repo
   artifacts:
     expire_in: 24 hrs
+    when: on_success
+    paths:
+      - sb_branch.txt
+  artifacts:
+    expire_in: 2 days
+    when : on_failure
     paths:
       # This recovers logs from superbuild build
       - build/*/*/*/*.log
-      - sb_branch.txt
 
 ubuntu-superbuild-prepare:
   extends: .common-prepare