Skip to content

Commit 92c6f2f

Browse files
committed
CH-194 remove dependency on current path in deployment
1 parent 91d5fbc commit 92c6f2f

5 files changed

Lines changed: 28 additions & 22 deletions

File tree

deployment-configuration/helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ description: CloudHarness Helm Chart
44
maintainers:
55
- {email: filippo@metacell.us, name: Filippo Ledda}
66
- {email: zoran@metacell.us, name: Zoran Sinnema}
7-
name: cloudharness
7+
name: cloud-harness
88
version: 0.0.1

tools/deployment-cli-tools/ch_cli_tools/configurationgenerator.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,18 @@ def _adjust_missing_values(self, helm_values):
9393
chart_idx_content = yaml.safe_load(f)
9494
helm_values['name'] = chart_idx_content['name'].lower()
9595

96-
def _process_applications(self, helm_values, base_image_name):
97-
for root_path in self.root_paths:
96+
def _process_applications(self, helm_values, base_image_name=None):
97+
for i in range(len(self.root_paths)):
98+
root_path = self.root_paths[i]
99+
base_name = clean_image_name(root_path.name) if i > 0 else base_image_name
98100
app_values = init_app_values(
99101
root_path, exclude=self.exclude, values=helm_values[KEY_APPS])
100102
helm_values[KEY_APPS] = dict_merge(helm_values[KEY_APPS],
101103
app_values)
102104

103105
app_base_path = root_path / APPS_PATH
104106
app_values = self.collect_app_values(
105-
app_base_path, base_image_name=clean_image_name(root_path.name), helm_values=helm_values)
107+
app_base_path, base_image_name=base_name, helm_values=helm_values)
106108
helm_values[KEY_APPS] = dict_merge(helm_values[KEY_APPS],
107109
app_values)
108110

@@ -147,13 +149,15 @@ def collect_app_values(self, app_base_path, base_image_name=None, helm_values=No
147149

148150
return values
149151

150-
def _init_static_images(self):
151-
for root_path in self.root_paths:
152+
def _init_static_images(self, base_image_name):
153+
for i in range(len(self.root_paths)):
154+
root_path = self.root_paths[i]
155+
base_name = clean_image_name(root_path.name) if i > 0 else base_image_name
152156
for static_img_dockerfile in find_dockerfiles_paths(os.path.join(root_path, STATIC_IMAGES_PATH)):
153157
self.static_images.add(static_img_dockerfile)
154158

155159
img_name = image_name_from_dockerfile_path(os.path.basename(
156-
static_img_dockerfile), base_name=clean_image_name(root_path.name))
160+
static_img_dockerfile), base_name=base_name)
157161
self.base_images[os.path.basename(static_img_dockerfile)] = self.image_tag(
158162
img_name, build_context_path=static_img_dockerfile,
159163
dependencies=guess_build_dependencies_from_dockerfile(static_img_dockerfile)
@@ -178,25 +182,30 @@ def _assign_static_build_dependencies(self, helm_values):
178182
del helm_values[KEY_TASK_IMAGES][image_name]
179183
# del helm_values[KEY_TASK_IMAGES_BUILD][image_name]
180184

181-
def _init_base_images(self):
185+
def _init_base_images(self, base_image_name):
186+
for i in range(len(self.root_paths)):
187+
root_path = self.root_paths[i]
188+
base_name = clean_image_name(root_path.name) if i > 0 else base_image_name
182189

183-
for root_path in self.root_paths:
184190
for base_img_dockerfile in self.__find_static_dockerfile_paths(root_path):
185191
img_name = image_name_from_dockerfile_path(
186-
os.path.basename(base_img_dockerfile), base_name=clean_image_name(root_path.name))
192+
os.path.basename(base_img_dockerfile), base_name=base_name)
187193
self.base_images[os.path.basename(base_img_dockerfile)] = self.image_tag(
188194
img_name, build_context_path=root_path,
189195
dependencies=guess_build_dependencies_from_dockerfile(base_img_dockerfile)
190196
)
191197

192198
return self.base_images
193199

194-
def _init_test_images(self):
200+
def _init_test_images(self, base_image_name):
195201
test_images = {}
196-
for root_path in self.root_paths:
202+
for i in range(len(self.root_paths)):
203+
root_path = self.root_paths[i]
204+
base_name = clean_image_name(root_path.name) if i > 0 else base_image_name
205+
197206
for base_img_dockerfile in find_dockerfiles_paths(os.path.join(root_path, TEST_IMAGES_PATH)):
198207
img_name = image_name_from_dockerfile_path(
199-
os.path.basename(base_img_dockerfile), base_name=clean_image_name(root_path.name))
208+
os.path.basename(base_img_dockerfile), base_name=base_name)
200209
test_images[os.path.basename(base_img_dockerfile)] = self.image_tag(
201210
img_name, build_context_path=base_img_dockerfile)
202211

tools/deployment-cli-tools/ch_cli_tools/dockercompose.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def process_values(self) -> HarnessMainConfig:
4949

5050
helm_values[KEY_TASK_IMAGES] = {}
5151

52-
self._init_base_images()
53-
self._init_static_images()
54-
helm_values[KEY_TEST_IMAGES] = self._init_test_images()
52+
self._init_base_images(base_image_name)
53+
self._init_static_images(base_image_name)
54+
helm_values[KEY_TEST_IMAGES] = self._init_test_images(base_image_name)
5555

5656
self._process_applications(helm_values, base_image_name)
5757

tools/deployment-cli-tools/ch_cli_tools/helm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def process_values(self) -> HarnessMainConfig:
5757

5858
helm_values[KEY_TASK_IMAGES] = {}
5959

60-
self._init_base_images()
61-
self._init_static_images()
62-
helm_values[KEY_TEST_IMAGES] = self._init_test_images()
60+
self._init_base_images(base_image_name)
61+
self._init_static_images(base_image_name)
62+
helm_values[KEY_TEST_IMAGES] = self._init_test_images(base_image_name)
6363

6464
self._process_applications(helm_values, base_image_name)
6565

tools/deployment-cli-tools/ch_cli_tools/skaffold.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ def build_artifact(
5555
additional_build_args: dict[str, str] = None,
5656
) -> dict:
5757
build_args = {
58-
'REGISTRY': helm_values.registry.name,
59-
'TAG': helm_values.tag,
60-
'NOCACHE': str(time.time()),
6158
'DEBUG': 'true' if helm_values.local or helm_values.debug else ''
6259
}
6360

0 commit comments

Comments
 (0)