1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-25 06:17:50 +00:00
catalog/task/upload-pypi/0.1
Yulia Gaponenko f4708d478e Add linux/amd64 platform annotation to the rest of the tasks
At this moment all tasks which can be executed on linux/s390x or
linux/ppc64le are tested and labelled accordingly.
The rest of the tasks can be labelled as `linux/amd64`, which
is default platform and where tasks are already tested via
default PR testing cycle.

Signed-off-by: Yulia Gaponenko <yulia.gaponenko1@de.ibm.com>
2021-10-29 17:08:38 +01:00
..
samples Fixes and improvements to the upload-pypi Task. 2020-07-31 10:48:03 +01:00
README.md Add linux/amd64 platform annotation to the rest of the tasks 2021-10-29 17:08:38 +01:00
upload-pypi.yaml Add linux/amd64 platform annotation to the rest of the tasks 2021-10-29 17:08:38 +01:00

Publish-Python-Package

This Task publishes Python packages to PyPI index using Twine utility module. It provides build system independent uploads of source and binary distribution artifacts for both new and existing projects.

Install the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/v1beta1/task/upload-pypi/0.1/upload-pypi.yaml

Requirement

Secret is needed with Twine credentials(TWINE_USERNAME:TWINE_PASSWORD) to be provided for python module publishing to PyPI index.

  • username: The username to authenticate to the repository (package index).
  • password: The password to authenticate to the repository (package index).
apiVersion: v1
kind: Secret
metadata:
  name: pypi-secret
type: kubernetes.io/basic-auth
stringData:
  username: foo
  password: bar

Workspaces

  • source: A Workspace containing the source to build.

Platforms

The Task can be run on linux/amd64 platform.

Usage

This TaskRun runs the Task to fetch a Git repo, and build and publishes a python module.

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: publish-package
spec:
  taskRef:
    name: upload-pypi
  workspaces:
  - name: source
    persistentVolumeClaim:
      claimName: my-source

In this example, the Git repo being used is expected to have a setup.py file at the root of the repository. setup.py is build script for setuptools

This TaskRun outputs several Results:

  • A sha256 hash for each uploaded file (the bdist and the sdist packages).
  • The name of the uploaded package
  • The version of the uploaded package

This looks like:

  taskResults:
  - name: bdist_sha
    value: 97dd35b7097443b6896734d979a1a52c64023f17474e4027d69d2df0b9acb797  dist/foo.whl
  - name: package_name
    value: foo
  - name: package_version
    value: 2.24.4
  - name: sdist_sha
    value: 8fda69bc68ece690d135d0091ebdd10a8c15db477c2eafce0d0a65bc9712f5bf  dist/foo.tar.gz