Skip to content

Commit

Permalink
chore(repo): rework makefile and add renovate mangers for pre-commit …
Browse files Browse the repository at this point in the history
…and makefile binaries

Signed-off-by: Oliver Bähler <[email protected]>
  • Loading branch information
oliverbaehler committed Feb 6, 2025
1 parent b7a2072 commit d3a2a7c
Show file tree
Hide file tree
Showing 15 changed files with 267 additions and 166 deletions.
6 changes: 3 additions & 3 deletions .github/configs/lintconf.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

---
rules:
truthy:
level: warning
check-keys: false
braces:
min-spaces-inside: 0
max-spaces-inside: 0
Expand Down Expand Up @@ -39,5 +41,3 @@ rules:
new-lines:
type: unix
trailing-spaces: enable
truthy:
level: warning
9 changes: 4 additions & 5 deletions .github/workflows/check-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ permissions: {}

on:
push:
branches: [ "*" ]
branches:
- "*"
pull_request:
branches: [ "*" ]
branches:
- "*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
commit_lint:
runs-on: ubuntu-24.04
Expand All @@ -19,5 +20,3 @@ jobs:
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
with:
firstParent: true
45 changes: 45 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build images
permissions: {}
on:
pull_request:
branches:
- "*"
paths:
- '.github/workflows/docker-*.yml'
- 'api/**'
- 'controllers/**'
- 'pkg/**'
- 'e2e/*'
- '.ko.yaml'
- 'go.*'
- 'main.go'
- 'Makefile'

jobs:
build-images:
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: ko build
run: VERSION=${{ github.ref_name }} make ko-build-all
- name: Trivy Scan Image
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
env:
# Trivy is returning TOOMANYREQUESTS
# See: https://github.com/aquasecurity/trivy-action/issues/389#issuecomment-2385416577
TRIVY_DB_REPOSITORY: 'public.ecr.aws/aquasecurity/trivy-db:2'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
30 changes: 26 additions & 4 deletions .github/workflows/helm-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@ permissions: {}

on:
pull_request:
branches: [ "main" ]
branches:
- "main"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
linter-artifacthub:
runs-on: ubuntu-latest
container:
image: artifacthub/ah
options: --user root
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run ah lint
working-directory: ./charts/
run: ah lint
lint:
runs-on: ubuntu-24.04
steps:
Expand All @@ -31,7 +43,7 @@ jobs:
fi
- name: Run chart-testing (lint)
run: ct lint --debug --config ./.github/configs/ct.yaml --lint-conf ./.github/configs/lintconf.yaml

- name: Run docs-testing (helm-docs)
id: helm-docs
run: |
Expand All @@ -43,7 +55,17 @@ jobs:
else
echo -e '\033[0;32mDocumentation up to date\033[0m ✔'
fi
- name: Run schema-testing (helm-schema)
id: helm-schema
run: |
make helm-schema
if [[ $(git diff --stat) != '' ]]; then
echo -e '\033[0;31mSchema outdated! (Run make helm-schema locally and commit)\033[0m ❌'
git diff --color
exit 1
else
echo -e '\033[0;32mSchema up to date\033[0m ✔'
fi
- name: Run chart-testing (install)
run: HELM_KIND_CONFIG="./hack/kind-cluster.yml" make helm-test
if: steps.list-changed.outputs.changed == 'true'
if: steps.list-changed.outputs.changed == 'true'
14 changes: 12 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@ permissions: {}

on:
push:
branches: [ "*" ]
branches:
- "*"
pull_request:
branches: [ "*" ]
branches:
- "*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install yamllint
run: pip install yamllint
- name: Lint YAML files
run: yamllint --strict -c=.github/configs/lintconf.yaml
golangci:
name: lint
runs-on: ubuntu-24.04
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/seccomp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ permissions: {}

on:
pull_request:
branches: [ "*" ]
branches:
- "*"
paths:
- '.github/workflows/e2e.yml'
- 'api/**'
- 'controllers/**'
- 'pkg/**'
- 'e2e/*'
- 'Dockerfile'
- '.ko.yaml'
- 'Dockerfile.tracing'
- 'go.*'
- 'main.go'
- 'Makefile'
Expand All @@ -25,10 +27,8 @@ jobs:
strategy:
fail-fast: false
matrix:
# differently from the e2e workflow
# we don't need all the versions of kubernetes
# to generate the seccomp profile.
k8s-version: [ 'v1.30.0' ]
k8s-version:
- "v1.30.0"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -51,4 +51,3 @@ jobs:
with:
name: capsule-seccomp
path: capsule-seccomp.json

51 changes: 28 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.20.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional', 'commitlint-plugin-function-rules']
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional', 'commitlint-plugin-function-rules']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
Expand All @@ -13,28 +13,33 @@ repos:
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint
rev: v1.29.0
hooks:
- id: yamllint
args: [--strict, -c=.github/configs/lintconf.yaml]
- repo: local
hooks:
- id: run-helm-docs
name: Execute helm-docs
entry: make helm-docs
language: system
files: ^charts/
- id: run-helm-schema
name: Execute helm-schema
entry: make helm-schema
language: system
files: ^charts/
- id: run-helm-lint
name: Execute helm-lint
entry: make helm-lint
language: system
files: ^charts/
- id: golangci-lint
name: Execute golangci-lint
entry: make golint
language: system
files: \.go$
- id: run-helm-docs
name: Execute helm-docs
entry: make helm-docs
language: system
files: ^charts/
- id: run-helm-schema
name: Execute helm-schema
entry: make helm-schema
language: system
files: ^charts/
- id: run-helm-lint
name: Execute helm-lint
entry: make helm-lint
language: system
files: ^charts/
- id: golangci-lint
name: Execute golangci-lint
entry: make golint
language: system
files: \.go$
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
Expand Down
Loading

0 comments on commit d3a2a7c

Please sign in to comment.