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.
This commit is contained in:
Daniel Diepold 2022-11-11 08:48:24 +01:00
parent 4014472fab
commit 5d76c7909c

View File

@ -7,6 +7,4 @@ cache:
#- $FRONTEND_DIR/dist #- $FRONTEND_DIR/dist
# Cache Gradle # Cache Gradle
- .gradle - .gradle
- '**/build'
- "**/target"
#- "**/node_modules" #- "**/node_modules"