From 399dd397bb609c54466dcf6318aecc5b48ff01eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?c=C4=83t=C4=83lin?= Date: Sun, 4 Aug 2024 02:22:11 +0200 Subject: [PATCH] ci: add pre-commit, k8s and tflint action workflows --- .forgejo/workflows/ci.yaml | 40 ++++++++++++++++++++++++ .pre-commit-config.yaml | 4 +-- Makefile | 4 ++- docker/forgejo-runner/docker-compose.yml | 2 -- tofu/authentik/vars.tf | 9 ------ 5 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 .forgejo/workflows/ci.yaml diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml new file mode 100644 index 0000000..26a2120 --- /dev/null +++ b/.forgejo/workflows/ci.yaml @@ -0,0 +1,40 @@ +--- +name: checks +on: # yamllint disable-line rule:truthy + - 'push' + +jobs: + pre-commit: + runs-on: ubuntu-22.04 + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - uses: https://code.forgejo.org/actions/setup-python@v5 + with: + python-version: '3.10' + - uses: opentofu/setup-opentofu@v1 + with: + tofu_version: 1.7.0 + - uses: pre-commit/action@v3.0.1 + + k8s: + runs-on: ubuntu-22.04 + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: Set up Kubeconform + uses: bmuschko/setup-kubeconform@v1 + + - name: Validate manifests + run: make lint--kubeconform + + + tflint: + runs-on: ubuntu-22.04 + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - uses: terraform-linters/setup-tflint@v4 + name: Setup TFLint + with: + tflint_version: v0.50.3 + + - name: Run TFLint + run: make lint--tflint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9669872..e0ca14b 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: v3.2.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -18,7 +18,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.86.0 + rev: v1.92.1 hooks: - id: terraform_fmt diff --git a/Makefile b/Makefile index 6e09254..95f8fbe 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,9 @@ lint--pre-commit: lint--kubeconform: kubeconform -strict -ignore-missing-schemas k8s/ +SHELl=/bin/bash lint--kubescore: - kube-score score k8s/**.yaml + kube-score score $$(find k8s -type f -print -name "*.yaml") lint--tflint: tflint --recursive @@ -14,4 +15,5 @@ lint--tflint: lint: make lint--pre-commit make lint--kubeconform + make lint--kube make lint--tflint diff --git a/docker/forgejo-runner/docker-compose.yml b/docker/forgejo-runner/docker-compose.yml index 9ee3737..2195be7 100644 --- a/docker/forgejo-runner/docker-compose.yml +++ b/docker/forgejo-runner/docker-compose.yml @@ -24,8 +24,6 @@ services: command: '/bin/sh -c "sleep 5; forgejo-runner daemon"' environment: DOCKER_HOST: tcp://docker-in-docker:2375 - networks: - - forgejo volumes: - ${FORGEJO_RUNNER_DATA:-/mnt/nas1/shared/forgejo-runner/data}:/data - /etc/timezone:/etc/timezone:ro diff --git a/tofu/authentik/vars.tf b/tofu/authentik/vars.tf index 8289ea7..1d883c6 100644 --- a/tofu/authentik/vars.tf +++ b/tofu/authentik/vars.tf @@ -1,12 +1,3 @@ -variable "argo_workflows_client_id" { - description = "Client ID" - type = string -} - -variable "argo_workflows_client_secret" { - description = "Client secret" - type = string -} variable "firezone_client_id" { description = "Client ID"