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
Loading
Loading
Loading
Loading
Loading
+3 −15
Original line number Diff line number Diff line
---
image: adarnimrod/ci-images:docker

stages:
  - 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/
include:
  - project: shore/ci-templates
    file: templates/pre-commit.yml
+22 −18
Original line number Diff line number Diff line
---
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
  - repo: https://github.com/pre-commit/pre-commit-hooks.git
    rev: v3.4.0
    hooks:
      - id: check-added-large-files
      - id: check-executables-have-shebangs
      - id: check-merge-conflict
      - id: check-symlinks
      - id: check-yaml
      - id: detect-private-key
      - id: trailing-whitespace

  - repo: https://git.shore.co.il/ansible/ansible-pre-commit.git
    rev: v0.10.0
    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
  - repo: https://github.com/Yelp/detect-secrets
    rev: v0.14.3
    hooks:
      - id: ansible-lint
      - id: detect-secrets

  - repo: https://github.com/adrienverge/yamllint
    rev: v1.25.0
@@ -35,14 +25,28 @@ repos:
      - id: proselint
        types: [markdown]

  - repo: https://github.com/Yelp/detect-secrets
    rev: v0.14.3
  - repo: https://github.com/executablebooks/mdformat.git
    rev: 0.5.3
    hooks:
      - id: detect-secrets
        exclude: Pipfile\.lock
      - id: mdformat

  - repo: https://git.shore.co.il/nimrod/shell-pre-commit.git
    rev: v0.6.0
    hooks:
      - id: shell-lint

  - repo: https://github.com/shellcheck-py/shellcheck-py.git
    rev: v0.7.1.1
    hooks:
      - 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
+6 −6
Original line number Diff line number Diff line
#
 Homelab
# Homelab

[![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.
@@ -29,7 +29,7 @@ This software is licensed under the MIT license (see `LICENSE.txt`).

## Author Information

Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](
https://www.shore.co.il/). Patches are welcome via [`git send-email`](
http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located
at: <https://git.shore.co.il/explore/>.
Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my
[website](https://www.shore.co.il/). Patches are welcome via
[`git send-email`](http://git-scm.com/book/en/v2/Git-Commands-Email). The repository
is located at: <https://git.shore.co.il/expore/>.
+7 −7
Original line number Diff line number Diff line
---
- name: Update APT sources
  raw: apt-get update
  changed_when: False
  changed_when: false

- name: APT install Python
  raw: DEBIAN_FRONTEND=noninteractive apt-get install -qy python3
@@ -14,7 +14,7 @@
      - iproute2
      - lsb-release
    state: present
      update_cache: yes
    update_cache: true
    cache_valid_time: 3600

- name: Gather facts
+1 −1

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.

Loading