From c607a6df5a20add844bcf87e602856c3bcf443c7 Mon Sep 17 00:00:00 2001 From: Maryam Tahhan Date: Tue, 6 Aug 2024 21:54:54 +0100 Subject: [PATCH] chore: pre-commit updates (#1665) Add a workflow that runs the pre-commit jobs to cover the case where a developer hasn't opted into pre-commit. Also add the conventional commit message hook and enable more golang linters. The commits also tidies up the markdown files that had line length issues. Signed-off-by: Maryam Tahhan --- .commitlintrc.js | 1 + .github/workflows/pre-commit.yml | 12 ++++++++++++ .pre-commit-config.yaml | 6 ++++++ e2e/tools/validator/README.md | 3 ++- manifests/compose/validation/README.md | 9 ++++++--- .../validation/dockerfiles/Dockerfile.scaphandre | 1 - 6 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 .commitlintrc.js create mode 100644 .github/workflows/pre-commit.yml diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000000..422b19445b --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1 @@ +module.exports = { extends: ['@commitlint/config-conventional'] }; diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000000..99337700a7 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,12 @@ +name: pre-commit + +on: # yamllint disable-line rule:truthy + pull_request: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 091b8e639d..4464a528f8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,4 +31,10 @@ repos: rev: v1.59.1 hooks: - id: golangci-lint + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v9.16.0 + hooks: + - id: commitlint + stages: [commit-msg] + additional_dependencies: ['@commitlint/config-conventional'] # yamllint disable-line rule:quoted-strings exclude: ^vendor/.*|^_output/.*|^bpf/include/.*|^local-dev-cluster/.* diff --git a/e2e/tools/validator/README.md b/e2e/tools/validator/README.md index d2f3d54dab..60901e66fc 100644 --- a/e2e/tools/validator/README.md +++ b/e2e/tools/validator/README.md @@ -30,7 +30,8 @@ pip install . - Configure and Generate `validator.yaml` file - - Create the `validator.yaml` file based on the [validator.yaml.sample](validator.yaml.sample) template provided. + - Create the `validator.yaml` file based on the + [validator.yaml.sample](validator.yaml.sample) template provided. - Adjust the configuration according to your environment and requirements. - Run the validator diff --git a/manifests/compose/validation/README.md b/manifests/compose/validation/README.md index 83c5cde06b..06be8c1e6b 100644 --- a/manifests/compose/validation/README.md +++ b/manifests/compose/validation/README.md @@ -32,7 +32,8 @@ target deploys the following ### Usage -To allow access to the VM from the Prometheus container running on the host, `virt-net` must be created using the following command: +To allow access to the VM from the Prometheus container running on the host, +`virt-net` must be created using the following command: - Check the Virtual Bridge Interface: @@ -44,7 +45,8 @@ To allow access to the VM from the Prometheus container running on the host, `vi - Create the Docker Network: -Use the `inet` address from the previous step to create the Docker Network with `macvlan` driver. Replace `` with appropriate value. +Use the `inet` address from the previous step to create the Docker Network with +`macvlan` driver. Replace `` with appropriate value. ```sh docker network create --driver=macvlan --subnet=/24 -o parent=virbr0 virt-net @@ -52,7 +54,8 @@ docker network create --driver=macvlan --subnet=/24 -o parent=virbr0 vir - Start the Services: -Navigate to appropriate directory, set the `VM_IP` environment variable, and bring up the services: +Navigate to appropriate directory, set the `VM_IP` environment variable, and bring +up the services: ```sh cd manifests/compose/validation/metal diff --git a/manifests/compose/validation/dockerfiles/Dockerfile.scaphandre b/manifests/compose/validation/dockerfiles/Dockerfile.scaphandre index 0db24ef5bf..f586de19fb 100644 --- a/manifests/compose/validation/dockerfiles/Dockerfile.scaphandre +++ b/manifests/compose/validation/dockerfiles/Dockerfile.scaphandre @@ -3,4 +3,3 @@ FROM hubblo/scaphandre:latest # Install only curl RUN apt-get update && apt-get install -y curl -