Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add lint and test to pipeline #87

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .tekton/events/route.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,24 @@ spec:
tls: {}
port:
targetPort: http-listener


---

kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: products
labels: {}
spec:
to:
kind: Service
name: products
tls:
termination: edge
insecureEdgeTerminationPolicy: ''
destinationCACertificate: ''
path: /
port:
targetPort: http

45 changes: 44 additions & 1 deletion .tekton/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
description: The reference (branch or ref)
name: GIT_REF
type: string
- default: '-vvv --processes=1 --run-coverage --minimum-coverage=95'
description: Arguments for green testing
name: GREEN_ARGS
type: string
- default: products
description: Name of the application
name: APP_NAME
Expand Down Expand Up @@ -68,6 +72,44 @@ spec:
- name: output
workspace: pipeline-workspace

- name: pylint
params:
- name: image
value: 'docker.io/rofrano/nyu-devops-base:fa23'
- name: path
value: service
- name: requirements_file
value: requirements.txt
- name: args
value: ["--max-line-length=127"]
- name: pip_conf_file
value: pip.conf
runAfter:
- git-clone
taskRef:
kind: Task
name: pylint
workspaces:
- name: source
workspace: pipeline-workspace

- name: testing
params:
- name: ARGS
value: $(params.GREEN_ARGS)
- name: SECRET_NAME
value: postgres-secret
- name: SECRET_KEY
value: database_uri
runAfter:
- git-clone
taskRef:
kind: Task
name: green
workspaces:
- name: source
workspace: pipeline-workspace

- name: buildah
params:
- name: IMAGE
Expand All @@ -92,7 +134,8 @@ spec:
- name: SKIP_PUSH
value: 'false'
runAfter:
- git-clone
- pylint
- testing
taskRef:
kind: ClusterTask
name: buildah
Expand Down
6 changes: 4 additions & 2 deletions .tekton/tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ spec:
- name: SECRET_NAME
description: The name of the secret containing a database_uri key
type: string
default: "postgres-creds"
default: "postgres-secret"
- name: SECRET_KEY
description: The name of the key that contains the database uri
type: string
default: "database_uri"
steps:
- name: green
image: python:3.11-slim
image: docker.io/rofrano/nyu-devops-base:fa23
workingDir: $(workspaces.source.path)
env:
- name: DATABASE_URI
Expand All @@ -49,8 +49,10 @@ spec:
pip install -qr requirements.txt

echo "***** Running Tests *****"
export PATH=/home/vscode/.local/bin:$PATH
green $(params.ARGS)


---
apiVersion: tekton.dev/v1beta1
kind: Task
Expand Down
Loading