tekton-hub/tasks/pytest/task.yaml
2025-04-08 22:03:19 +00:00

50 lines
1.2 KiB
YAML

apiVersion: tekton.dev/v1
kind: Task
metadata:
name: pytest
namespace: gitops-ci
labels:
app.kubernetes.io/version: "0.2"
annotations:
tekton.dev/pipelines.minVersion: "0.56.1"
tekton.dev/displayName: "pytest"
tekton.dev/categories: Developer Tools
tekton.dev/tags: pytest
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
These tasks make it possible to use pytest within your Tekton pipelines
pytest is a tool for testing configuration files using Open Policy Agent.
workspaces:
- name: source
params:
- name: BASE_IMAGE
description: |
The base image for the task.
type: string
default: python:3.13.2-bullseye
- name: VERBOSE
description: Log the commands that are executed during operation.
type: string
default: "true"
steps:
- name: pytest
image: $(params.BASE_IMAGE)
workingDir: $(workspaces.source.path)
env:
- name: PARAM_VERBOSE
value: $(params.VERBOSE)
script: |
#!/usr/bin/env sh
set -eu
if [ "${PARAM_VERBOSE}" = "true" ] ; then
set -x
fi
pip install -U pytest
pytest