diff --git a/.gitignore b/.gitignore deleted file mode 100644 index fcf7246..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.pre-commit-config.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1d63bb0..e663c68 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,23 @@ --- default: - image: quay.io/buildah/stable:v1.31.0 + image: quay.io/buildah/stable:v1.32 tags: - docker - linux +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS + when: never + - if: $CI_COMMIT_BRANCH + +include: + - component: gitlab.com/blue42u/ci.pre-commit/lite@0.2.0 + inputs: + job_stage: test + envars: stage: test script: | @@ -14,6 +26,9 @@ envars: commit_check: stage: test + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - when: never variables: BADRX: '^(squash!)|(fixup!)' script: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b0f2f9d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,48 @@ +default_language_version: + python: python3 +default_install_hook_types: [pre-commit, commit-msg] +default_stages: [pre-commit] + +repos: + - repo: https://github.com/executablebooks/mdformat + rev: '0.7.17' + hooks: + - id: mdformat + additional_dependencies: + - mdformat-footnote + - mdformat-tables + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: check-executables-have-shebangs + - id: check-symlinks + - id: destroyed-symlinks + - id: check-merge-conflict + - id: check-case-conflict + - id: no-commit-to-branch + args: [--branch, main] + - id: check-yaml + + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: '0.28.0' + hooks: + # Validate the GitLab CI scripts against the schema. Doesn't catch everything but helps. + - id: check-gitlab-ci + files: '.*\.gitlab-ci\.yml$' + + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: '3.0.0' + hooks: + - id: forbid-binary + - id: require-ascii + + - repo: meta + hooks: + # Un-comment (maybe temporarily) to check which hooks don't apply. + # - id: check-hooks-apply + - id: check-useless-excludes diff --git a/README.md b/README.md index e057f84..5377e7b 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ for `podman`. However, some container images you may want to use for jobs At the same time, most distributions also set `65536` as the default maximum number (including ID `0`) of IDs to allocate for user-namespaces (via `/etc/login.defs`). This creates a problem you won't realize until the runner -actually picks up a job 😞 The main symptom of this issue will be messages in +actually picks up a job. The main symptom of this issue will be messages in the pipglr containers log, similar to (abbreviated): ```text