From f51ad1cdd20374cddbdd16900b31f3e7c4842aa0 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Nov 15 2021 07:47:44 +0000 Subject: [PATCH 1/7] Add files for Zuul to use --- diff --git a/.flake8 b/.flake8 index 2cdb126..0019b7c 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] ignore = E128, W503 -max-line-length = 120 +max-line-length = 100 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c8cc69e..51ccaab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,38 @@ -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks +--- repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: stable hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: check-added-large-files - - id: check-ast - - id: check-merge-conflict - - id: check-toml - - id: debug-statements -- repo: https://gitlab.com/PyCQA/flake8 - rev: master + - id: check-yaml + - id: check-added-large-files + - id: check-toml + - id: debug-statements + + - repo: https://gitlab.com/PyCQA/flake8 + rev: stable hooks: - - id: flake8 + - id: flake8 + + - repo: https://github.com/psf/black + rev: stable + hooks: + - id: black + args: + - --diff + - --check + + - repo: https://github.com/adrienverge/yamllint + rev: stable + hooks: + - id: yamllint + alias: yamllint-non-ansible + name: yamllint (non-Ansible) + files: '^[^(ci/)].*\.ya?ml$' + - id: yamllint + alias: yamllint-ansible + name: yamllint (Ansible) + files: '^ci/.*\.ya?ml$' + args: + - -c + - .yamllint-ansible.yaml +--- diff --git a/.yamllint-ansible.yaml b/.yamllint-ansible.yaml new file mode 100644 index 0000000..a31ec10 --- /dev/null +++ b/.yamllint-ansible.yaml @@ -0,0 +1,6 @@ +--- +extends: default +rules: + truthy: + allowed-values: ['true', 'false', 'yes', 'no'] +--- diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..8fdc85d --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,11 @@ +--- +- job: + name: pre-commit + run: ci/pre-commit.yaml + nodeset: fedora-35-vm + +- project: + check: + jobs: + - pre-commit +--- diff --git a/ci/pre-commit.yaml b/ci/pre-commit.yaml new file mode 100644 index 0000000..ec872b7 --- /dev/null +++ b/ci/pre-commit.yaml @@ -0,0 +1,21 @@ +--- +- hosts: all + + tasks: + - name: List project directory on the test system + command: "ls -al {{ ansible_user_dir }}/{{ zuul.project.src_dir }}" + + - name: install pip + become: true + package: + name: python3-pip + state: present + + - name: install pre-commit + command: pip install pre-commit --user + + - name: run pre-commit + command: + chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" + cmd: pre-commit run --all +--- diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2096b4c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] + line_length = 100 From 3cd4c381ca2913ee72be125f11db8936c0efb0a1 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Nov 15 2021 08:29:37 +0000 Subject: [PATCH 2/7] Fix .yaml document ends --- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51ccaab..b29258c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,4 +35,3 @@ repos: args: - -c - .yamllint-ansible.yaml ---- diff --git a/.yamllint-ansible.yaml b/.yamllint-ansible.yaml index a31ec10..201331d 100644 --- a/.yamllint-ansible.yaml +++ b/.yamllint-ansible.yaml @@ -3,4 +3,3 @@ extends: default rules: truthy: allowed-values: ['true', 'false', 'yes', 'no'] ---- diff --git a/.zuul.yaml b/.zuul.yaml index 8fdc85d..a5fe905 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -8,4 +8,3 @@ check: jobs: - pre-commit ---- diff --git a/ci/pre-commit.yaml b/ci/pre-commit.yaml index ec872b7..fd2077e 100644 --- a/ci/pre-commit.yaml +++ b/ci/pre-commit.yaml @@ -18,4 +18,3 @@ command: chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" cmd: pre-commit run --all ---- From b4f37206946e4dc99e8d9e6798233df287abcdb6 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Nov 15 2021 08:37:33 +0000 Subject: [PATCH 3/7] Fix indentation --- diff --git a/.zuul.yaml b/.zuul.yaml index a5fe905..199a85d 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,10 +1,10 @@ --- - job: - name: pre-commit - run: ci/pre-commit.yaml - nodeset: fedora-35-vm + name: pre-commit + run: ci/pre-commit.yaml + nodeset: fedora-35-vm - project: - check: - jobs: - - pre-commit + check: + jobs: + - pre-commit From 5a0154c575a458fc83d31f0ad126cf2ee175f592 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Nov 24 2021 11:13:44 +0000 Subject: [PATCH 4/7] Rename pre-commit --- diff --git a/ci/gating-pre-commit.yaml b/ci/gating-pre-commit.yaml new file mode 100644 index 0000000..fd2077e --- /dev/null +++ b/ci/gating-pre-commit.yaml @@ -0,0 +1,20 @@ +--- +- hosts: all + + tasks: + - name: List project directory on the test system + command: "ls -al {{ ansible_user_dir }}/{{ zuul.project.src_dir }}" + + - name: install pip + become: true + package: + name: python3-pip + state: present + + - name: install pre-commit + command: pip install pre-commit --user + + - name: run pre-commit + command: + chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" + cmd: pre-commit run --all diff --git a/ci/pre-commit.yaml b/ci/pre-commit.yaml deleted file mode 100644 index fd2077e..0000000 --- a/ci/pre-commit.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- hosts: all - - tasks: - - name: List project directory on the test system - command: "ls -al {{ ansible_user_dir }}/{{ zuul.project.src_dir }}" - - - name: install pip - become: true - package: - name: python3-pip - state: present - - - name: install pre-commit - command: pip install pre-commit --user - - - name: run pre-commit - command: - chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" - cmd: pre-commit run --all From 4c98254a76e11699880daa544eb7275b6144f409 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Nov 24 2021 11:16:55 +0000 Subject: [PATCH 5/7] Change .zuul.yaml --- diff --git a/.zuul.yaml b/.zuul.yaml index 199a85d..af08bf4 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,10 +1,10 @@ --- - job: - name: pre-commit - run: ci/pre-commit.yaml + name: gating-pre-commit + run: ci/gating-pre-commit.yaml nodeset: fedora-35-vm - project: check: jobs: - - pre-commit + - gating-pre-commit From bd3f2a8b63f1cf073c747ec0de645cca51c23d62 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Nov 24 2021 11:32:04 +0000 Subject: [PATCH 6/7] Change revs in .pre-commit-config --- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b29258c..23b9c66 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: stable + rev: v4.0.1 hooks: - id: check-yaml - id: check-added-large-files @@ -9,12 +9,12 @@ repos: - id: debug-statements - repo: https://gitlab.com/PyCQA/flake8 - rev: stable + rev: 4.0.1 hooks: - id: flake8 - repo: https://github.com/psf/black - rev: stable + rev: 21.11b1 hooks: - id: black args: @@ -22,7 +22,7 @@ repos: - --check - repo: https://github.com/adrienverge/yamllint - rev: stable + rev: v1.26.3 hooks: - id: yamllint alias: yamllint-non-ansible From b4bda6d77b67199ed92e73b94d13fc2553711d53 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: Nov 24 2021 11:41:41 +0000 Subject: [PATCH 7/7] Tweak max line length --- diff --git a/.flake8 b/.flake8 index 0019b7c..2cdb126 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] ignore = E128, W503 -max-line-length = 100 +max-line-length = 120 diff --git a/pyproject.toml b/pyproject.toml index 2096b4c..621b44b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ [tool.black] - line_length = 100 + line_length = 120