tekton-hub/tasks/poetry/task.yaml
2025-04-07 23:23:27 +00:00

70 lines
1.6 KiB
YAML

---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: poetry
labels:
app.kubernetes.io/version: "0.4"
annotations:
tekton.dev/pipelines.minVersion: "0.21.0"
tekton.dev/categories: Poetry
tekton.dev/tags: poetry
tekton.dev/displayName: "poetry"
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le"
spec:
description: >-
This task can be used to perform python poetry operations.
python poetry command that needs to be run can be passed as a script to
the task.
workspaces:
- name: source
description: A workspace that contains python source.
params:
- name: BASE_IMAGE
description: |
The base image for the task.
type: string
default: python:3.13.2-bullseye
- name: POETRY_VERSION
description: |
The base version of the poetry.
type: string
default: 2.1.2
- name: POETRY_SCRIPT
description: The poetry and python script to run.
type: string
default: |
poetry help
- name: VERBOSE
description: Log the commands that are executed during operation.
type: string
default: "true"
steps:
- name: poetry
image: $(params.BASE_IMAGE)
workingDir: $(workspaces.source.path)
env:
- name: POETRY_VERSION
value: $(params.POETRY_VERSION)
- name: PARAM_VERBOSE
value: $(params.VERBOSE)
script: |
#!/usr/bin/env sh
set -eu
if [ "${PARAM_VERBOSE}" = "true" ] ; then
set -x
fi
pipx install poetry==${POETRY_VERSION}
export PATH="$HOME/.local/bin:$PATH"
eval '$(params.POETRY_SCRIPT)'