Skip to content

Allow more than 2 files to form cache key

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Proposal

Quoting from https://docs.gitlab.com/ee/ci/yaml/README.html#cachekeyfiles:

When you include cache:key:files, you must also list the project files that are used to generate the key, up to a maximum of two files.

The proposal is, basically, to remove such files limit.

There are some possibilities to implement this feature:

  1. #272556 could be used to replace this one if fixed.

  2. Allow defining several caches, instead of just one per job. Example:

    variables:
      MOLECULE_EPHEMERAL_DIRECTORY: $CI_PROJECT_DIR/.cache/molecule
      POETRY_VIRTUALENVS_IN_PROJECT: "true"
      PRE_COMMIT_HOME: $CI_PROJECT_DIR/.cache/pre-commit
    
    cache:
      - paths:
          - $PRE_COMMIT_HOME
        key:
          prefix: pre-commit
          files:
            - .pre-commit-config.yaml
      - paths:
          - .venv
        key:
          prefix: poetry
          files:
            - pyproject.toml
            - poetry.lock
      - paths:
          - $MOLECULE_EPHEMERAL_DIRECTORY
        key:
          prefix: molecule
          files:
            - tests/molecule/default/collections.yml
            - tests/molecule/default/requirements.yml
Edited by 🤖 GitLab Bot 🤖