Merge "chore: add pre-commit and hook it into Zuul"

This commit is contained in:
Zuul
2025-07-30 21:21:30 +00:00
committed by Gerrit Code Review
5 changed files with 18 additions and 7 deletions

8
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,8 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: fix-byte-order-marker
- id: check-merge-conflict

View File

@@ -39,13 +39,6 @@
# chdir: "{{ work_dir }}"
# target: all
- name: Prevent trailing whitespaces
shell: find . \! \( -path "*/\.*" -o -path "*/doc/build/*" -o -name "*.tgz" -o -name "*.png" -o -name "*.jpg" \) -type f -exec grep -El " +$" {} \;
register: _found_whitespaces
failed_when: _found_whitespaces.stdout != ""
args:
chdir: "{{ work_dir }}"
- name: Install yamllint
shell: pip3 install -U yq yamllint
become: yes

View File

@@ -13,6 +13,11 @@ passenv = *_proxy,*_PROXY
[testenv:venv]
commands = {posargs}
[testenv:linters]
deps = pre-commit
allowlist_externals = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure {posargs}
[testenv:docs]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}

View File

@@ -23,6 +23,10 @@
pre-run:
- playbooks/inject-keys.yaml
- job:
name: openstack-helm-pre-commit
parent: tox-linters
- job:
name: openstack-helm-bandit
roles:

View File

@@ -20,6 +20,7 @@
check:
jobs:
- openstack-helm-linter
- openstack-helm-pre-commit
- openstack-helm-bandit
# 2024.1
- openstack-helm-tls-2024-1-ubuntu_jammy # 3 nodes rook