Skip to content

Commit

Permalink
Move to stepactions for linters pipelinerun
Browse files Browse the repository at this point in the history
This will avoid provisioning a new pv and make things a bit faster and
cheaper.

Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel committed Nov 19, 2024
1 parent c9f9c84 commit b13ca43
Showing 1 changed file with 30 additions and 120 deletions.
150 changes: 30 additions & 120 deletions .tekton/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,83 +19,45 @@ spec:
- name: repo_url
- name: revision
tasks:
- name: fetchit
displayName: "Fetch git repository"
params:
- name: url
value: $(params.repo_url)
- name: revision
value: $(params.revision)
taskRef:
name: git-clone
workspaces:
- name: output
workspace: source

- name: generate-release-yaml
displayName: "Generate release.yaml"
runAfter:
- fetchit
- name: linters
taskSpec:
workspaces:
- name: source
steps:
- name: gen-yaml
- name: fetch-repo
ref:
resolver: http
params:
- name: url
value: https://raw.githubusercontent.com/tektoncd/catalog/main/stepaction/git-clone/0.1/git-clone.yaml
params:
- name: output-path
value: $(workspaces.source.path)
- name: url
value: "$(params.repo_url)"
- name: revision
value: "$(params.revision)"
- name: generate-release-yaml
image: registry.access.redhat.com/ubi9/python-312
workingDir: $(workspaces.source.path)
script: |
set -x
mkdir -p bin/ # ignored in .gitignore
./hack/generate-releaseyaml.sh > bin/release.yaml
workspaces:
- name: source
workspace: source

- name: codespell
displayName: "Code Spelling"
runAfter:
- fetchit
workspaces:
- name: source
workspace: source
taskSpec:
workspaces:
- name: source
steps:
- name: codespell
image: registry.access.redhat.com/ubi9/python-312
workingDir: $(workspaces.source.path)
script: |
pip3 install codespell
codespell -d docs/content pkg test
- name: shellcheck
displayName: "Shell scripts linter"
runAfter:
- fetchit
workspaces:
- name: source
workspace: source
taskSpec:
workspaces:
- name: source
steps:
- name: shellcheck
displayName: "Shell scripts linter"
image: koalaman/shellcheck-alpine
workingDir: $(workspaces.source.path)
script: |
shellcheck $(find hack/ -type f -regex ".*sh" -print)
- name: gitlint
displayName: "Git commit linter"
runAfter:
- fetchit
workspaces:
- name: source
workspace: source
taskSpec:
workspaces:
- name: source
steps:
- name: gitlint
displayName: "Git commit linter"
image: registry.access.redhat.com/ubi9/python-312
workingDir: $(workspaces.source.path)
script: |
Expand All @@ -114,70 +76,36 @@ spec:
git log -1 --format=format:%s |grep -E -q '^Merge branch' && exit 0
pip3 install gitlint
gitlint --commit "$(git log --format=format:%H --no-merges -1)" --ignore "Merge branch"
- name: yamllint
displayName: "YAML Linter"
runAfter:
- generate-release-yaml
taskSpec:
workspaces:
- name: source
steps:
- name: yaml-lint
- name: yamllint
displayName: "YAML Linter"
image: cytopia/yamllint
workingDir: $(workspaces.source.path)
script: |
set -x
yamllint -f parsable -c .yamllint $(find . -type f -regex ".*y[a]ml" -print)
workspaces:
- name: source
workspace: source
- name: ruff
displayName: "Python Linter (ruff)"
runAfter:
- fetchit
taskSpec:
workspaces:
- name: source
steps:
- name: ruff-lint
displayName: "Python Linter (ruff)"
image: ghcr.io/astral-sh/ruff
workingDir: $(workspaces.source.path)
args: ["check", "$(workspaces.source.path)"]

- name: ruff-format
displayName: "Python Formatter (ruff)"
image: ghcr.io/astral-sh/ruff
workingDir: $(workspaces.source.path)
args: ["format", "$(workspaces.source.path)", "--check"]
workspaces:
- name: source
workspace: source

- name: markdownlint
displayName: "Markdown Linter"
runAfter:
- fetchit
taskSpec:
workspaces:
- name: source
steps:
- name: markdown-lint
- name: markdownlint
displayName: "Markdown Linter"
image: thegeeklab/markdownlint-cli
workingDir: $(workspaces.source.path)
script: |
markdownlint $(find . -type f -regex ".*md" -not -regex '^./vendor/.*' -not -regex "^./docs/themes/.*" -not -regex './.vale/.*' -not -regex "^./.git/.*" -print)
workspaces:
- name: source
workspace: source
- name: vale
displayName: "Spelling and Grammar"
runAfter:
- fetchit
taskSpec:
workspaces:
- name: source
steps:
- name: vale-lint
- name: vale
displayName: "Spelling and Grammar"
image: registry.access.redhat.com/ubi9/python-312
workingDir: $(workspaces.source.path)
env:
Expand All @@ -191,18 +119,9 @@ spec:
curl -sH "Authorization: Bearer ${HUB_TOKEN}" -L https://github.com/errata-ai/vale/releases/download/${version}/vale_${version/v}_Linux_arm64.tar.gz|tar -xz -C /tmp/ -f- vale
export NO_COLOR=1
/tmp/vale docs/content --minAlertLevel=error --output=line
workspaces:
- name: source
workspace: source
- name: goreleaser-check
displayName: "Goreleaser Check"
runAfter:
- fetchit
taskSpec:
workspaces:
- name: source
steps:
- name: goreleaser-check
displayName: "Goreleaser Check"
image: registry.access.redhat.com/ubi9/python-312
workingDir: $(workspaces.source.path)
env:
Expand All @@ -220,17 +139,8 @@ spec:
curl -sH "Authorization: Bearer ${HUB_TOKEN}" -L https://github.com/${repo}/releases/download/${version}/${project}_Linux_arm64.tar.gz|tar -xz -C /tmp/ -f- ${project}
export NO_COLOR=1
/tmp/goreleaser check
workspaces:
- name: source
workspace: source
workspaces:
- name: source
workspaces:
- name: source
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
emptyDir: {}

0 comments on commit b13ca43

Please sign in to comment.