mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 12:03:59 +00:00
- Add build-context helper to copy Docker context safely (ignore runtime data, keep symlinks) - Update UI and core actions to use ~/.prole/build and shared copy helper - Add/adjust tests and scripts; introduce knoe ops helpers and update manifests Co-authored-by: Junie <junie@jetbrains.com>
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from typing import Mapping
|
|
|
|
from .context import KnoeContext
|
|
from .process import check
|
|
|
|
|
|
def _env(ctx: KnoeContext, extra_env: Mapping[str, str] | None = None) -> dict[str, str]:
|
|
e = dict(os.environ)
|
|
e.update(ctx.env)
|
|
if extra_env:
|
|
e.update(dict(extra_env))
|
|
return e
|
|
|
|
|
|
def repo_add(ctx: KnoeContext, name: str, url: str) -> None:
|
|
check(["helm", "repo", "add", name, url], env=_env(ctx))
|
|
|
|
|
|
def repo_update(ctx: KnoeContext) -> None:
|
|
check(["helm", "repo", "update"], env=_env(ctx))
|
|
|
|
|
|
def upgrade_install(
|
|
ctx: KnoeContext,
|
|
release: str,
|
|
chart: str,
|
|
*,
|
|
namespace: str | None = None,
|
|
values_file: str | None = None,
|
|
extra_args: list[str] | None = None,
|
|
) -> None:
|
|
cmd: list[str] = ["helm", "upgrade", "--install", release, chart]
|
|
if namespace:
|
|
cmd += ["--namespace", namespace]
|
|
if values_file:
|
|
cmd += ["-f", values_file]
|
|
if extra_args:
|
|
cmd += list(extra_args)
|
|
check(cmd, env=_env(ctx))
|
|
|
|
|
|
def uninstall(ctx: KnoeContext, release: str, *, namespace: str | None = None) -> None:
|
|
cmd: list[str] = ["helm", "uninstall", release]
|
|
if namespace:
|
|
cmd += ["--namespace", namespace]
|
|
check(cmd, env=_env(ctx))
|