Skip to main content

This willl take a bunch of tekton templates resource and compile it as a single entity, Pipelinerun.

Project description

Tekton resources Bundle

Codecov License PYPI

A CLI to go over a bunch of Tekton yaml resources and bundle them as one in a Pipelinerun and pipelineSpec/taskSpec. It optionally can get argument to replace in tempalates.

Install

pip3 install tektonbundle

and you are good to go!

pyyaml is really the external depencences here.

Usage

You only need to point the tool to some yaml files or a directory where it will collect every .yaml or .yml files in there and analyze them. It will then output the 'bundled' yaml file which you can pipe to kubectl create, i.e:

tektonbundle "/path/to/directory"|kubectl create -f-

Full help of the CLI is :

usage: tektonbundle [-h] [--skip-inlining SKIP_INLINING] [--only-bundled]
                    files [files ...] [parameters [parameters ...]]

positional arguments:
  files                 Files and/or directories where to get all the yaml files.
  parameters            Add parameters to pass to templates.

optional arguments:
  -h, --help            show this help message and exit
  --skip-inlining SKIP_INLINING
                        Skip inlining these tasks, you can add many of them separated by a comma.
  --only-bundled        Print only the files that have been bundled (tekton files) and skip others.

Description

If you have a Pipelinerun that looks like this :

---
apiVersion: tekton.dev/v1beta1
kind: Pipelinerun
metadata:
    name: pipeline-run
spec:
    pipelineRef:
        name: pipeline

and a Pipeline named pipeline1 that looks like this :

---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
    name: pipeline
spec:
    tasks:
    - name: task
      taskRef:
        name: task

and finally a task that looks like this :

---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: task
spec:
  steps:
    - name: step
      image: scratch

It will 'bundle' everything as one, using pipelineSpec and taskSpec:

apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  generateName: pipeline-run-
spec:
  pipelineSpec:
    tasks:
    - name: task
      taskSpec:
        steps:
        - image: scratch
          name: step

It will change the name as generateName to be unique.

You can skip some tasks to be inlined and be kept as referenced, you only have to specify the switch --skip-inlining with the name of the task to be skipped. You can add multiple of them separated by comma, i.e: --skip-inlining=task1,task2

By default tektonbundle will print every yaml files from the directory or files you have given even those that are not bundled (i.e: non tekton files). If you don't want this behavior you can add the option --only-bundled and it will only print the 'bundle' file.

Substition support via parameters.

tektonbundle support simple template substitions if you need to specify some value before applying.

If you have the string key: {{value}} in your template (no spaces in between).

And you launch the CLI with this arguments :

tektonbundle /path/to/dir value="hello"

The value of the template would be substited with the value you have provided.

If no value has been provided, it will be kept as is (you will end up with a key: {{value}} in your template).

======= History

0.3.0 (2020-12-11)

Print ignored files too Allow passing files instead of just directory

0.1.0 (2020-10-20)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tektonbundle-0.3.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

tektonbundle-0.3.0-py2.py3-none-any.whl (7.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tektonbundle-0.3.0.tar.gz.

File metadata

  • Download URL: tektonbundle-0.3.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for tektonbundle-0.3.0.tar.gz
Algorithm Hash digest
SHA256 75b402a9b2050095ae0c4a9880668dc107dc3bb6ae1c257242100f4ad9611034
MD5 b60793656dd1869cf5828612e23c055c
BLAKE2b-256 09d711b3540f7479e65826eb9b27a9305a20057567a1e4779f333c7f4bfca14b

See more details on using hashes here.

File details

Details for the file tektonbundle-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: tektonbundle-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for tektonbundle-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e16eda9a997429ab671fa8bcd35276e378e5519e6a73960937d5be04cd03a713
MD5 d2a0f9919abab88c2f5a8cf310c9b3d7
BLAKE2b-256 d5b3a71f144de69002f3d14929982af1654bc6e61f0b28b1fdda82559315c8d3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page