Skip to content

PoC of a new in memory model for deployment artifact generations - #874

Closed
aranega wants to merge 29 commits into
developfrom
poc/ng-library-clean
Closed

aranega wants to merge 29 commits into
developfrom
poc/ng-library-clean

Conversation

@aranega

@aranega aranega commented Sep 28, 2026

Copy link
Copy Markdown
Member

Closes CH-X

Implemented solution

...

How to test this PR

...

Sanity checks:

  • The pull request is explicitly linked to the relevant issue(s)
  • The issue is well described: clearly states the problem and the general proposed solution(s)
  • In this PR it is explicitly stated how to test the current change
  • The issue seta the scope and the type of issue (bug, story, task, etc.)
  • The relevant components are indicated in the issue (if any)
  • All the automated test checks are passing
  • All the linked issues are included in one Sprint
  • All the linked issues are in the Review state
  • All the linked issues are assigned

Breaking changes (select one):

  • The present changes do not change the preexisting api in any way
  • This PR and the issue are tagged as a breaking-change and the migration procedure is well described above

Possible deployment updates issues (select one):

  • There is no reason why deployments based on CloudHarness may break after the current update
  • This PR and the issue are tagged as alert:deployment

Test coverage (select one):

  • Tests for the relevant cases are included in this pr
  • The changes included in this pr are out of the current test coverage scope

Documentation (select one):

  • The documentation has been updated to match the current changes
  • The changes included in this PR are out of the current documentation scope

Nice to have (if relevant):

  • Screenshots of the changes
  • Explanatory video/animated gif

Comment thread tools/deployment-cli-tools/harness-deployment-ng Fixed
Comment thread tools/deployment-cli-tools/harness-deployment-ng Fixed
Comment thread tools/deployment-cli-tools/harness-deployment-ng Fixed
Comment thread tools/deployment-cli-tools/harness-deployment-ng Fixed
Comment thread tools/deployment-cli-tools/harness-deployment-ng Fixed
Comment thread tools/deployment-cli-tools/harness-deployment-ng Fixed
Comment thread tools/deployment-cli-tools/ch_cli_tools/ng/skaffold.py Fixed
Comment thread tools/deployment-cli-tools/ch_cli_tools/ng/model.py Fixed
Comment thread tools/deployment-cli-tools/ch_cli_tools/ng/model.py Fixed
Comment thread tools/deployment-cli-tools/ch_cli_tools/ng/utils.py Fixed
Comment on lines +321 to +340
# def test_collect_helm_values_wrong_dependencies_validate(tmp_path):
# out_folder = tmp_path / 'test_collect_helm_values_wrong_dependencies_validate'
# with pytest.raises(ValuesValidationException):
# create_helm_chart([CLOUDHARNESS_ROOT, f"{RESOURCES}/wrong-dependencies"], output_path=out_folder, domain="my.local",
# namespace='test', env='prod', local=False, tag='1', include=["wrong-hard"])
# try:
# create_helm_chart([CLOUDHARNESS_ROOT, f"{RESOURCES}/wrong-dependencies"], output_path=out_folder, domain="my.local",
# namespace='test', env='prod', local=False, tag='1', include=["wrong-soft"])
#
# except ValuesValidationException as e:
# pytest.fail("Should not error because of wrong soft dependency")
#
# with pytest.raises(ValuesValidationException):
# create_helm_chart([CLOUDHARNESS_ROOT, f"{RESOURCES}/wrong-dependencies"], output_path=out_folder, domain="my.local",
# namespace='test', env='prod', local=False, tag='1', include=["wrong-build"])
# try:
# create_helm_chart([CLOUDHARNESS_ROOT, f"{RESOURCES}/wrong-dependencies"], output_path=out_folder, domain="my.local",
# namespace='test', env='prod', local=False, tag='1', include=["wrong-services"])
# except ValuesValidationException:
# pytest.fail("Should not error because of missing use_services dependency")
Comment on lines +373 to +402
# def test_collect_helm_values_build_dependencies(tmp_path):
# out_folder = tmp_path / 'test_collect_helm_values_build_dependencies'
# values = create_helm_chart([CLOUDHARNESS_ROOT, RESOURCES], output_path=out_folder, domain="my.local",
# namespace='test', env='prod', local=False, tag='1', include=["myapp"])
#
# assert 'cloudharness-flask' in values[KEY_TASK_IMAGES], "Cloudharness-flask is included in the build dependencies"
# assert 'cloudharness-base' in values[KEY_TASK_IMAGES], "Cloudharness-base is included in cloudharness-flask Dockerfile and it should be guessed"
# assert 'cloudharness-base-debian' not in values[KEY_TASK_IMAGES], "Cloudharness-base-debian is not included in any dependency"
# assert 'cloudharness-frontend-build' not in values[KEY_TASK_IMAGES], "cloudharness-frontend-build is not included in any dependency"
#
#
# def test_collect_helm_values_build_dependencies_nodeps(tmp_path):
# out_folder = tmp_path / 'test_collect_helm_values_build_dependencies_nodeps'
# values = create_helm_chart([CLOUDHARNESS_ROOT, RESOURCES], output_path=out_folder, domain="my.local",
# namespace='test', env='prod', local=False, tag='1', include=["events"])
#
# assert 'cloudharness-flask' not in values[KEY_TASK_IMAGES], "Cloudharness-flask is not included in the build dependencies"
# assert 'cloudharness-base' not in values[KEY_TASK_IMAGES], "Cloudharness-base is not included in the build dependencies"
# assert 'cloudharness-base-debian' not in values[KEY_TASK_IMAGES], "Cloudharness-base-debian is not included in any dependency"
# assert 'cloudharness-frontend-build' not in values[KEY_TASK_IMAGES], "cloudharness-frontend-build is not included in any dependency"
#
#
# def test_collect_helm_values_build_dependencies_exclude(tmp_path):
# out_folder = tmp_path / 'test_collect_helm_values_build_dependencies_exclude'
# values = create_helm_chart([CLOUDHARNESS_ROOT, RESOURCES], output_path=out_folder, domain="my.local",
# namespace='test', env='prod', local=False, tag='1', include=["workflows"], exclude=["workflows-extract-download"])
#
# assert 'cloudharness-flask' in values[KEY_TASK_IMAGES], "Cloudharness-flask is included in the build dependencies"
# assert 'cloudharness-base' in values[KEY_TASK_IMAGES], "Cloudharness-base is included in cloudharness-flask Dockerfile and it should be guessed"
# assert 'workflows-extract-download' not in values[KEY_TASK_IMAGES], "workflows-extract-download has been explicitly excluded"
Comment on lines +447 to +465
# def test_cnpg_postgres_parameters_render_only_when_set(tmp_path):
# out_folder = tmp_path / 'test_cnpg_postgres_parameters_render_only_when_set'
# create_helm_chart([CLOUDHARNESS_ROOT, RESOURCES], output_path=out_folder, domain="my.local",
# env='withpostgres', local=False, include=["myapp"], exclude=["legacy"])
#
# helm_path = out_folder / HELM_CHART_PATH
# shutil.rmtree(helm_path / 'charts')
# values_path = helm_path / 'values.yaml'
# with open(values_path, 'r') as values_file:
# values = yaml.load(values_file)
# postgres = values['apps']['myapp']['harness']['database']['postgres']
# postgres['operator'] = True
# postgres['parameters'] = {
# # Simulate generated YAML values where on/off can be parsed as booleans before Helm renders the chart.
# 'autovacuum': True,
# 'max_connections': '200',
# 'shared_buffers': '1GB',
# 'synchronous_commit': True,
# 'track_io_timing': False,
Comment on lines +467 to +468
# with open(values_path, 'w') as values_file:
# yaml.dump(values, values_file)
Comment on lines +482 to +483
# with open(values_path, 'w') as values_file:
# yaml.dump(values, values_file)
Comment on lines +490 to +491
# with open(values_path, 'w') as values_file:
# yaml.dump(values, values_file)
Comment on lines +499 to +519
# def test_statefulset_option(tmp_path):
# out_folder = tmp_path / 'test_statefulset_option'
# # nfsserver is included to provide the storage class values needed by the usenfs case
# create_helm_chart([CLOUDHARNESS_ROOT, RESOURCES], output_path=out_folder, domain="my.local",
# env='withpostgres', local=False, include=["myapp", "nfsserver"], exclude=["legacy"])
#
# helm_path = out_folder / HELM_CHART_PATH
# shutil.rmtree(helm_path / 'charts')
# values_path = helm_path / 'values.yaml'
# with open(values_path, 'r') as values_file:
# values = yaml.load(values_file)
#
# myapp = values['apps']['myapp']
# harness = myapp['harness']
# dep_name = harness['deployment']['name']
# db_name = harness['database']['name']
# service_name = harness['service']['name']
#
# harness['deployment']['auto'] = True
# harness['deployment']['volume'] = {
# 'name': 'myapp-data', 'mountpath': '/data', 'size': '1Gi', 'auto': True,
Comment on lines +521 to +524
# with open(values_path, 'w') as values_file:
# yaml.dump(values, values_file)
#
# # Default: Deployments with the Recreate/affinity workaround and a standalone PVC
Comment on lines +541 to +542
# with open(values_path, 'w') as values_file:
# yaml.dump(values, values_file)
Comment thread tools/deployment-cli-tools/tests/ng/test_helm_compat.py Fixed
print(f"unknown: {unknown}")
sys.exit(2)

project = CHProject(root_paths[0], cloudharness_path=root_paths[0])
@aranega

aranega commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

Closing the PR, I'll reopen a new one later, github code bot is stressing me out spamming so many messages at the moment while I'm still actively thinking/dev about the whole model/architecture

@aranega aranega closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant