Skip to content

Commit

Permalink
chore: Migrate platform pipelines to Tekton (#48)
Browse files Browse the repository at this point in the history
Jira EPMDEDP-12735

Related #48

Change-Id: I87c81923ccbe187a2008f194ac4fa5a46306b684
  • Loading branch information
Oleksandr Taruraiev committed Oct 17, 2023
1 parent 2512341 commit 027d904
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{ if eq .Values.global.gitProvider "gerrit" }}
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: gerrit-platform-other-app-build-edp
labels:
{{- include "edp-custom-pipelines.labels" . | nindent 4 }}
spec:
workspaces:
- name: shared-workspace
- name: ssh-creds
params:
- name: pipelineUrl
default: https://tekton-{{ .Release.Namespace }}.{{ .Values.global.dnsWildCard }}/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)
type: string
- name: git-source-url
default: "https://github.com/epmd-edp/go-go-beego"
description: git url to clone
type: string
- name: git-source-revision
description: 'git revision to checkout (branch, tag, sha, ref…)'
default: "master"
type: string
- name: CODEBASE_NAME
default: "golang-go"
description: "Project name"
type: string
- name: CODEBASEBRANCH_NAME
description: "Codebasebranchname"
type: string
- name: changeNumber
description: "Change number from Merge Request"
- name: patchsetNumber
description: "Patchset number from Merge Request"
- name: TICKET_NAME_PATTERN
description: "Ticket name pattern"
default: ""
- name: COMMIT_MESSAGE_PATTERN
description: "Pattern to validate a commit message"
default: ""
- name: COMMIT_MESSAGE
description: "Commit message"
default: ""
- name: JIRA_ISSUE_METADATA_PAYLOAD
description: "Jira Payload"
default: ""
- name: JIRA_SERVER
description: "Jira server name"
default: ""
tasks:

{{- include "gerrit-build-start" . | nindent 4 }}

- name: get-version
taskRef:
kind: Task
name: get-version-edp
runAfter:
- init-values
params:
- name: CODEBASEBRANCH_NAME
value: $(params.CODEBASEBRANCH_NAME)

{{ include "finally-block-edp" . | nindent 2 }}

{{ include "send-to-microsoft-teams-build" . | nindent 4 }}

{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{ if eq .Values.global.gitProvider "gerrit" }}
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: gerrit-platform-other-app-review
labels:
{{- include "edp-custom-pipelines.labels" . | nindent 4 }}
spec:
workspaces:
- name: shared-workspace
- name: ssh-creds
params:
- name: pipelineUrl
default: https://tekton-{{ .Release.Namespace }}.{{ .Values.global.dnsWildCard }}/#/namespaces/$(context.pipelineRun.namespace)/pipelineruns/$(context.pipelineRun.name)
type: string
- name: git-source-url
default: "https://github.com/epmd-edp/go-go-beego"
description: git url to clone
type: string
- name: git-source-revision
description: 'git revision to checkout (branch, tag, sha, ref…)'
default: "edp"
type: string
- name: git-refspec
description: Refspec to fetch before checking out revision.
default: ""
type: string
- name: targetBranch
description: Target branch of Merge Request
- name: CODEBASE_NAME
default: "golang-go"
description: "Project name"
type: string
- name: COMMIT_MESSAGE
description: "Commit message"
- name: COMMIT_MESSAGE_PATTERN
description: "Pattern to validate a commit message"
tasks:

{{- include "gerrit-review-start" . | nindent 4 }}

- name: commit-validate
taskRef:
name: commit-validate
runAfter:
- fetch-repository
params:
- name: COMMIT_MESSAGE
value: $(params.COMMIT_MESSAGE)
- name: COMMIT_MESSAGE_PATTERN
value: $(params.COMMIT_MESSAGE_PATTERN)
workspaces:
- name: source
workspace: shared-workspace

{{ include "gerrit-review-vote" . | nindent 2 }}

{{ end }}
33 changes: 33 additions & 0 deletions charts/custom-pipelines/tests/test_edp-platform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from .helpers_custom import helm_template

def test_operator():
config = """
global:
gitProvider: gerrit
"""

ht = helm_template(config)
vcs = "gerrit"

review = f"{vcs}-platform-other-app-review"
build = f"{vcs}-platform-other-app-build-edp"

assert review in ht["pipeline"]
assert build in ht["pipeline"]

r = ht["pipeline"][review]["spec"]["tasks"]
assert "fetch-repository" in r[0]["name"]
assert "gerrit-notify" in r[1]["name"]
assert "init-values" in r[2]["name"]
assert "commit-validate" in r[3]["name"]
assert "gerrit-vote-success" in ht["pipeline"][review]["spec"]["finally"][0]["name"]
assert "gerrit-vote-failure" in ht["pipeline"][review]["spec"]["finally"][1]["name"]

b = ht["pipeline"][build]["spec"]["tasks"]
assert "fetch-repository" in b[0]["name"]
assert "gerrit-notify" in b[1]["name"]
assert "init-values" in b[2]["name"]
assert "get-version" in b[3]["name"]
assert "update-cbb" in ht["pipeline"][build]["spec"]["finally"][0]["name"]
assert "push-to-jira" in ht["pipeline"][build]["spec"]["finally"][1]["name"]
assert "send-to-microsoft-teams-failed" in ht["pipeline"][build]["spec"]["finally"][2]["name"]

0 comments on commit 027d904

Please sign in to comment.