292 lines
7.5 KiB
YAML
292 lines
7.5 KiB
YAML
apiVersion: tekton.dev/v1
|
|
kind: Pipeline
|
|
metadata:
|
|
name: auto-ci-push
|
|
spec:
|
|
workspaces:
|
|
- name: source
|
|
- name: dockerconfig
|
|
- name: ssh
|
|
- name: sslcertdir
|
|
params:
|
|
- name: artifactory-url
|
|
default: docker.io
|
|
description: The url of the current artifactory
|
|
type: string
|
|
- name: gramo-url
|
|
default: https://gramo.media.rennes.home
|
|
type: string
|
|
- name: project-name
|
|
description: The name of the current project
|
|
type: string
|
|
- name: project-path
|
|
description: The path of the current project
|
|
type: string
|
|
- name: git-default-branch
|
|
description: The git revision
|
|
default: main
|
|
- name: git-url
|
|
type: string
|
|
- name: git-revision
|
|
type: string
|
|
- name: branch-name
|
|
type: string
|
|
finally:
|
|
- name: cleanup
|
|
taskRef:
|
|
name: auto-ci-cleanup
|
|
workspaces:
|
|
- name: source
|
|
- name: inform-gitea-success
|
|
when:
|
|
- cel: "'$(tasks.status)' in ['Succeeded','Completed']"
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.project-path)
|
|
- name: SHA
|
|
value: $(params.git-revision)
|
|
- name: TARGET_URL
|
|
value: "$(params.gramo-url)/workflow/tekton/PipelineRun/$(context.pipelineRun.namespace)/view/$(context.pipelineRun.name)"
|
|
- name: DESCRIPTION
|
|
value: "auto-ci-push"
|
|
- name: STATE
|
|
value: "success"
|
|
taskRef:
|
|
name: gitea-set-status
|
|
- name: inform-gitea-warning
|
|
when:
|
|
- cel: "'$(tasks.status)' == 'None'"
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.project-path)
|
|
- name: SHA
|
|
value: $(params.git-revision)
|
|
- name: TARGET_URL
|
|
value: "$(params.gramo-url)/workflow/tekton/PipelineRun/$(context.pipelineRun.namespace)/view/$(context.pipelineRun.name)"
|
|
- name: DESCRIPTION
|
|
value: "auto-ci-push"
|
|
- name: STATE
|
|
value: "warning"
|
|
taskRef:
|
|
name: gitea-set-status
|
|
- name: inform-gitea-error
|
|
when:
|
|
- cel: "'$(tasks.status)' == 'Failed'"
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.project-path)
|
|
- name: SHA
|
|
value: $(params.git-revision)
|
|
- name: TARGET_URL
|
|
value: "$(params.gramo-url)/workflow/tekton/PipelineRun/$(context.pipelineRun.namespace)/view/$(context.pipelineRun.name)"
|
|
- name: DESCRIPTION
|
|
value: "auto-ci-push"
|
|
- name: STATE
|
|
value: "error"
|
|
taskRef:
|
|
name: gitea-set-status
|
|
tasks:
|
|
- name: inform-gitea-start
|
|
onError: continue
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.project-path)
|
|
- name: SHA
|
|
value: $(params.git-revision)
|
|
- name: TARGET_URL
|
|
value: "$(params.gramo-url)/workflow/tekton/PipelineRun/$(context.pipelineRun.namespace)/view/$(context.pipelineRun.name)"
|
|
- name: DESCRIPTION
|
|
value: "auto-ci-push"
|
|
- name: STATE
|
|
value: "pending"
|
|
taskRef:
|
|
name: gitea-set-status
|
|
- name: git-clone
|
|
params:
|
|
- name: url
|
|
value: $(params.git-url)
|
|
- name: revision
|
|
value: $(params.git-revision)
|
|
- name: branch
|
|
value: $(params.branch-name)
|
|
- name: depth
|
|
value: 0
|
|
taskRef:
|
|
name: git-clone
|
|
workspaces:
|
|
- name: output
|
|
workspace: source
|
|
- name: ssh-directory
|
|
workspace: ssh
|
|
- name: generate-build-id
|
|
runAfter: [git-clone]
|
|
params:
|
|
- name: branch
|
|
value: $(params.branch-name)
|
|
taskRef:
|
|
name: generate-build-id
|
|
workspaces:
|
|
- name: source
|
|
- name: detect-stages
|
|
runAfter: [generate-build-id]
|
|
params:
|
|
- name: pipeline-type
|
|
value: push
|
|
- name: artifactory-url
|
|
value: $(params.artifactory-url)
|
|
- name: project-name
|
|
value: $(params.project-name)
|
|
- name: project-path
|
|
value: $(params.project-path)
|
|
- name: image-version
|
|
value: "$(tasks.generate-build-id.results.build-id)"
|
|
taskRef:
|
|
name: auto-ci-detector
|
|
workspaces:
|
|
- name: source
|
|
- name: lint-shell
|
|
runAfter: ["detect-stages"]
|
|
onError: continue
|
|
when:
|
|
- input: "lint-shell"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: $(tasks.detect-stages.results.shellcheck-args)
|
|
taskRef:
|
|
name: shellcheck
|
|
workspaces:
|
|
- name: shared-workspace
|
|
workspace: source
|
|
- name: lint-docker
|
|
onError: continue
|
|
runAfter: ["detect-stages"]
|
|
when:
|
|
- input: "lint-docker"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
taskRef:
|
|
name: hadolint
|
|
matrix:
|
|
params:
|
|
- name: dockerfile-path
|
|
value: $(tasks.detect-stages.results.file-docker)
|
|
workspaces:
|
|
- name: source
|
|
- name: lint-yaml
|
|
onError: continue
|
|
runAfter: ["detect-stages"]
|
|
when:
|
|
- input: "lint-yaml"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: ["."]
|
|
taskRef:
|
|
name: yaml-lint
|
|
workspaces:
|
|
- name: shared-workspace
|
|
workspace: source
|
|
- name: lint-black
|
|
onError: continue
|
|
runAfter: ["detect-stages"]
|
|
when:
|
|
- input: "lint-black"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: $(tasks.detect-stages.results.black-args)
|
|
taskRef:
|
|
name: black
|
|
workspaces:
|
|
- name: shared-workspace
|
|
workspace: source
|
|
- name: lint-python
|
|
onError: continue
|
|
runAfter: ["detect-stages"]
|
|
when:
|
|
- input: "lint-python"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: $(tasks.detect-stages.results.pylint-args)
|
|
taskRef:
|
|
name: pylint
|
|
workspaces:
|
|
- name: source
|
|
workspace: source
|
|
- name: lint-make
|
|
onError: continue
|
|
runAfter: ["detect-stages"]
|
|
when:
|
|
- input: "lint-make"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: $(tasks.detect-stages.results.checkmake-args)
|
|
taskRef:
|
|
name: check-make
|
|
workspaces:
|
|
- name: shared-workspace
|
|
workspace: source
|
|
- name: lint-md
|
|
onError: continue
|
|
runAfter: ["detect-stages"]
|
|
when:
|
|
- input: "lint-md"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: $(tasks.detect-stages.results.mdl-args)
|
|
taskRef:
|
|
name: markdown-lint
|
|
workspaces:
|
|
- name: shared-workspace
|
|
workspace: source
|
|
- name: lint-kube
|
|
onError: continue
|
|
runAfter: ["detect-stages"]
|
|
when:
|
|
- input: "lint-kube"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: $(tasks.detect-stages.results.kubelinter-args)
|
|
- name: manifest
|
|
value: k8
|
|
- name: default_option
|
|
value: do-not-auto-add-defaults
|
|
- name: includelist
|
|
value: "no-extensions-v1beta,default-service-account,no-readiness-probe"
|
|
taskRef:
|
|
name: kube-linter
|
|
workspaces:
|
|
- name: source
|
|
- name: publish-docker
|
|
runAfter: ["lint-md","lint-kube","lint-make","lint-shell","lint-docker","lint-yaml","lint-black","lint-python"]
|
|
when:
|
|
- input: "publish-docker"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-publish[*])"]
|
|
- input: "$(params.branch-name)"
|
|
operator: in
|
|
values: ["$(params.git-default-branch)"]
|
|
taskRef:
|
|
name: buildah
|
|
matrix:
|
|
params:
|
|
- name: DOCKERFILE
|
|
value: $(tasks.detect-stages.results.file-docker)
|
|
- name: IMAGE
|
|
value: $(tasks.detect-stages.results.images-name)
|
|
workspaces:
|
|
- name: source
|
|
- name: sslcertdir
|
|
- name: dockerconfig |