diff --git a/docs/applications/dependencies.md b/docs/applications/dependencies.md index e6d1a5b7..5a9606be 100644 --- a/docs/applications/dependencies.md +++ b/docs/applications/dependencies.md @@ -70,6 +70,7 @@ harness: branch_tag: v1.0.0 path: myrepo ``` +> Note that the path parameter is optional and its use should be restricted to necessity (e.g. name clashes) The directory structure will be as following: ``` @@ -84,8 +85,11 @@ Hence, inside the Dockerfile we expect to see something like ```dockerfile COPY dependencies . -COPY dependencies/b.git/src . -COPY dependencies/myrepo . +``` +or +```dockerfile +COPY dependencies/b/src . +COPY dependencies/myrepo/b . ``` > Note that Cloud Harness does not add the COPY/ADD statements to the Dockerfile \ No newline at end of file diff --git a/tools/deployment-cli-tools/ch_cli_tools/codefresh.py b/tools/deployment-cli-tools/ch_cli_tools/codefresh.py index d6b699a5..c4b7dd26 100644 --- a/tools/deployment-cli-tools/ch_cli_tools/codefresh.py +++ b/tools/deployment-cli-tools/ch_cli_tools/codefresh.py @@ -51,7 +51,7 @@ def clone_step_spec(conf: GitDependencyConfig, context_path: str): "type": "git-clone", "repo": conf.url, "revision": conf.branch_tag, - "working_directory": join(context_path, "dependencies", conf.path or os.path.basename(conf.url)), + "working_directory": join(context_path, "dependencies", conf.path or ""), "git": get_main_domain(conf.url) # Cannot really tell what's the git config name, usually the name of the repo } @@ -176,7 +176,7 @@ def codefresh_steps_from_base_path(base_path, build_step, fixed_context=None, in if app_config and app_config.dependencies and app_config.dependencies.git: for dep in app_config.dependencies.git: - steps[CD_BUILD_STEP_DEPENDENCIES]['steps'].append(clone_step_spec(dep, base_path)) + steps[CD_BUILD_STEP_DEPENDENCIES]['steps'].append(clone_step_spec(dep, dockerfile_relative_to_root)) build = None if build_step in steps: diff --git a/tools/deployment-cli-tools/ch_cli_tools/skaffold.py b/tools/deployment-cli-tools/ch_cli_tools/skaffold.py index bd2f4da4..e96d7129 100644 --- a/tools/deployment-cli-tools/ch_cli_tools/skaffold.py +++ b/tools/deployment-cli-tools/ch_cli_tools/skaffold.py @@ -12,6 +12,8 @@ from .utils import get_template, dict_merge, find_dockerfiles_paths, app_name_from_path, \ find_file_paths, guess_build_dependencies_from_dockerfile, merge_to_yaml_file, get_json_template, get_image_name +from . import HERE + def relpath_if(p1, p2): if os.path.isabs(p1): return p1 @@ -198,10 +200,10 @@ def git_clone_hook(conf: GitDependencyConfig, context_path: str): return { 'command': [ 'sh', - 'tools/clone.sh', + join(os.path.dirname(os.path.dirname(HERE)), 'clone.sh'), conf.branch_tag, conf.url, - join(context_path, "dependencies", conf.path or os.path.basename(conf.url)) + join(context_path, "dependencies", conf.path or os.path.basename(conf.url).split('.')[0]) ] }