diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0f71a9e9ec873f64d8801207391bec6ea2bc2320..cc572bc2f091f64b00d3cc8d7595e3de7782e4df 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,3 +1,6 @@
+variables:
+  GIT_STRATEGY: clone
+
 include:
   - component: git.code.tecnalia.com/smartdatalab/public/ci-cd-components/gitlab-ci/extract@master
     inputs:
@@ -21,6 +24,7 @@ include:
 
 stages:
   - build
+  - test
   - publish
 
 variables:
diff --git a/.gitleaksignore b/.gitleaksignore
new file mode 100644
index 0000000000000000000000000000000000000000..acbfc368f933b8cd67ddf98707c3df1e01cef275
--- /dev/null
+++ b/.gitleaksignore
@@ -0,0 +1 @@
+a64568eb3639a163cb0f387257017209a85869d7:README.md:generic-api-key:181
\ No newline at end of file
diff --git a/templates/gitlab-ci-docker.yml b/templates/gitlab-ci-docker.yml
index 4b154ee6920ddba8b6dd2d08d334773d57268da0..a28e6545317919a6e647b18ca46429e8699061ae 100644
--- a/templates/gitlab-ci-docker.yml
+++ b/templates/gitlab-ci-docker.yml
@@ -650,7 +650,7 @@ stages:
       kaniko_registry_mirror_option="--registry-mirror $(echo ${DOCKER_REGISTRY_MIRROR} | sed "s|^https*://||")"
     fi
     log_info "Build & deploy image $docker_image"
-    log_info "Kaniko command: /kaniko/executor --context $(docker_context_path) --dockerfile $DOCKER_FILE --destination $docker_image ${kaniko_cache_args} $kaniko_registry_mirror_option $DOCKER_METADATA $DOCKER_BUILD_ARGS $*"
+    log_info "Kaniko command: /kaniko/executor ${TRACE+--verbosity debug} --context $(docker_context_path) --dockerfile $DOCKER_FILE --destination $docker_image ${kaniko_cache_args} $kaniko_registry_mirror_option $DOCKER_METADATA $DOCKER_BUILD_ARGS $*"
     # shellcheck disable=SC2086
     /kaniko/executor ${TRACE+--verbosity debug} --context "$(docker_context_path)" --dockerfile "$DOCKER_FILE" --destination "$docker_image" ${kaniko_cache_args} $kaniko_registry_mirror_option $DOCKER_METADATA $DOCKER_BUILD_ARGS "$@"
   }
@@ -968,7 +968,7 @@ docker-trivy:
     TRIVY_CACHE_DIR: ".trivycache/"
   script: |
     # cache cleanup is needed when scanning images with the same tags, it does not remove the database
-    trivy image --clear-cache
+    trivy clean --scan-cache || trivy image --clear-cache
     export TRIVY_USERNAME=${DOCKER_REGISTRY_SNAPSHOT_USER:-${DOCKER_REGISTRY_USER:-$CI_REGISTRY_USER}}
     export TRIVY_PASSWORD=${DOCKER_REGISTRY_SNAPSHOT_PASSWORD:-${DOCKER_REGISTRY_PASSWORD:-$CI_REGISTRY_PASSWORD}}
     basename=$(echo "${DOCKER_SNAPSHOT_IMAGE}" | sed 's|[/:]|_|g')