From 5d76c7909cb56d5b25e000926ff94c9d29b4fb75 Mon Sep 17 00:00:00 2001 From: Daniel Diepold Date: Fri, 11 Nov 2022 08:48:24 +0100 Subject: [PATCH] fix(cache): do not cache build results in global cache The build and target directories should not get cached between different Git commit builds (pipelines). Assume the first pipeline of a branch builds and caches some compiled Java class from the target/classes directory in the global/branch (key: $CI_COMMIT_REF_SLUG) cache. If the source code of that class is then removed by the next commit, the pipeline for that commit will extract the previously cached class file. Since the Maven build templates never call "clean" the class file will be part of test execution, packaging, etc. even though its source code was removed. The target/ directory is already passed from the Maven Build-Java job to the Test-Java job within the same pipeline anyway. --- templates/common/common-ci-cache.gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/common/common-ci-cache.gitlab-ci.yml b/templates/common/common-ci-cache.gitlab-ci.yml index 22de4ee..46e6621 100644 --- a/templates/common/common-ci-cache.gitlab-ci.yml +++ b/templates/common/common-ci-cache.gitlab-ci.yml @@ -7,6 +7,4 @@ cache: #- $FRONTEND_DIR/dist # Cache Gradle - .gradle - - '**/build' - - "**/target" #- "**/node_modules"