Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(refactoring) Move to stepactions for linters pipelinerun #1824

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: {}
Loading