From 4c604e762e47825a4e0f012a6885ca9ca4de3ad9 Mon Sep 17 00:00:00 2001 From: Wiktor Maj Date: Wed, 26 Jun 2024 18:17:59 +0200 Subject: [PATCH] with lint --- .github/workflows/lint.yml | 63 +++++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 2 -- README.md | 4 +-- ai.yml => codecov.yml | 0 linters.yml | 31 ------------------ security.yml | 0 tests/TESTING.md | 3 +- 7 files changed, 66 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/lint.yml rename ai.yml => codecov.yml (100%) delete mode 100644 linters.yml create mode 100644 security.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..f461b3e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,63 @@ + +name: Lint + +on: + push: + branches: '**' + +jobs: + lint: + runs-on: self-hosted + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.10.12" + + - name: Install Python dependencies + run: pip install --no-cache-dir --user pylint mypy flake8 + + - name: Setup Terraform linter + uses: terraform-linters/setup-tflint@v4 + with: + tflint_version: v0.50.3 + + - name: Initialize Terraform linter + run: tflint --init + working-directory: ./tests/setup + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Lint Markdown files + uses: articulate/actions-markdownlint@v1 + with: + files: '**/*.md' + ignore: node_modules + version: 0.28.1 + + - name: Lint shell scripts + uses: ludeeus/action-shellcheck@master + + - name: Lint Dockerfiles + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + + - name: Lint Terraform testing infrastructure + run: tflint + working-directory: ./tests/setup + + - name: Lint ansible testing playbook + uses: ansible/ansible-lint@main + + - name: Lint Python files with pylint + run: pylint **/*.py + + - name: Lint Python files with mypy + run: mypy . + + - name: Lint Python files with flake8 + run: flake8 . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d083d19..505646a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,6 @@ jobs: run: | sudo apt update sudo apt install --yes openssh-server=1:8.9p1-3ubuntu0.7 - sudo apt install --yes tree sudo service ssh start - name: Initialize Terraform infrastructure @@ -37,7 +36,6 @@ jobs: - name: Show VM metrics run: cat /proc/cpuinfo && cat /proc/meminfo && df -h - # && du -h --max-depth=3 / | sort -rh | head -n 100 - name: Apply Terraform infrastructure run: terraform apply --auto-approve diff --git a/README.md b/README.md index 051dc25..a76bedf 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ _[See how to do it with `systemctl`](https://documentation.suse.com/smart/system * The user's host must be able to `ssh` to each of the nodes passwordlessly. * There should be at least one available and running network interface capable of sending and receiving packets between the user's host and management nodes via IPv4. * Ability to read/write to the `/opt` directory on the nodes. +* On the MySQL nodes port `3306` should be open for communication within the nodes. +* On the Management nodes port `6446` should be open for communication within the nodes. * For production setups follow [SECURITY.md](docs/SECURITY.md). -* On the MySQL nodes port `3306` should be open for external communication. -* On the Management nodes port `6446` should be open for external communication. ### Installed software diff --git a/ai.yml b/codecov.yml similarity index 100% rename from ai.yml rename to codecov.yml diff --git a/linters.yml b/linters.yml deleted file mode 100644 index 011024d..0000000 --- a/linters.yml +++ /dev/null @@ -1,31 +0,0 @@ - -name: Lint - -on: - push: - branches: '**' - -jobs: - lint: - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup TFLint - uses: terraform-linters/setup-tflint@v4 - with: - tflint_version: v0.50.3 - - - name: Initialize TFLint - run: tflint --init - working-directory: ./tests/setup - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: Run TFLint - run: tflint - working-directory: ./tests/setup - - - name: Run ansible-lint - uses: ansible/ansible-lint@main \ No newline at end of file diff --git a/security.yml b/security.yml new file mode 100644 index 0000000..e69de29 diff --git a/tests/TESTING.md b/tests/TESTING.md index c12de13..cd4009b 100644 --- a/tests/TESTING.md +++ b/tests/TESTING.md @@ -29,10 +29,9 @@ Ansible playbook running testsuite against applied terraform infrastructure, tha ### Required software -Testing host is the `ubuntu:22.04` and has the following software installed: +Testing host is the `ubuntu:22.04` runner with the [software installed](../README.md#installed-software) meeting the [required criteria](../README.md/#hosts-specification) with the following software installed for testing: * `terraform v1.0.10` -* `openssh-server v1:8.9p1-3ubuntu0.7` * `python v3.10.12` with the following third party packages: * `ansible v9.5.1`