fix
This commit is contained in:
@@ -256,10 +256,11 @@ def get_results(config, files, root_dir):
|
||||
if "ts" in files or "js" in files:
|
||||
set_js_stages(stages, config, files, root_dir)
|
||||
for stage in ["prepare", "lint", "build", "test", "publish"]:
|
||||
if "on-{stage}.yaml" in config["files"]:
|
||||
stages[stage] = ["custom"]
|
||||
if len(stages[stage])>0:
|
||||
append_stage(stages, "global", "on-{stage}".format(stage = stage), config["files"])
|
||||
if "{stage}-custom.yaml" in config["files"]:
|
||||
stages[stage].append("{stage}-custom")
|
||||
# Unsupported by tekton... yet :P
|
||||
#if len(stages[stage])>0:
|
||||
# append_stage(stages, "global", "on-{stage}".format(stage = stage), config["files"])
|
||||
return stages, args
|
||||
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
apiVersion: tekton.dev/v1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: auto-ci-lint
|
||||
spec:
|
||||
workspaces:
|
||||
- name: source
|
||||
params:
|
||||
- name: on-error
|
||||
type: string
|
||||
default: stopAndFail
|
||||
- name: stages
|
||||
type: array
|
||||
- name: dockerfiles
|
||||
type: array
|
||||
default: []
|
||||
- name: shellcheck-args
|
||||
type: array
|
||||
default: []
|
||||
- name: black-args
|
||||
type: array
|
||||
default: []
|
||||
- name: pylint-args
|
||||
type: array
|
||||
default: []
|
||||
- name: git-url
|
||||
type: string
|
||||
- name: git-revision
|
||||
type: string
|
||||
tasks:
|
||||
- name: lint-shell
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-shell"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: $(params.shellcheck-args)
|
||||
taskRef:
|
||||
name: shellcheck
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-docker
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-docker"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
taskRef:
|
||||
name: hadolint
|
||||
matrix:
|
||||
params:
|
||||
- name: dockerfile-path
|
||||
value: $(tasks.detect-stages.results.file-docker)
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: lint-yaml
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-yaml"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["."]
|
||||
taskRef:
|
||||
name: yaml-lint
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-black
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-black"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: $(params.black-args)
|
||||
taskRef:
|
||||
name: black
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-python
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-python"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["$(tasks.detect-stages.results.file-python[*])"]
|
||||
taskRef:
|
||||
name: pylint
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
@@ -31,6 +31,9 @@ spec:
|
||||
type: string
|
||||
- name: branch-name
|
||||
type: string
|
||||
- name: on-error
|
||||
type: string
|
||||
default: continue
|
||||
finally:
|
||||
- name: cleanup
|
||||
taskRef:
|
||||
@@ -144,57 +147,30 @@ spec:
|
||||
name: auto-ci-detector
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: lint
|
||||
runAfter: [detect-stages]
|
||||
- name: lint-shell
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "on-lint"
|
||||
- input: "lint-shell"
|
||||
operator: in
|
||||
values: ["$(tasks.detect-stages.results.stages-global[*])"]
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: git-url
|
||||
value: $(params.git-url)
|
||||
- name: git-revision
|
||||
value: $(params.git-revision)
|
||||
- name: on-error
|
||||
value: stopAndFail
|
||||
- name: stages
|
||||
value: $(tasks.detect-stages.results.stages-lint)
|
||||
- name: dockerfiles
|
||||
value: $(tasks.detect-stages.results.file-docker)
|
||||
- name: shellcheck-args
|
||||
value: $(tasks.detect-stages.results.shellcheck-args)
|
||||
- name: black-args
|
||||
value: $(tasks.detect-stages.results.black-args)
|
||||
- name: pylint-args
|
||||
value: $(tasks.detect-stages.results.pylint-args)
|
||||
pipelineRef:
|
||||
name: auto-ci-lint
|
||||
- name: args
|
||||
value: $(params.shellcheck-args)
|
||||
taskRef:
|
||||
name: shellcheck
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: lint-custom
|
||||
runAfter: [detect-stages]
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-shell-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "on-lint-custom"
|
||||
- input: "lint-shell-custom"
|
||||
operator: in
|
||||
values: ["$(tasks.detect-stages.results.stages-global[*])"]
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: git-url
|
||||
value: $(params.git-url)
|
||||
- name: git-revision
|
||||
value: $(params.git-revision)
|
||||
- name: on-error
|
||||
value: stopAndFail
|
||||
- name: stages
|
||||
value: $(tasks.detect-stages.results.stages-lint)
|
||||
- name: dockerfiles
|
||||
value: $(tasks.detect-stages.results.file-docker)
|
||||
- name: shellcheck-args
|
||||
value: $(tasks.detect-stages.results.shellcheck-args)
|
||||
- name: black-args
|
||||
value: $(tasks.detect-stages.results.black-args)
|
||||
- name: pylint-args
|
||||
value: $(tasks.detect-stages.results.pylint-args)
|
||||
pipelineRef:
|
||||
- name: args
|
||||
value: $(params.shellcheck-args)
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
@@ -202,7 +178,144 @@ spec:
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/on-lint.yaml"
|
||||
value: ".tekton/lint-shell.yaml"
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-docker
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-docker"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
taskRef:
|
||||
name: hadolint
|
||||
matrix:
|
||||
params:
|
||||
- name: dockerfile-path
|
||||
value: $(tasks.detect-stages.results.file-docker)
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: lint-docker-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-docker-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-docker.yaml"
|
||||
matrix:
|
||||
params:
|
||||
- name: dockerfile-path
|
||||
value: $(tasks.detect-stages.results.file-docker)
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: lint-yaml
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-yaml"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["."]
|
||||
taskRef:
|
||||
name: yaml-lint
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-yaml-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-yaml-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["."]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-yaml.yaml"
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-black
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-black"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: $(params.black-args)
|
||||
taskRef:
|
||||
name: black
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-black-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-black-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: $(params.black-args)
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-black.yaml"
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-python
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-python"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["$(tasks.detect-stages.results.file-python[*])"]
|
||||
taskRef:
|
||||
name: pylint
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-custom.yaml"
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: publish-docker
|
||||
|
||||
@@ -28,6 +28,9 @@ spec:
|
||||
type: string
|
||||
- name: tag-name
|
||||
type: string
|
||||
- name: on-error
|
||||
type: string
|
||||
default: stopAndFail
|
||||
finally:
|
||||
- name: cleanup
|
||||
taskRef:
|
||||
@@ -129,25 +132,46 @@ spec:
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: lint-shell
|
||||
runAfter: [detect-stages]
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-shell"
|
||||
operator: in
|
||||
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: $(tasks.detect-stages.results.file-shell)
|
||||
value: $(params.shellcheck-args)
|
||||
taskRef:
|
||||
name: shellcheck
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-shell-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-shell-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: $(params.shellcheck-args)
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-shell.yaml"
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-docker
|
||||
runAfter: [detect-stages]
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-docker"
|
||||
operator: in
|
||||
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
||||
values: ["$(params.stages[*])"]
|
||||
taskRef:
|
||||
name: hadolint
|
||||
matrix:
|
||||
@@ -156,12 +180,33 @@ spec:
|
||||
value: $(tasks.detect-stages.results.file-docker)
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: lint-docker-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-docker-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-docker.yaml"
|
||||
matrix:
|
||||
params:
|
||||
- name: dockerfile-path
|
||||
value: $(tasks.detect-stages.results.file-docker)
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: lint-yaml
|
||||
runAfter: [detect-stages]
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-yaml"
|
||||
operator: in
|
||||
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["."]
|
||||
@@ -170,26 +215,68 @@ spec:
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-yaml-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-yaml-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["."]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-yaml.yaml"
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-black
|
||||
runAfter: [detect-stages]
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-black"
|
||||
operator: in
|
||||
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["--check", "--diff", "$(tasks.detect-stages.results.file-python[*])"]
|
||||
value: $(params.black-args)
|
||||
taskRef:
|
||||
name: black
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-black-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-black-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: $(params.black-args)
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-black.yaml"
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-python
|
||||
runAfter: [detect-stages]
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-python"
|
||||
operator: in
|
||||
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
||||
values: ["$(params.stages[*])"]
|
||||
params:
|
||||
- name: args
|
||||
value: ["$(tasks.detect-stages.results.file-python[*])"]
|
||||
@@ -198,6 +285,23 @@ spec:
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
workspace: source
|
||||
- name: lint-custom
|
||||
onError: $(params.on-error)
|
||||
when:
|
||||
- input: "lint-custom"
|
||||
operator: in
|
||||
values: ["$(params.stages[*])"]
|
||||
taskRef:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: $(params.git-url)
|
||||
- name: revision
|
||||
value: $(params.git-revision)
|
||||
- name: pathInRepo
|
||||
value: ".tekton/lint-custom.yaml"
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: publish-docker
|
||||
runAfter: ["lint-docker"]
|
||||
when:
|
||||
|
||||
Reference in New Issue
Block a user