Skip to main content

Reusable workflow blocks for CUTIP — container, SSH, k8s, file, and more

Project description

cutip-blocks

Python 3.11+ License: MIT cutip

Reusable workflow blocks for CUTIP — Container Unit Templates in Python.

Each block is a decorated Python function that maps to a single CLI operation (kubectl, ssh, cp, etc.). Blocks execute at runtime and provide metadata for cutip-desktop DAG visualization.

Installation

pip install cutip-blocks

Block Categories

Category Blocks Maps to
container start, stop, remove, exec, exec_stream podman/docker
ssh session, exec, probe ssh/paramiko
file copy, copy_tree, read_yaml, write_yaml, read_json, write_json, replace, is_empty filesystem
k8s get_deployment, get_secret, get_pod, exec, cp, apply, patch_deployment, rollout_status kubectl
crictl image_ls, image_rm, image_import crictl/ctr
download http_fetch HTTP GET
config render_template, substitute_vars template rendering
validate path_exists, env_var_set, ip_valid precondition checks
service poll_until_ready, wait_for_exit readiness polling

Usage

from cutip.workflow import action, orchestrator, stage
from cutip_blocks.blocks import container, ssh, k8s

@action(name="Check Deployment")
def check_deploy(ctx, sesh, ns, deploy):
    k8s.get_deployment(ctx, sesh, namespace=ns, deployment=deploy)

@orchestrator
def main(ctx):
    container.start(ctx, container="my-app")

    with ssh.session(ctx, container="my-app",
                     host="10.0.0.1", username="root",
                     password=ctx.config["password"]) as sesh:

        stage("Validation")
        check_deploy(ctx, sesh, "default", "web")

        stage("Operations")
        k8s.apply(ctx, sesh, file="/tmp/patch.yaml")

    container.stop(ctx, container="my-app")

SSH Session

All SSH-based blocks share a persistent connection via context manager. One SSH handshake, reused for all commands. Credentials are redacted in all log output.

INFO | [Get Deployment] ssh root@10.0.0.1 :: kubectl get deployment -n default web -o name
INFO | [Get Secret] ssh root@10.0.0.1 :: kubectl get secret -n ns creds -o name

Block Discovery

from cutip_blocks import BlockRegistry

registry = BlockRegistry.discover()
for meta, fn in registry.blocks:
    print(f"{meta.category}.{meta.action}{meta.name}")

License

MIT

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

cutip_blocks-0.1.1.tar.gz (87.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cutip_blocks-0.1.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file cutip_blocks-0.1.1.tar.gz.

File metadata

  • Download URL: cutip_blocks-0.1.1.tar.gz
  • Upload date:
  • Size: 87.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cutip_blocks-0.1.1.tar.gz
Algorithm Hash digest
SHA256 48ddc15eb80f36d414151c1e9b39b17e499205bbea14afd4e9d373716e06f973
MD5 f2337b0863865a06e951ae730e5234a1
BLAKE2b-256 cc316d78b5dc18933a933e26996a206d9c3e8025d26b3c89f992aadf5f925652

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutip_blocks-0.1.1.tar.gz:

Publisher: release.yml on joshuajerome/cutip-blocks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cutip_blocks-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cutip_blocks-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cutip_blocks-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c4e9d6ac52d9bc5ac859d657fe366ab91567ec2ef912ed4fceffe42708cfb9c
MD5 8aba17fd6a7ce2b0c2c51fc343ede767
BLAKE2b-256 cda502c83490fa0a8a84bdd934e3b12b2a5284740bd3cb6a4f8ce497f3c055ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutip_blocks-0.1.1-py3-none-any.whl:

Publisher: release.yml on joshuajerome/cutip-blocks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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