Skip to content

Commit

Permalink
CH-37 related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
filippomc committed Feb 5, 2024
1 parent c958a9e commit 1296b59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions docs/applications/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```
Expand All @@ -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
4 changes: 2 additions & 2 deletions tools/deployment-cli-tools/ch_cli_tools/codefresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions tools/deployment-cli-tools/ch_cli_tools/skaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])
]
}

Expand Down

0 comments on commit 1296b59

Please sign in to comment.