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.0.tar.gz (70.2 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.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cutip_blocks-0.1.0.tar.gz
  • Upload date:
  • Size: 70.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cutip_blocks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a0a868779359f22f0f1bcb350d3d2e968dc206afa5560e4dce8d284eadbc833
MD5 ac8d8e0767ccb5994919943a1391e59a
BLAKE2b-256 e215a72b4ab9fbb7830f9ebd35d9b9a40009b2f3e2479de4146d3e347f8be48f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cutip_blocks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cutip_blocks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84b920778c217fd12dfc6fa49804c021d1ee992548ca4c8a4bb85782bd6d3cde
MD5 450c92b2c2a5eab9eb138aa473d11d12
BLAKE2b-256 d1258c46b796817cbc8fb4d76efe82223b622682f5c5121e5bfeeb4582bf6ba5

See more details on using hashes here.

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