[release-2.27] Update pre-commit hooks (#12698)

* Update pre-commit hooks

* 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
This commit is contained in:
Max Gautier
2025-11-16 09:11:36 +00:00
committed by GitHub
parent f3354ce2c9
commit c06b669ae6
3 changed files with 11 additions and 9 deletions

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
--- ---
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 rev: v6.0.0
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
- id: check-case-conflict - id: check-case-conflict
@@ -15,7 +15,7 @@ repos:
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint.git - repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1 rev: v1.37.1
hooks: hooks:
- id: yamllint - id: yamllint
args: [--strict] args: [--strict]
@@ -27,7 +27,7 @@ repos:
exclude: "^.github|(^docs/_sidebar\\.md$)" exclude: "^.github|(^docs/_sidebar\\.md$)"
- repo: https://github.com/shellcheck-py/shellcheck-py - repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1 rev: v0.11.0.1
hooks: hooks:
- id: shellcheck - id: shellcheck
args: ["--severity=error"] args: ["--severity=error"]
@@ -35,7 +35,7 @@ repos:
files: "\\.sh$" files: "\\.sh$"
- repo: https://github.com/ansible/ansible-lint - repo: https://github.com/ansible/ansible-lint
rev: v24.12.2 rev: v25.11.0
hooks: hooks:
- id: ansible-lint - id: ansible-lint
additional_dependencies: additional_dependencies:
@@ -45,7 +45,7 @@ repos:
- distlib - distlib
- repo: https://github.com/golangci/misspell - repo: https://github.com/golangci/misspell
rev: v0.6.0 rev: v0.7.0
hooks: hooks:
- id: misspell - id: misspell
exclude: "OWNERS_ALIASES$" exclude: "OWNERS_ALIASES$"