charts/pipelines-library/templates/pipelines/python/flask/bitbucket-review.yaml (131 lines of code) (raw):
{{ if has "bitbucket" .Values.global.gitProviders }}
{{ if or ( .Values.pipelines.deployableResources.python.flask ) ( .Values.pipelines.deployableResources.python.fastapi ) }}
{{- $raw := include "edp-tekton.resourceMapping.python" . | trimAll "[]" -}}
{{- $resources := $raw | split " " -}}
{{- range $framework := $resources }}
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: bitbucket-python-{{ $framework }}-app-review
labels:
app.edp.epam.com/pipelinetype: review
{{- include "edp-tekton.labels" $ | nindent 4 }}
spec:
description: "The Review pipeline for building {{ $framework }}"
workspaces:
- name: shared-workspace
- name: ssh-creds
params:
- name: pipelineUrl
default: https://portal-{{ $.Release.Namespace }}.{{ $.Values.global.dnsWildCard }}/c/main/pipelines/$(context.pipelineRun.namespace)/$(context.pipelineRun.name)
type: string
- name: git-source-url
default: "https://github.com/epmd-edp/python-python-python-3.8"
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: changeNumber
description: Change number from Merge Request
default: ""
type: string
- name: targetBranch
description: Target branch of Merge Request
default: ""
type: string
- name: CODEBASE_NAME
default: "python-app"
description: "Project name"
type: string
- name: CODEBASEBRANCH_NAME
description: "Codebasebranch name"
type: string
- name: gitfullrepositoryname
description: "repository full name"
type: string
- name: CHART_DIR
description: "Deploy templates directory for helm-lint"
default: "deploy-templates"
- name: CT_CONFIGS_DIR
description: "ct-configs directory for helm-lint"
default: "."
tasks:
{{- include "bitbucket-review-start" $ | nindent 4 }}
{{- include "helm-docs" $ | nindent 4 }}
{{- include "get-cache" $ | nindent 4 }}
- name: build
taskRef:
kind: Task
name: python
runAfter:
- get-cache
params:
- name: EXTRA_COMMANDS
value: |
# we checkout the source code in the /source directory
# and hold cache in the /cache directory
# build
python setup.py clean build sdist bdist_wheel
# lint
pip3 install -r test-requirements.txt
pylint --output-format=colorized *.py
flake8 --exclude .local --filename=*.py
# test
pytest -sv --color=yes
workspaces:
- name: source
workspace: shared-workspace
- name: sonar
taskRef:
kind: Task
name: sonarqube-general
runAfter:
- build
params:
- name: SONAR_PROJECT_KEY
value: $(params.CODEBASE_NAME)
- name: SONAR_PROJECT_NAME
value: $(params.CODEBASE_NAME)
- name: target-branch
value: $(params.targetBranch)
- name: source-branch
value: $(params.git-source-revision)
- name: key-id
value: $(params.changeNumber)
workspaces:
- name: source
workspace: shared-workspace
subPath: source
- name: dockerfile-lint
taskRef:
kind: Task
name: hadolint
runAfter:
- sonar
workspaces:
- name: source
workspace: shared-workspace
subPath: source
{{ include "dockerbuild-verify-python" $ | nindent 4 }}
- name: helm-lint
taskRef:
kind: Task
name: helm-lint
runAfter:
- sonar
params:
- name: CHART_DIR
value: $(params.CHART_DIR)
- name: CT_CONFIGS_DIR
value: $(params.CT_CONFIGS_DIR)
workspaces:
- name: source
workspace: shared-workspace
subPath: source
{{- include "save-cache" $ | nindent 4 }}
{{ include "bitbucket-review-vote" $ | nindent 2 }}
---
{{- end }}
{{ end }}
{{ end }}