Skip to content

Commit

Permalink
feat: Implement CI Voting Feature in Build Pipelines (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykola Serdiuk authored and SergK committed Dec 20, 2024
1 parent cdfc8a3 commit b546a88
Show file tree
Hide file tree
Showing 192 changed files with 3,197 additions and 1,375 deletions.
4 changes: 2 additions & 2 deletions charts/common-library/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ description: A Helm chart library with common components for KubeRocketCI Tekton
home: https://docs.kuberocketci.io
name: edp-tekton-common-library
type: library
version: 0.3.6
appVersion: 0.3.6
version: 0.3.7
appVersion: 0.3.7
icon: https://docs.kuberocketci.io/img/logo.svg
keywords:
- edp
Expand Down
2 changes: 1 addition & 1 deletion charts/common-library/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# edp-tekton-common-library

![Version: 0.3.6](https://img.shields.io/badge/Version-0.3.6-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: 0.3.6](https://img.shields.io/badge/AppVersion-0.3.6-informational?style=flat-square)
![Version: 0.3.7](https://img.shields.io/badge/Version-0.3.7-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: 0.3.7](https://img.shields.io/badge/AppVersion-0.3.7-informational?style=flat-square)
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/epmdedp)](https://artifacthub.io/packages/search?repo=epmdedp)

A Helm chart library with common components for KubeRocketCI Tekton Pipelines
Expand Down
110 changes: 103 additions & 7 deletions charts/common-library/templates/_common_bitbucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
- name: TARGET_URL
value: $(params.pipelineUrl)
- name: DESCRIPTION
value: "Managed by KubeRocketCI. Run with Tekton"
value: "Review Pipeline"
- name: STATE
value: "INPROGRESS"
- name: BITBUCKET_TOKEN_SECRET_NAME
value: ci-bitbucket
- name: BITBUCKET_TOKEN_SECRET_KEY
value: token
- name: KEY
value: "Review"
- name: NAME
value: "Pipeline"

- name: fetch-repository
taskRef:
Expand Down Expand Up @@ -55,6 +59,66 @@
{{- end -}}


# final section for bitbucket build pipelines
{{- define "bitbucket-build-vote" -}}
- name: bitbucket-set-success-status
when:
- input: "$(tasks.status)"
operator: in
values: ["Succeeded"]
taskRef:
kind: Task
name: bitbucket-set-status
params:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: SHA
value: "$(params.git-source-revision)"
- name: TARGET_URL
value: $(params.pipelineUrl)
- name: DESCRIPTION
value: "Build Pipeline"
- name: STATE
value: "SUCCESSFUL"
- name: BITBUCKET_TOKEN_SECRET_NAME
value: ci-bitbucket
- name: BITBUCKET_TOKEN_SECRET_KEY
value: token
- name: KEY
value: "Build"
- name: NAME
value: "Pipeline (PASSED)"

- name: bitbucket-set-failure-status
when:
- input: "$(tasks.status)"
operator: in
values: ["Failed"]
taskRef:
kind: Task
name: bitbucket-set-status
params:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: SHA
value: "$(params.git-source-revision)"
- name: TARGET_URL
value: $(params.pipelineUrl)
- name: DESCRIPTION
value: "Build Pipeline"
- name: STATE
value: "FAILED"
- name: BITBUCKET_TOKEN_SECRET_NAME
value: ci-bitbucket
- name: BITBUCKET_TOKEN_SECRET_KEY
value: token
- name: KEY
value: "Build"
- name: NAME
value: "Pipeline (FAILED)"
{{- end -}}


# final section for bitbucket codereview pipelines
{{- define "bitbucket-review-vote" -}}
finally:
Expand All @@ -74,13 +138,17 @@ finally:
- name: TARGET_URL
value: $(params.pipelineUrl)
- name: DESCRIPTION
value: "Build was successful"
value: "Review Pipeline"
- name: STATE
value: "SUCCESSFUL"
- name: BITBUCKET_TOKEN_SECRET_NAME
value: ci-bitbucket
- name: BITBUCKET_TOKEN_SECRET_KEY
value: token
- name: KEY
value: "Review"
- name: NAME
value: "Pipeline (PASSED)"

- name: bitbucket-set-failure-status
when:
Expand All @@ -91,24 +159,52 @@ finally:
kind: Task
name: bitbucket-set-status
params:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: SHA
value: "$(params.git-source-revision)"
- name: TARGET_URL
value: $(params.pipelineUrl)
- name: DESCRIPTION
value: "Review Pipeline"
- name: STATE
value: "FAILED"
- name: BITBUCKET_TOKEN_SECRET_NAME
value: ci-bitbucket
- name: BITBUCKET_TOKEN_SECRET_KEY
value: token
- name: KEY
value: "Review"
- name: NAME
value: "Pipeline (FAILED)"
{{- end -}}

# The init section for bitbucket build pipeline
{{- define "bitbucket-build-start" -}}
- name: bitbucket-set-pending-status
taskRef:
kind: Task
name: bitbucket-set-status
params:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: SHA
value: "$(params.git-source-revision)"
- name: TARGET_URL
value: $(params.pipelineUrl)
- name: DESCRIPTION
value: "Build has failed"
value: "Review Pipeline"
- name: STATE
value: "FAILED"
value: "INPROGRESS"
- name: BITBUCKET_TOKEN_SECRET_NAME
value: ci-bitbucket
- name: BITBUCKET_TOKEN_SECRET_KEY
value: token
{{- end -}}
- name: KEY
value: "Build"
- name: NAME
value: "Pipeline"

# The init section for bitbucket build pipeline
{{- define "bitbucket-build-start" -}}
- name: fetch-repository
taskRef:
kind: Task
Expand Down
100 changes: 97 additions & 3 deletions charts/common-library/templates/_common_github.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# The init section for github build pipeline
{{- define "github-build-start" -}}
- name: github-set-pending-status
taskRef:
kind: Task
name: github-set-status
params:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: DESCRIPTION
value: "Pipeline (IN PROGRESS)"
- name: STATE
value: "pending"
- name: CONTEXT
value: "Build Pipeline"
- name: AUTH_TYPE
value: Token
- name: GITHUB_TOKEN_SECRET_NAME
value: ci-github
- name: GITHUB_TOKEN_SECRET_KEY
value: token
- name: SHA
value: $(params.gitsha)
- name: TARGET_URL
value: $(params.pipelineUrl)

- name: fetch-repository
taskRef:
kind: Task
Expand Down Expand Up @@ -40,9 +64,11 @@
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: DESCRIPTION
value: "Build has started"
value: "Pipeline (IN PROGRESS)"
- name: STATE
value: "pending"
- name: CONTEXT
value: "Review Pipeline"
- name: AUTH_TYPE
value: Token
- name: GITHUB_TOKEN_SECRET_NAME
Expand Down Expand Up @@ -103,9 +129,11 @@ finally:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: DESCRIPTION
value: "Build was successful"
value: "Pipeline (PASSED)"
- name: STATE
value: "success"
- name: CONTEXT
value: "Review Pipeline"
- name: AUTH_TYPE
value: Token
- name: GITHUB_TOKEN_SECRET_NAME
Expand All @@ -129,9 +157,11 @@ finally:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: DESCRIPTION
value: "Build has failed"
value: "Pipeline (FAILED)"
- name: STATE
value: "failure"
- name: CONTEXT
value: "Review Pipeline"
- name: AUTH_TYPE
value: Token
- name: GITHUB_TOKEN_SECRET_NAME
Expand All @@ -143,3 +173,67 @@ finally:
- name: TARGET_URL
value: $(params.pipelineUrl)
{{- end -}}

{{- define "github-build-vote" -}}
- name: github-set-success-status
when:
- input: "$(tasks.status)"
operator: in
values: ["Succeeded"]
- input: $(params.gitsha)
operator: notin
values: ["$(tt.params.gitsha)"]
taskRef:
kind: Task
name: github-set-status
params:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: DESCRIPTION
value: "Pipeline (PASSED)"
- name: STATE
value: "success"
- name: CONTEXT
value: "Build Pipeline"
- name: AUTH_TYPE
value: Token
- name: GITHUB_TOKEN_SECRET_NAME
value: ci-github
- name: GITHUB_TOKEN_SECRET_KEY
value: token
- name: SHA
value: $(params.gitsha)
- name: TARGET_URL
value: $(params.pipelineUrl)

- name: github-set-failure-status
when:
- input: "$(tasks.status)"
operator: in
values: ["Failed"]
- input: $(params.gitsha)
operator: notin
values: ["$(tt.params.gitsha)"]
taskRef:
kind: Task
name: github-set-status
params:
- name: REPO_FULL_NAME
value: $(params.gitfullrepositoryname)
- name: DESCRIPTION
value: "Pipeline (FAILED)"
- name: STATE
value: "failure"
- name: CONTEXT
value: "Build Pipeline"
- name: AUTH_TYPE
value: Token
- name: GITHUB_TOKEN_SECRET_NAME
value: ci-github
- name: GITHUB_TOKEN_SECRET_KEY
value: token
- name: SHA
value: $(params.gitsha)
- name: TARGET_URL
value: $(params.pipelineUrl)
{{- end -}}
Loading

0 comments on commit b546a88

Please sign in to comment.