Cache not working

When executing a build I am not able to keep a file using the cache directive (the file is local.cfg)
(working on a local customization of the Dspace project)

The specific file is NOT under version control (i.e. it has an entry in .gitignore)

I have used the following 2 approaches:

cache:
      untracked: true
cache:
    paths:
    - local.cfg

neither worked since at the beginning of each build I see the following output

Fetching changes...
Removing dspace-api/target/
Removing dspace-jspui/target/
Removing dspace-rest/target/
Removing dspace-services/target/
Removing dspace-solr/target/
Removing dspace/modules/additions/target/
Removing dspace/modules/jspui/target/
Removing dspace/modules/rest/target/
Removing dspace/modules/solr/target/
Removing dspace/target/
Removing local.cfg

any suggestions?

did your build ever succeeded after you added cache to your yaml?

Because we found out that cache is created as some sort of zip file after build is succeeded and when new build starts it cleans directory and restores cached files from that “zip” file.