Browse Source

CI: Put pre-commit cache under CI_PROJECT_DIR (#11929)

* CI: Put pre-commit cache under CI_PROJECT_DIR

Apparently gitlab-runner can't cache stuff outside of the project
directory.

Put the cache under CI_PROJECT_DIR to make it work (which also means we
need to ignore it from ansible-lint).

Also update the pre-commit image while we're at it.

Link: https://gitlab.com/gitlab-org/gitlab/-/issues/14151

* update ansible-lint pre-commit
pull/12011/head
Max Gautier 1 month ago
committed by GitHub
parent
commit
a665b43854
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions
  1. 1
      .ansible-lint
  2. 9
      .gitlab-ci/lint.yml
  3. 2
      .pre-commit-config.yaml

1
.ansible-lint

@ -38,5 +38,6 @@ exclude_paths:
- venv
- .github
- .ansible
- .cache
mock_modules:
- gluster.gluster.gluster_volume

9
.gitlab-ci/lint.yml

@ -3,15 +3,16 @@ pre-commit:
stage: test
tags:
- ffci
image: 'ghcr.io/pre-commit-ci/runner-image@sha256:aaf2c7b38b22286f2d381c11673bec571c28f61dd086d11b43a1c9444a813cef'
image: 'ghcr.io/pre-commit-ci/runner-image@sha256:fe01a6ec51b298412990b88627c3973b1146c7304f930f469bafa29ba60bcde9'
variables:
PRE_COMMIT_HOME: /pre-commit-cache
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
script:
- pre-commit run --all-files --show-diff-on-failure
cache:
key: pre-commit-all
key: pre-commit-2
paths:
- /pre-commit-cache
- ${PRE_COMMIT_HOME}
when: 'always'
needs: []
vagrant-validate:

2
.pre-commit-config.yaml

@ -29,7 +29,7 @@ repos:
files: "\\.sh$"
- repo: https://github.com/ansible/ansible-lint
rev: v25.1.0
rev: v25.1.1
hooks:
- id: ansible-lint
additional_dependencies:

Loading…
Cancel
Save