Skip to content
Snippets Groups Projects
Commit 8fb7485c authored by nimrod's avatar nimrod
Browse files

Pre-commit.

- Use a common pre-commit config snippet for Ansible projects.
- Use a template for pre-commit GitLab CI job.
- Address some issues raised now by pre-commit.
parent ff15912f
Branches
No related tags found
No related merge requests found
Pipeline #433 passed
--- ---
image: adarnimrod/ci-images:docker include:
- project: shore/ci-templates
stages: file: templates/pre-commit.yml
- test
pre-commit:
stage: test
image: adarnimrod/ci-images:pre-commit
variables:
XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
script:
- pre-commit run --all-files
cache:
paths:
- .cache/
--- ---
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v3.4.0 rev: v3.4.0
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
- id: check-executables-have-shebangs - id: check-executables-have-shebangs
- id: check-merge-conflict - id: check-merge-conflict
- id: check-symlinks - id: check-symlinks
- id: check-yaml
- id: detect-private-key
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://git.shore.co.il/ansible/ansible-pre-commit.git - repo: https://github.com/Yelp/detect-secrets
rev: v0.10.0 rev: v0.14.3
hooks:
- id: ansible-syntax-check
# yamllint disable-line rule:line-length
files: bootstrap\.yaml|update\.yaml|renew-certs\.yaml|debian_server\.yaml
types: [yaml]
- repo: https://github.com/ansible/ansible-lint
rev: v4.3.7
hooks: hooks:
- id: ansible-lint - id: detect-secrets
- repo: https://github.com/adrienverge/yamllint - repo: https://github.com/adrienverge/yamllint
rev: v1.25.0 rev: v1.25.0
...@@ -35,14 +25,28 @@ repos: ...@@ -35,14 +25,28 @@ repos:
- id: proselint - id: proselint
types: [markdown] types: [markdown]
- repo: https://github.com/Yelp/detect-secrets - repo: https://github.com/executablebooks/mdformat.git
rev: v0.14.3 rev: 0.5.3
hooks: hooks:
- id: detect-secrets - id: mdformat
exclude: Pipfile\.lock
- repo: https://git.shore.co.il/nimrod/shell-pre-commit.git - repo: https://git.shore.co.il/nimrod/shell-pre-commit.git
rev: v0.6.0 rev: v0.6.0
hooks: hooks:
- id: shell-lint - id: shell-lint
- repo: https://github.com/shellcheck-py/shellcheck-py.git
rev: v0.7.1.1
hooks:
- id: shellcheck - id: shellcheck
- repo: https://git.shore.co.il/ansible/ansible-pre-commit.git
rev: v0.10.0
hooks:
- id: ansible-syntax-check
files: (bootstrap|update|renew-certs|debian_server|kodi)\.yaml
- repo: https://github.com/ansible/ansible-lint
rev: v4.3.7
hooks:
- id: ansible-lint
# # Homelab
Homelab
[![pipeline status](https://git.shore.co.il/shore/homelab/badges/master/pipeline.svg)](https://git.shore.co.il/shore/homelab/-/commits/master) [![pipeline status](https://git.shore.co.il/shore/homelab/badges/master/pipeline.svg)](https://git.shore.co.il/shore/homelab/-/commits/master)
> My homelab setup using Ansible. > My homelab setup using Ansible.
...@@ -29,7 +29,7 @@ This software is licensed under the MIT license (see `LICENSE.txt`). ...@@ -29,7 +29,7 @@ This software is licensed under the MIT license (see `LICENSE.txt`).
## Author Information ## Author Information
Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website]( Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my
https://www.shore.co.il/). Patches are welcome via [`git send-email`]( [website](https://www.shore.co.il/). Patches are welcome via
http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located [`git send-email`](http://git-scm.com/book/en/v2/Git-Commands-Email). The repository
at: <https://git.shore.co.il/explore/>. is located at: <https://git.shore.co.il/expore/>.
--- ---
- name: Update APT sources - name: Update APT sources
raw: apt-get update raw: apt-get update
changed_when: False changed_when: false
- name: APT install Python - name: APT install Python
raw: DEBIAN_FRONTEND=noninteractive apt-get install -qy python3 raw: DEBIAN_FRONTEND=noninteractive apt-get install -qy python3
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
- iproute2 - iproute2
- lsb-release - lsb-release
state: present state: present
update_cache: yes update_cache: true
cache_valid_time: 3600 cache_valid_time: 3600
- name: Gather facts - name: Gather facts
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment