Skip to content

Commit 1dc1ae2

Browse files
authored
Merge pull request #721 from MetaCell/feature/CH-37
Git clone functionality fixes
2 parents fb49449 + 1296b59 commit 1dc1ae2

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

docs/applications/dependencies.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ harness:
7070
branch_tag: v1.0.0
7171
path: myrepo
7272
```
73+
> Note that the path parameter is optional and its use should be restricted to necessity (e.g. name clashes)
7374

7475
The directory structure will be as following:
7576
```
@@ -84,8 +85,11 @@ Hence, inside the Dockerfile we expect to see something like
8485

8586
```dockerfile
8687
COPY dependencies .
87-
COPY dependencies/b.git/src .
88-
COPY dependencies/myrepo .
88+
```
89+
or
90+
```dockerfile
91+
COPY dependencies/b/src .
92+
COPY dependencies/myrepo/b .
8993
```
9094

9195
> Note that Cloud Harness does not add the COPY/ADD statements to the Dockerfile

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def clone_step_spec(conf: GitDependencyConfig, context_path: str):
5151
"type": "git-clone",
5252
"repo": conf.url,
5353
"revision": conf.branch_tag,
54-
"working_directory": join(context_path, "dependencies", conf.path or os.path.basename(conf.url)),
54+
"working_directory": join(context_path, "dependencies", conf.path or ""),
5555
"git": get_main_domain(conf.url) # Cannot really tell what's the git config name, usually the name of the repo
5656
}
5757

@@ -176,7 +176,7 @@ def codefresh_steps_from_base_path(base_path, build_step, fixed_context=None, in
176176

177177
if app_config and app_config.dependencies and app_config.dependencies.git:
178178
for dep in app_config.dependencies.git:
179-
steps[CD_BUILD_STEP_DEPENDENCIES]['steps'].append(clone_step_spec(dep, base_path))
179+
steps[CD_BUILD_STEP_DEPENDENCIES]['steps'].append(clone_step_spec(dep, dockerfile_relative_to_root))
180180

181181
build = None
182182
if build_step in steps:

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from .utils import get_template, dict_merge, find_dockerfiles_paths, app_name_from_path, \
1313
find_file_paths, guess_build_dependencies_from_dockerfile, merge_to_yaml_file, get_json_template, get_image_name
1414

15+
from . import HERE
16+
1517
def relpath_if(p1, p2):
1618
if os.path.isabs(p1):
1719
return p1
@@ -198,10 +200,10 @@ def git_clone_hook(conf: GitDependencyConfig, context_path: str):
198200
return {
199201
'command': [
200202
'sh',
201-
'tools/clone.sh',
203+
join(os.path.dirname(os.path.dirname(HERE)), 'clone.sh'),
202204
conf.branch_tag,
203205
conf.url,
204-
join(context_path, "dependencies", conf.path or os.path.basename(conf.url))
206+
join(context_path, "dependencies", conf.path or os.path.basename(conf.url).split('.')[0])
205207
]
206208
}
207209

0 commit comments

Comments
 (0)