Skipping cache archiving due to empty cache key


#1

Hello,
I want to use the hash of the composer.lock file as cache key for gitlab for the vendor/ directory. I use the following config:

stages:
  - test
before_script:
  - export VENDOR_CACHE_KEY=`gitlab-scripts/cache-key.sh`
  - echo $VENDOR_CACHE_KEY
cache:
  untracked: true
  key: "$VENDOR_CACHE_KEY"
  paths:
    - vendor/
build_master:
  stage: test
  script:
    - echo $VENDOR_CACHE_KEY
    - composer install
  only:
    - master
    - merge_requests

But unfortunately GitLab tells me, that the cache key is empty, although the hash key is outputted. Am I doing something wrong? Is this a bug?

Running with gitlab-runner 11.7.0 (8bb608ff)
  on sANNA lx38-c1 runner 2VHGJthy
Using Shell executor...
Running on LX38-C1...
Fetching changes...
Lösche .env
Lösche var/
Lösche vendor/
Zweigspitze (HEAD) ist jetzt bei 742affb GitLab cache nutzen um vendor Verzeichnis beizubehalten.
Von https://repna.nordakademie.intern/na_devops/api.nordakademie.intern
 + 742affb...39f5a7f use-gitlab-cache -> origin/use-gitlab-cache  (Aktualisierung erzwungen)
Checking out 39f5a7fd as use-gitlab-cache...
Skipping Git submodules setup
Skipping cache extraction due to empty cache key
$ export VENDOR_CACHE_KEY=`gitlab-scripts/cache-key.sh`
$ echo $VENDOR_CACHE_KEY
bf7a791414e396fc744b455f963f4f1c
$ echo $VENDOR_CACHE_KEY
bf7a791414e396fc744b455f963f4f1c
$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 72 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.3.0): Loading from cache
  - Installing symfony/flex (v1.1.8): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.10.0): Loading from cache
  - Installing symfony/contracts (v1.0.2): Loading from cache
  - Installing doctrine/lexer (v1.0.1): Loading from cache
  - Installing doctrine/annotations (v1.6.0): Loading from cache
  - Installing doctrine/reflection (v1.0.0): Loading from cache
  - Installing doctrine/event-manager (v1.0.0): Loading from cache
  - Installing doctrine/collections (v1.5.0): Loading from cache
  - Installing doctrine/cache (v1.8.0): Loading from cache
  - Installing doctrine/persistence (v1.1.0): Loading from cache
  - Installing symfony/doctrine-bridge (v4.2.1): Loading from cache
  - Installing doctrine/inflector (v1.3.0): Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.5): Loading from cache
  - Installing symfony/routing (v4.2.1): Loading from cache
  - Installing symfony/http-foundation (v4.2.1): Loading from cache
  - Installing symfony/event-dispatcher (v4.2.1): Loading from cache
  - Installing psr/log (1.1.0): Loading from cache
  - Installing symfony/debug (v4.2.1): Loading from cache
  - Installing symfony/http-kernel (v4.2.1): Loading from cache
  - Installing symfony/finder (v4.2.1): Loading from cache
  - Installing symfony/filesystem (v4.2.1): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/dependency-injection (v4.2.1): Loading from cache
  - Installing symfony/config (v4.2.1): Loading from cache
  - Installing symfony/var-exporter (v4.2.1): Loading from cache
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing psr/cache (1.0.1): Loading from cache
  - Installing symfony/cache (v4.2.1): Loading from cache
  - Installing symfony/framework-bundle (v4.2.1): Loading from cache
  - Installing symfony/console (v4.2.1): Loading from cache
  - Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
  - Installing zendframework/zend-code (3.3.1): Loading from cache
  - Installing ocramius/proxy-manager (2.1.1): Loading from cache
  - Installing doctrine/dbal (v2.9.0): Loading from cache
  - Installing doctrine/migrations (v1.8.1): Loading from cache
  - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
  - Installing doctrine/doctrine-bundle (1.10.0): Loading from cache
  - Installing doctrine/doctrine-migrations-bundle (v1.3.2): Loading from cache
  - Installing doctrine/instantiator (1.1.0): Loading from cache
  - Installing doctrine/common (v2.10.0): Loading from cache
  - Installing doctrine/orm (v2.6.3): Loading from cache
  - Installing league/fractal (0.17.0): Loading from cache
  - Installing sensio/framework-extra-bundle (v5.2.3): Loading from cache
  - Installing symfony/security-core (v4.2.1): Loading from cache
  - Installing sentry/sentry (1.10.0): Loading from cache
  - Installing jean85/pretty-package-versions (1.2): Loading from cache
  - Installing sentry/sentry-symfony (2.1): Loading from cache
  - Installing symfony/dotenv (v4.2.1): Loading from cache
  - Installing symfony/inflector (v4.2.1): Loading from cache
  - Installing monolog/monolog (1.24.0): Loading from cache
  - Installing symfony/monolog-bridge (v4.2.1): Loading from cache
  - Installing symfony/monolog-bundle (v3.3.1): Loading from cache
  - Installing symfony/property-access (v4.2.1): Loading from cache
  - Installing symfony/security-http (v4.2.1): Loading from cache
  - Installing symfony/security-guard (v4.2.1): Loading from cache
  - Installing symfony/security-csrf (v4.2.1): Loading from cache
  - Installing symfony/security-bundle (v4.2.1): Loading from cache
  - Installing symfony/serializer (v4.2.1): Loading from cache
  - Installing symfony/yaml (v4.2.1): Loading from cache
  - Installing symfony/process (v4.2.1): Loading from cache
  - Installing facebook/webdriver (1.6.0): Loading from cache
  - Installing webmozart/assert (1.3.0): Loading from cache
  - Installing nyholm/nsa (1.1.0): Loading from cache
  - Installing symfony/dom-crawler (v4.2.1): Loading from cache
  - Installing symfony/polyfill-php72 (v1.10.0): Loading from cache
  - Installing symfony/phpunit-bridge (v4.2.1): Loading from cache
  - Installing symfony/browser-kit (v4.2.1): Loading from cache
  - Installing symfony/panther (v0.2.0): Loading from cache
  - Installing symfony/css-selector (v4.2.1): Loading from cache
  - Installing symfony/test-pack (v1.0.5): Loading from cache
Package symfony/lts is abandoned, you should avoid using it. Use symfony/flex instead.
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
Executing script assets:install public [OK]

Skipping cache archiving due to empty cache key
Job succeeded

Using Rails Credentials within Gitlab-CI