Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
a45bfbe
Add first iteration of a base PoC for CH model
aranega Sep 23, 2026
45ed8f7
Add missing entries in the deploy config and wire them in the skaffol…
aranega Sep 23, 2026
18aa16c
Refactor the access to the template files
aranega Sep 23, 2026
042dd4c
Add first iteration of the new codefresh generation
aranega Sep 23, 2026
17ee3e5
Add new fields in the deployment config and wire them in codefresh/sk…
aranega Sep 23, 2026
a94ea8c
Expose "exists" as method on CHDockerfile
aranega Sep 23, 2026
ee5c372
Add new CHAppDefault concept to catch up with merging logic for tasks…
aranega Sep 23, 2026
f2f513a
Add first tests for the new model
aranega Sep 23, 2026
16ca77b
Add CHBaseImage concept
aranega Sep 24, 2026
fd4e044
Introduce CHContext for the build artifact skaffold generation
aranega Sep 24, 2026
a22354c
Fix missing tasks dependencies
aranega Sep 24, 2026
db18b74
Add new tests covering skaffold generation
aranega Sep 24, 2026
33bfecd
Fix tasks resolution
aranega Sep 28, 2026
c7e34d8
Add Dockerfile env dependent
aranega Sep 29, 2026
82778dc
Add all_images and build_options for dockerfiles
aranega Sep 29, 2026
8ea87da
Add multi-env support from config
aranega Sep 29, 2026
520a1df
Add entrypoint parsing and primitive docker parser (might be removed …
aranega Sep 29, 2026
2ee83c8
Add git-dependencies support
aranega Sep 29, 2026
3758b78
Add missing build dependencies walk for skaffold generation
aranega Sep 29, 2026
5857925
Add skaffold documentation at the top of the module
aranega Sep 30, 2026
7a16df1
Add values-template merge per app
aranega Sep 30, 2026
bfd7b45
Split tests for the NG version
aranega Sep 30, 2026
ffd6237
Add higher-level all_values that merges options from the cmd line int…
aranega Sep 30, 2026
8aac829
Add multi-project support
aranega Oct 1, 2026
811998e
Fix merge order for the raw_values and all_values at the project level
aranega Oct 1, 2026
bae71d6
Add compat tests
aranega Oct 1, 2026
7b6f05f
Add output_path support for plugins/skaffold/codefresh
aranega Oct 1, 2026
224db53
Fix all_source_images to consider only involved apps
aranega Oct 1, 2026
22cc0cc
Add context merge
aranega Oct 1, 2026
e1e6c34
Add helm chart generation and refactor of all_values default entries …
aranega Oct 5, 2026
d988eae
Add new tests for the Helm Chart generation
aranega Oct 5, 2026
b0f7be9
Extract collect build dependencies and add it to the model
aranega Oct 5, 2026
32c065c
Add helm chart path merging (templates and other files)
aranega Oct 5, 2026
3b0f544
Add dirhash logic
aranega Oct 5, 2026
4dafff1
Add tests for the secrets
aranega Oct 5, 2026
264ad1e
Fix wrong resolution in skaffold and NG model for overrides
aranega Oct 7, 2026
14ba827
Adapt test data to match CH logic
aranega Oct 7, 2026
ac5dc98
Add CHTest(X) concepts
aranega Oct 8, 2026
7cde478
Add build-arg dependency wiring
aranega Oct 8, 2026
849f86e
Add git-dependencies computation for codefresh
aranega Oct 8, 2026
90dda6e
Add rollout-wait commands for codefresh code generation
aranega Oct 8, 2026
04d0940
Add api/e2e test steps
aranega Oct 8, 2026
199c510
Fix codefresh generation in the wrong root
aranega Oct 8, 2026
4af81fd
Add env-var file production and var string substitution
aranega Oct 8, 2026
4f97a9b
Add parallel-step batching + stage ordering
aranega Oct 9, 2026
6e61a20
Add build registry on stage for codefresh
aranega Oct 9, 2026
3d7586f
Add publish step in codefresh generation
aranega Oct 9, 2026
e522fd4
Add when clause to avoid rebuilding in some occasion for codefresh
aranega Oct 9, 2026
7f47f8e
Add secret collection for codefresh
aranega Oct 9, 2026
87f0142
Fix build+publish for apps with an explicity image entry
aranega Oct 9, 2026
6155ad6
Add pruning of unecessary steps in codefresh
aranega Oct 9, 2026
d05c0e0
Add gating of downstream build related step if an image is already pr…
aranega Oct 9, 2026
3de3e0c
Fig tag image
aranega Oct 9, 2026
c04cc7f
Fix namespace set unconditionally in the config
aranega Oct 12, 2026
18a10a4
Add tests for step ordering
aranega Oct 12, 2026
9ef0858
Add secrets handling in codefresh
aranega Oct 12, 2026
4ca07bd
Fix issue while computing all the images
aranega Oct 12, 2026
f66c94a
Fix working directory for codefresh generation
aranega Oct 12, 2026
33fd9bd
Add last missing tests for codefresh
aranega Oct 12, 2026
a597cb2
Add last missing test to close codefresh generation
aranega Oct 12, 2026
3bce7a2
Fix issue with REGISTRY not being picked up properly for codefresh
aranega Oct 12, 2026
964d7f4
Move Helm Chart generation in its own file
aranega Oct 12, 2026
c1055c6
Add codefresh algo explanation
aranega Oct 12, 2026
e288699
Add host_info implementation and tests
aranega Oct 12, 2026
5a870a3
Simplify by removing some @lru_cache
aranega Oct 13, 2026
8424458
Add VSCode debug config generation
aranega Oct 13, 2026
5739837
Change signature of some part of the api to make it clearer to get
aranega Oct 13, 2026
f7892ae
Add validation for values extracted by CHProject
aranega Oct 13, 2026
79788a8
Add test helper to create folder/file structures
aranega Oct 13, 2026
6269c60
Port ng tests using new helper lib
aranega Oct 13, 2026
7608d20
Improve dirhash computation for codefresh
aranega Oct 13, 2026
017cf42
Add tilt configuration generation
aranega Oct 13, 2026
9e60db2
Add perform_migration (copy fromo the original)
aranega Oct 13, 2026
16ee475
Add missing template file for tilt
aranega Oct 14, 2026
0361cec
Add port of "migration"
aranega Oct 14, 2026
e140b9d
Add first docker compose implementation
aranega Oct 14, 2026
6fe7e37
Update tests formatting
aranega Oct 14, 2026
34448aa
Extract write_on_disk as class method
aranega Oct 14, 2026
e5b1d90
Merge branch 'develop' of github.com:MetaCell/cloud-harness into poc/…
aranega Oct 14, 2026
e13c10e
Adapt tests for with the new develop
aranega Oct 14, 2026
53b7cfd
Add App Instances management in NG
aranega Oct 14, 2026
2d043ea
Add image ref support
aranega Oct 14, 2026
7cae9de
Port missing tests for the new features from develop
aranega Oct 14, 2026
ca9cef1
Add missing tests for instance apps
aranega Oct 14, 2026
0c6979d
Fix linting
aranega Oct 14, 2026
961f54b
Fix CodeQL recommendations
aranega Oct 14, 2026
c0698db
Apply recommendations of CodeQL
aranega Oct 14, 2026
323b8e5
Add docstrings where it matters
aranega Oct 15, 2026
4ce1c32
Switch from legacy setup.py/requirements.txt to pyproject.toml
aranega Oct 15, 2026
0c951d6
Add documentation about entities for the new NG model
aranega Oct 15, 2026
2f61a21
Fix trailing comma issue with json parsing (vscode support)
aranega Oct 15, 2026
6b8afa8
Add special "dev" in pyproject.toml for dev deps
aranega Oct 15, 2026
1cfd220
Fix relative folder computation in the codefresh generator
aranega Oct 15, 2026
26ad494
Improve performances with new dep for sh1 computation
aranega Oct 15, 2026
0d98a92
Removing script which is only used locally
aranega Oct 15, 2026
9350567
Add missing dep for tests
aranega Oct 15, 2026
9c5240c
Fix wrong path computation
aranega Oct 15, 2026
fb4a0fd
Rename method and make CHProject and CHApp polymorphic
aranega Oct 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tools/deployment-cli-tools/ch_cli_tools/ng/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Imported for their @register_file side effect, not for re-export.
from . import codefresh, dockercompose, helm, skaffold, tilt, vscode # noqa: F401
from .model import CHDeployConfig, CHProject

__all__ = [
"CHDeployConfig",
"CHProject",
]
258 changes: 258 additions & 0 deletions tools/deployment-cli-tools/ch_cli_tools/ng/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
"""High-level, user/script-facing deployment generation entry points.

This is the surface `harness-deployment` (and any other script) actually calls
- one function per legacy top-level entry point in ch_cli_tools/{helm,
dockercompose,configurationgenerator,skaffold,tilt,codefresh,preprocessing,
migration,utils}.py. Signatures mirror the legacy ones so the existing tests
for each (tests/test_helm.py, tests/test_skaffold.py, etc.) can be retargeted
at these once implemented, instead of rewritten.

First pass: signatures only, `pass` bodies. Implementation comes later, backed
by CHProject/CHDeployConfig and the rest of the ng model instead of the legacy
ConfigurationGenerator/HarnessMainConfig machinery.
"""

import logging
import subprocess
from pathlib import Path

from ch_cli_tools.utils import get_cluster_ip # type: ignore

from . import migration
from .model import CHDeployConfig, CHProject

# --- ch_cli_tools/helm.py ---


def create_helm_chart(
root_paths,
tag=None,
registry="",
local=True,
domain=None,
exclude=(),
secured=True,
output_path="./deployment",
include=None,
registry_secret_name=None,
tls=True,
env=None,
namespace=None,
name=None,
chart_version=None,
app_version=None,
):
root_paths = list(root_paths)

config_kwargs = {
"includes": list(include or []),
"excludes": list(exclude or []),
"registry": registry,
"tag": str(tag) if tag is not None else None,
"local": local,
"namespace": namespace,
"registry_secret_name": registry_secret_name,
"output_path": output_path,
"tls": tls,
"secured_gatekeepers": secured,
"chart_name": name,
"chart_version": chart_version,
"app_version": app_version,
}
if env:
config_kwargs["env"] = env
if domain:
config_kwargs["domain"] = domain

config = CHDeployConfig(**config_kwargs)
project = CHProject.init(root_paths, config=config)
project.helm_chart.generate()
return project.build_final_helm_values()


def deploy(namespace, output_path="./deployment"):
helm_path = Path(output_path) / "helm"
logging.info("Deploying helm chart %s", helm_path)
subprocess.run("helm dependency update".split(), cwd=helm_path)
subprocess.run(
f"helm upgrade {namespace} {helm_path} -n {namespace} --install --reset-values".split()
)


# --- ch_cli_tools/dockercompose.py ---


def create_docker_compose_configuration(
root_paths,
tag=None,
registry="",
local=True,
domain=None,
exclude=(),
secured=True,
output_path="./deployment",
include=None,
registry_secret_name=None,
tls=True,
env=None,
namespace=None,
):
root_paths = list(root_paths)

config_kwargs = {
"includes": list(include or []),
"excludes": list(exclude or []),
"registry": registry,
"tag": str(tag) if tag is not None else None,
"local": local,
"namespace": namespace,
"registry_secret_name": registry_secret_name,
"output_path": output_path,
"tls": tls,
"secured_gatekeepers": secured,
"backend": "compose",
}
if env:
config_kwargs["env"] = env
if domain:
config_kwargs["domain"] = domain

project = CHProject.init(root_paths, config=CHDeployConfig(**config_kwargs))
project.docker_compose.generate()
return project.build_final_helm_values()


# --- ch_cli_tools/configurationgenerator.py ---


def hosts_info(values):
apps = [app for app in values.apps.values() if app.harness]

subdomains = [app.harness.subdomain for app in apps if app.harness.subdomain] + [
alias for app in apps if app.harness.aliases for alias in app.harness.aliases
]

logging.info("\nTo run locally some apps, also those references may be needed")
for app in apps:
if not app.harness.service:
continue
service = app.harness.service
print(
f"kubectl port-forward -n {values.namespace} service/{service.name} "
f"{service.port}:{service.port}"
)

hosts = [
f"{app.harness.service.name}.{values.namespace}"
for app in apps
if app.harness.service
]
print(f"127.0.0.1\t{' '.join(hosts)}")

try:
ip = get_cluster_ip(local=values.local)
except Exception:
logging.warning("Cannot get cluster ip")
ip = "127.0.0.1"
logging.info(
"\nTo test locally, update your hosts file" +
f"\n{ip}\t{values.domain + ' ' + ' '.join(sd + '.' + values.domain for sd in subdomains)}"
)


# --- ch_cli_tools/skaffold.py ---
# create_skaffold_configuration's replacement already exists as
# ng.skaffold.CHSkaffold.generate() - this stub is only about matching the
# legacy call convention (root_paths/helm_values) so the old tests can drive it.


def create_skaffold_configuration(
root_paths,
helm_values,
output_path=".",
manage_task_images=True,
backend_deploy=None,
env=None,
):
project = helm_values._ch_project
project.config.backend = "compose" if backend_deploy == "docker-compose" else "helm"
return project.skaffold.generate(output_path=output_path)


def create_vscode_debug_configuration(root_paths, helm_values):
project = helm_values._ch_project
return project.vscode_debug.generate()


# --- ch_cli_tools/tilt.py ---


def create_tilt_configuration(
root_paths,
helm_values,
manage_task_images=True,
output_path=".",
name="",
namespace="",
domain="",
):
# root_paths/manage_task_images/name/namespace/domain: accepted for
# signature compat only - same reasoning as create_skaffold_configuration
# above, the real CLI always passes the namespace/domain already baked
# into helm_values's own project config, never a different one.
project = helm_values._ch_project
return project.tilt.generate(output_path=output_path)


# --- ch_cli_tools/codefresh.py ---


def create_codefresh_deployment_scripts(
root_paths,
envs=(),
include=(),
exclude=(),
template_name=None,
base_image_name=None,
helm_values=None,
save=True,
):
project = helm_values._ch_project
return project.codefresh.generate(write_on_disk=save)


def write_env_file(helm_values, filename, image_cache_endpoint_url=None):
project = helm_values._ch_project
return project.codefresh.write_env_file(filename, image_cache_endpoint_url)


# --- ch_cli_tools/preprocessing.py ---
# preprocess_build_overrides physically merges overlapping app/base-image
# directories across root_paths into one filesystem tree, so a Docker build
# context sees files from every root that touches that app, not just the one
# that owns the Dockerfile. Whether this is still needed depends on whether
# the ng model keeps allowing a root to contribute extra build-context files
# alongside a Dockerfile it doesn't own itself (CHApp.base only merges
# *values*, never the filesystem) - open question, not decided yet.


def preprocess_build_overrides(root_paths, helm_values, merge_build_path=None):
pass


def generate_hash_based_image_tags(root_paths, helm_values, merge_build_path=None):
pass


# --- ch_cli_tools/utils.py ---


def merge_app_directories(root_paths, destination) -> None:
pass


# --- ch_cli_tools/migration.py ---


def perform_migration(base_root, accept_all=False):
return migration.perform_migration(base_root, accept_all=accept_all)
Loading
Loading