226 lines
6.6 KiB
YAML
226 lines
6.6 KiB
YAML
apiVersion: tekton.dev/v1beta1
|
|
kind: Pipeline
|
|
metadata:
|
|
name: e2etest-buildtest
|
|
namespace: goghvideo-cicd-pipeline
|
|
spec:
|
|
workspaces:
|
|
- name: source
|
|
- name: gitauth
|
|
- name: dockerconfig
|
|
- name: helm
|
|
- name: gitsshauth
|
|
params:
|
|
- name: git-repo-full-name
|
|
type: string
|
|
- name: git-token-secret-name
|
|
type: string
|
|
- name: git-token-secret-key
|
|
type: string
|
|
- name: git-commit-sha
|
|
type: string
|
|
- name: git-repo-url
|
|
type: string
|
|
description: Git URL to retrieve
|
|
- name: git-branch
|
|
type: string
|
|
description: branch to checkout
|
|
- name: git-pr-index
|
|
description: PR number to merge
|
|
- name: git-merge-type
|
|
description: What type of merge to do
|
|
- name: git-merge-delete-branch
|
|
description: delete the branch after merge
|
|
- name: verbose
|
|
type: string
|
|
default: "false"
|
|
- name: lint-package
|
|
type: string
|
|
- name: lint-context
|
|
type: string
|
|
description: Path to where the modules are stored
|
|
- name: lint-version
|
|
type: string
|
|
default: latest
|
|
- name: image
|
|
type: string
|
|
- name: s2i-builder-image
|
|
type: string
|
|
- name: git-helm-url
|
|
type: string
|
|
tasks:
|
|
- name: set-check-pending
|
|
taskRef:
|
|
name: gitea-set-status
|
|
params:
|
|
- name: SHA
|
|
value: $(params.git-commit-sha)
|
|
- name: GITEA_HOST_URL
|
|
value: git.endofday.com
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.git-repo-full-name)
|
|
- name: GITEA_TOKEN_SECRET_NAME
|
|
value: $(params.git-token-secret-name)
|
|
- name: GITEA_TOKEN_SECRET_KEY
|
|
value: $(params.git-token-secret-key)
|
|
- name: DESCRIPTION
|
|
value: Build started
|
|
- name: STATE
|
|
value: pending
|
|
- name: TARGET_URL
|
|
value: https://console-openshift-console.apps.ocp.endofday.com/pipelines/all-namespaces
|
|
- name: git-semver
|
|
runAfter:
|
|
- set-check-pending
|
|
taskRef:
|
|
name: git-semver
|
|
params:
|
|
- name: gitrepositoryurl
|
|
value: $(params.git-repo-url)
|
|
- name: gitbranch
|
|
value: $(params.git-branch)
|
|
workspaces:
|
|
- name: repo
|
|
workspace: source
|
|
- name: gitauth
|
|
workspace: gitauth
|
|
- name: golangci-lint
|
|
runAfter:
|
|
- git-semver
|
|
taskRef:
|
|
name: golangci-lint
|
|
params:
|
|
- name: package
|
|
value: $(params.lint-package)
|
|
- name: context
|
|
value: $(params.lint-context)
|
|
- name: version
|
|
value: $(params.lint-version)
|
|
workspaces:
|
|
- name: source
|
|
workspace: source
|
|
- name: generate-imagetag
|
|
runAfter:
|
|
- golangci-lint
|
|
taskRef:
|
|
name: generate-image-tag
|
|
params:
|
|
- name: version
|
|
value: $(tasks.git-semver.results.version)
|
|
- name: image
|
|
value: $(params.image)
|
|
- name: s2i-build
|
|
runAfter:
|
|
- generate-imagetag
|
|
taskRef:
|
|
name: s2i-go-debug
|
|
kind: Task
|
|
params:
|
|
- name: TLSVERIFY
|
|
value: false
|
|
- name: BUILDER_IMAGE
|
|
value: $(params.s2i-builder-image)
|
|
- name: PATH_CONTEXT
|
|
value: $(params.lint-context)
|
|
- name: verbose
|
|
value: true
|
|
- name: IMAGE
|
|
value: $(tasks.generate-imagetag.results.imagetag)
|
|
- name: ENV_VARS
|
|
value:
|
|
- semver=$(tasks.git-semver.results.version)
|
|
workspaces:
|
|
- name: source
|
|
workspace: source
|
|
- name: dockerconfig
|
|
workspace: dockerconfig
|
|
- name: pass-pr-check
|
|
runAfter: ["s2i-build"]
|
|
taskRef:
|
|
name: gitea-set-status
|
|
params:
|
|
- name: SHA
|
|
value: $(params.git-commit-sha)
|
|
- name: GITEA_HOST_URL
|
|
value: git.endofday.com
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.git-repo-full-name)
|
|
- name: GITEA_TOKEN_SECRET_NAME
|
|
value: $(params.git-token-secret-name)
|
|
- name: GITEA_TOKEN_SECRET_KEY
|
|
value: $(params.git-token-secret-key)
|
|
- name: DESCRIPTION
|
|
value: Tekton CI Pipeline
|
|
- name: STATE
|
|
value: success
|
|
- name: TARGET_URL
|
|
value: https://console-openshift-console.apps.ocp.endofday.com/pipelines
|
|
- name: create-git-release
|
|
runAfter: ["pass-pr-check"]
|
|
taskRef:
|
|
name: gitea-create-release
|
|
params:
|
|
- name: SHA
|
|
value: $(params.git-commit-sha)
|
|
- name: GITEA_HOST_URL
|
|
value: git.endofday.com
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.git-repo-full-name)
|
|
- name: GITEA_TOKEN_SECRET_NAME
|
|
value: $(params.git-token-secret-name)
|
|
- name: GITEA_TOKEN_SECRET_KEY
|
|
value: $(params.git-token-secret-key)
|
|
- name: TAG
|
|
value: $(tasks.git-semver.results.version)
|
|
- name: TITLE
|
|
value: $(params.git-repo-full-name)-$(tasks.git-semver.results.version)
|
|
- name: perform-merge
|
|
runAfter: ["create-git-release"]
|
|
taskRef:
|
|
name: gitea-merge-pr
|
|
params:
|
|
- name: GITEA_HOST_URL
|
|
value: git.endofday.com
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.git-repo-full-name)
|
|
- name: GITEA_TOKEN_SECRET_NAME
|
|
value: $(params.git-token-secret-name)
|
|
- name: GITEA_TOKEN_SECRET_KEY
|
|
value: $(params.git-token-secret-key)
|
|
- name: DESCRIPTION
|
|
value: Automatically merged by CI pipeline
|
|
- name: INDEX
|
|
value: $(params.git-pr-index)
|
|
- name: MERGETYPE
|
|
value: $(params.git-merge-type)
|
|
- name: DELETEBRANCH
|
|
value: $(params.git-merge-delete-branch)
|
|
- name: TARGET_URL
|
|
value: https://console-openshift-console.apps.ocp.endofday.com/pipelines
|
|
finally:
|
|
- name: fail-pr-check
|
|
when:
|
|
- input: $(tasks.status)
|
|
operator: in
|
|
values:
|
|
- Failed
|
|
taskRef:
|
|
name: gitea-set-status
|
|
params:
|
|
- name: SHA
|
|
value: $(params.git-commit-sha)
|
|
- name: GITEA_HOST_URL
|
|
value: git.endofday.com
|
|
- name: REPO_FULL_NAME
|
|
value: $(params.git-repo-full-name)
|
|
- name: GITEA_TOKEN_SECRET_NAME
|
|
value: $(params.git-token-secret-name)
|
|
- name: GITEA_TOKEN_SECRET_KEY
|
|
value: $(params.git-token-secret-key)
|
|
- name: DESCRIPTION
|
|
value: Tekton CI Pipeline
|
|
- name: STATE
|
|
value: failure
|
|
- name: TARGET_URL
|
|
value: https://console-openshift-console.apps.ocp.endofday.com/pipelines
|