219 lines
5.6 KiB
YAML
219 lines
5.6 KiB
YAML
apiVersion: tekton.dev/v1
|
|
kind: Pipeline
|
|
metadata:
|
|
name: auto-ci-push
|
|
spec:
|
|
workspaces:
|
|
- name: source
|
|
- name: ssh
|
|
params:
|
|
- name: artifactory-url
|
|
default: docker.io
|
|
description: The url of the current artifactory
|
|
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: inform-gitea-success
|
|
when:
|
|
- input: "$(tasks.status)"
|
|
operator: in
|
|
values: ["Succeeded","Completed"]
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.project-path)
|
|
- name: SHA
|
|
value: $(params.git-revision)
|
|
- name: TARGET_URL
|
|
value: "https://okd.media.rennes.home/k8s/ns/$(context.pipelineRun.namespace)/tekton.dev~v1~PipelineRun/$(context.pipelineRun.name)"
|
|
- name: DESCRIPTION
|
|
value: "auto-ci-push"
|
|
- name: STATE
|
|
value: "success"
|
|
taskRef:
|
|
name: gitea-set-status
|
|
- name: inform-gitea-warning
|
|
when:
|
|
- input: "$(tasks.status)"
|
|
operator: in
|
|
values: ["None"]
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.project-path)
|
|
- name: SHA
|
|
value: $(params.git-revision)
|
|
- name: TARGET_URL
|
|
value: "https://okd.media.rennes.home/k8s/ns/$(context.pipelineRun.namespace)/tekton.dev~v1~PipelineRun/$(context.pipelineRun.name)"
|
|
- name: DESCRIPTION
|
|
value: "auto-ci-push"
|
|
- name: STATE
|
|
value: "warning"
|
|
taskRef:
|
|
name: gitea-set-status
|
|
- name: inform-gitea-error
|
|
when:
|
|
- input: "$(tasks.status)"
|
|
operator: in
|
|
values: ["Failed"]
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.project-path)
|
|
- name: SHA
|
|
value: $(params.git-revision)
|
|
- name: TARGET_URL
|
|
value: "https://okd.media.rennes.home/k8s/ns/$(context.pipelineRun.namespace)/tekton.dev~v1~PipelineRun/$(context.pipelineRun.name)"
|
|
- name: DESCRIPTION
|
|
value: "auto-ci-push"
|
|
- name: STATE
|
|
value: "error"
|
|
taskRef:
|
|
name: gitea-set-status
|
|
tasks:
|
|
- name: inform-gitea-start
|
|
params:
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.project-path)
|
|
- name: SHA
|
|
value: $(params.git-revision)
|
|
- name: TARGET_URL
|
|
value: "https://okd.media.rennes.home/k8s/ns/$(context.pipelineRun.namespace)/tekton.dev~v1~PipelineRun/$(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: depth
|
|
value: 0
|
|
taskRef:
|
|
name: git-clone
|
|
workspaces:
|
|
- name: output
|
|
workspace: source
|
|
- name: ssh-directory
|
|
workspace: ssh
|
|
- name: git-version
|
|
runAfter: [git-clone]
|
|
taskRef:
|
|
name: git-version
|
|
workspaces:
|
|
- name: source
|
|
- name: detect-stages
|
|
runAfter: [git-version]
|
|
params:
|
|
- name: artifactory-url
|
|
value: $(params.artifactory-url)
|
|
- name: project-name
|
|
value: $(params.project-name)
|
|
- name: project-path
|
|
value: $(params.project-path)
|
|
taskRef:
|
|
name: auto-ci-detector
|
|
workspaces:
|
|
- name: source
|
|
- name: lint-shell
|
|
runAfter: [detect-stages]
|
|
when:
|
|
- input: "lint-shell"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: $(tasks.detect-stages.results.file-shell)
|
|
taskRef:
|
|
name: shellcheck
|
|
workspaces:
|
|
- name: shared-workspace
|
|
workspace: source
|
|
- name: lint-docker
|
|
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
|
|
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
|
|
runAfter: [detect-stages]
|
|
when:
|
|
- input: "lint-black"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: ["--check", "--diff", "$(tasks.detect-stages.results.file-python[*])"]
|
|
taskRef:
|
|
name: black
|
|
workspaces:
|
|
- name: shared-workspace
|
|
workspace: source
|
|
- name: lint-python
|
|
runAfter: [detect-stages]
|
|
when:
|
|
- input: "lint-python"
|
|
operator: in
|
|
values: ["$(tasks.detect-stages.results.stages-lint[*])"]
|
|
params:
|
|
- name: args
|
|
value: ["$(tasks.detect-stages.results.file-python[*])"]
|
|
taskRef:
|
|
name: pylint
|
|
workspaces:
|
|
- name: shared-workspace
|
|
workspace: source
|
|
- name: publish-docker
|
|
runAfter: ["lint-docker"]
|
|
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: buildkit-daemonless
|
|
matrix:
|
|
params:
|
|
- name: DOCKERFILE
|
|
value: $(tasks.detect-stages.results.file-docker)
|
|
workspaces:
|
|
- name: source |