Skip to content

Commit

Permalink
refactor: Introduce EDP specific task for fastapi flow (#68)
Browse files Browse the repository at this point in the history
Consolidate 'compile', 'test' tasks under single task with
name 'edp-fastapi' and put them as steps.
This task is fully EDP opinionated, if you want to use more
generalized task, continue using baseline 'python'

Signed-off-by: Sergiy Kulanov <[email protected]>
Change-Id: Ic6aa864b6ce389a37fa2008dd2bbdc6a5f733007
  • Loading branch information
SergK committed Nov 9, 2023
1 parent 2b789a5 commit 6a62adb
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,48 +81,12 @@ spec:

{{ include "security" . | nindent 4 }}

- name: test
- name: python
taskRef:
kind: Task
name: python
name: edp-fastapi
runAfter:
- security
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pytest -sv --color=yes
workspaces:
- name: source
workspace: shared-workspace

- name: lint
taskRef:
kind: Task
name: python
runAfter:
- test
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pylint --output-format=colorized *.py
flake8 --exclude .local --filename=*.py
workspaces:
- name: source
workspace: shared-workspace

- name: compile
taskRef:
kind: Task
name: python
runAfter:
- lint
params:
- name: EXTRA_COMMANDS
value: |
set -ex
python setup.py clean build install --user
workspaces:
- name: source
workspace: shared-workspace
Expand All @@ -133,7 +97,7 @@ spec:
name: sonarqube-scanner
runAfter:
- sonar-cleanup
- compile
- python
params:
- name: SONAR_PROJECT_KEY
value: $(params.CODEBASEBRANCH_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,48 +78,12 @@ spec:

{{ include "security" . | nindent 4 }}

- name: test
- name: python
taskRef:
kind: Task
name: python
name: edp-fastapi
runAfter:
- security
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pytest -sv --color=yes
workspaces:
- name: source
workspace: shared-workspace

- name: lint
taskRef:
kind: Task
name: python
runAfter:
- test
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pylint --output-format=colorized *.py
flake8 --exclude .local --filename=*.py
workspaces:
- name: source
workspace: shared-workspace

- name: compile
taskRef:
kind: Task
name: python
runAfter:
- lint
params:
- name: EXTRA_COMMANDS
value: |
set -ex
python setup.py clean build install --user
workspaces:
- name: source
workspace: shared-workspace
Expand All @@ -130,7 +94,7 @@ spec:
name: sonarqube-scanner
runAfter:
- sonar-cleanup
- compile
- python
params:
- name: SONAR_PROJECT_KEY
value: $(params.CODEBASEBRANCH_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,12 @@ spec:

{{- include "helm-docs" $ | nindent 4 }}

- name: test
- name: python
taskRef:
kind: Task
name: python
name: edp-fastapi
runAfter:
- init-values
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pytest -sv --color=yes
workspaces:
- name: source
workspace: shared-workspace

- name: lint
taskRef:
kind: Task
name: python
runAfter:
- test
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pylint --output-format=colorized *.py
flake8 --exclude .local --filename=*.py
workspaces:
- name: source
workspace: shared-workspace
Expand All @@ -86,7 +65,7 @@ spec:
kind: Task
name: git-cli
runAfter:
- lint
- python
params:
- name: GIT_USER_EMAIL
value: [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,48 +79,12 @@ spec:

{{ include "security" . | nindent 4 }}

- name: test
- name: python
taskRef:
kind: Task
name: python
name: edp-fastapi
runAfter:
- security
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pytest -sv --color=yes
workspaces:
- name: source
workspace: shared-workspace

- name: lint
taskRef:
kind: Task
name: python
runAfter:
- test
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pylint --output-format=colorized *.py
flake8 --exclude .local --filename=*.py
workspaces:
- name: source
workspace: shared-workspace

- name: compile
taskRef:
kind: Task
name: python
runAfter:
- lint
params:
- name: EXTRA_COMMANDS
value: |
set -ex
python setup.py clean build install --user
workspaces:
- name: source
workspace: shared-workspace
Expand All @@ -130,7 +94,7 @@ spec:
kind: Task
name: sonarqube-scanner
runAfter:
- compile
- python
params:
- name: SONAR_PROJECT_KEY
value: $(params.CODEBASEBRANCH_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,48 +72,12 @@ spec:

{{ include "security" . | nindent 4 }}

- name: test
- name: python
taskRef:
kind: Task
name: python
name: edp-fastapi
runAfter:
- security
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pytest -sv --color=yes
workspaces:
- name: source
workspace: shared-workspace

- name: lint
taskRef:
kind: Task
name: python
runAfter:
- test
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pylint --output-format=colorized *.py
flake8 --exclude .local --filename=*.py
workspaces:
- name: source
workspace: shared-workspace

- name: compile
taskRef:
kind: Task
name: python
runAfter:
- lint
params:
- name: EXTRA_COMMANDS
value: |
set -ex
python setup.py clean build install --user
workspaces:
- name: source
workspace: shared-workspace
Expand All @@ -123,7 +87,7 @@ spec:
kind: Task
name: sonarqube-scanner
runAfter:
- compile
- python
params:
- name: SONAR_PROJECT_KEY
value: $(params.CODEBASEBRANCH_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,12 @@ spec:

{{- include "helm-docs" $ | nindent 4 }}

- name: test
- name: python
taskRef:
kind: Task
name: python
name: edp-fastapi
runAfter:
- init-values
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pytest -sv --color=yes
workspaces:
- name: source
workspace: shared-workspace

- name: lint
taskRef:
kind: Task
name: python
runAfter:
- test
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pylint --output-format=colorized *.py
flake8 --exclude .local --filename=*.py
workspaces:
- name: source
workspace: shared-workspace
Expand All @@ -91,7 +70,7 @@ spec:
kind: Task
name: sonarqube-scanner
runAfter:
- test
- python
params:
- name: SONAR_PROJECT_KEY
value: $(params.CODEBASEBRANCH_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,48 +75,12 @@ spec:

{{ include "security" . | nindent 4 }}

- name: test
- name: python
taskRef:
kind: Task
name: python
name: edp-fastapi
runAfter:
- security
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pytest -sv --color=yes
workspaces:
- name: source
workspace: shared-workspace

- name: lint
taskRef:
kind: Task
name: python
runAfter:
- test
params:
- name: EXTRA_COMMANDS
value: |
pip3 install -r test-requirements.txt
pylint --output-format=colorized *.py
flake8 --exclude .local --filename=*.py
workspaces:
- name: source
workspace: shared-workspace

- name: compile
taskRef:
kind: Task
name: python
runAfter:
- lint
params:
- name: EXTRA_COMMANDS
value: |
set -ex
python setup.py clean build install --user
workspaces:
- name: source
workspace: shared-workspace
Expand All @@ -126,7 +90,7 @@ spec:
kind: Task
name: sonarqube-scanner
runAfter:
- compile
- python
params:
- name: SONAR_PROJECT_KEY
value: $(params.CODEBASEBRANCH_NAME)
Expand Down
Loading

0 comments on commit 6a62adb

Please sign in to comment.