From 7204362030a853d1f39a404182f86428650a9565 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Fri, 8 Jan 2021 21:29:25 +0200 Subject: [PATCH] pre-commit from templates. - Use common pre-commit snippet for Docker projects. - Use GitLab CI template for pre-commit job. --- .gitlab-ci.yml | 18 ++++-------------- .pre-commit-config.yaml | 33 ++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 23796b5..c8c2fed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,8 @@ --- +include: + - project: shore/ci-templates + file: templates/pre-commit.yml + image: adarnimrod/ci-images:docker stages: @@ -6,20 +10,6 @@ stages: - build - run -pre-commit: - stage: test - image: adarnimrod/ci-images:pre-commit - variables: - XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache" - # Disabled until https://github.com/pre-commit/pre-commit/issues/1387 is - # resolved. - SKIP: "hadolint,docker-compose" - script: - - pre-commit run --all-files - cache: - paths: - - .cache/ - build: stage: build tags: ["host01.shore.co.il"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37d0c7a..13d68fd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,21 @@ -# vim:ff=unix ts=2 sw=2 ai expandtab --- repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + - 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: detect-private-key + - id: check-symlinks - id: trailing-whitespace + - repo: https://github.com/Yelp/detect-secrets + rev: v0.14.3 + hooks: + - id: detect-secrets + - repo: https://github.com/adrienverge/yamllint - rev: v1.17.0 + rev: v1.25.0 hooks: - id: yamllint @@ -21,13 +26,23 @@ repos: types: [plain-text] exclude: LICENSE - - repo: https://github.com/Yelp/detect-secrets - rev: v0.13.0 + - repo: https://github.com/executablebooks/mdformat.git + rev: 0.5.3 hooks: - - id: detect-secrets + - 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/nimrod/docker-pre-commit.git/ rev: v0.3.0 hooks: - - id: docker-compose - id: hadolint + - id: docker-compose -- GitLab