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