Skip to content

Commit

Permalink
fix: fix test case TestRunWithOciDownloader
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <zongzhe1024@163.com>
  • Loading branch information
zong-zhe committed Nov 20, 2024
1 parent 5dc9e57 commit 87b7f0b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
name = "helloworld"
full_name = "helloworld_0.1.2"
version = "0.1.2"
sum = "PN0OMEV9M8VGFn1CtA/T3bcgZmMJmOo+RkBrLKIWYeQ="
reg = "ghcr.io"
repo = "kcl-lang/helloworld"
oci_tag = "0.1.2"
2 changes: 1 addition & 1 deletion pkg/client/test_data/test_run_git_package/kcl.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ edition = "v0.8.0"
version = "0.0.1"

[dependencies]
k8s = { git = "https://github.com/kcl-lang/modules.git", commit = "ee03122b5f45b09eb48694422fc99a0772f6bba8", package = "k8s" }
k8s = { git = "https://github.com/kcl-lang/modules.git", commit = "ee03122b5f45b09eb48694422fc99a0772f6bba8", package = "k8s", version = "1.31" }
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ edition = "v0.10.0"
version = "0.0.1"

[dependencies]
helloworld = { version = "0.1.2" }
helloworld = "0.1.2"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
name = "helloworld"
full_name = "helloworld_0.1.2"
version = "0.1.2"
sum = "PN0OMEV9M8VGFn1CtA/T3bcgZmMJmOo+RkBrLKIWYeQ="
reg = "ghcr.io"
repo = "kcl-lang/helloworld"
oci_tag = "0.1.2"
12 changes: 12 additions & 0 deletions pkg/visitor/visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,22 @@ func (rv *RemoteVisitor) Visit(s *downloader.Source, v visitFunc) error {
// update the local module path with the latest version.
if len(rv.VisitedSpace) != 0 {
modFullPath = s.LocalPath(filepath.Join(rv.VisitedSpace, s.Type(), "src"))
if !utils.DirExists(modFullPath) {
err = os.MkdirAll(modFullPath, 0755)
if err != nil {
return err
}
}
}
// update the cache path with the latest version.
if rv.EnableCache {
cacheFullPath = s.CachePath(filepath.Join(rv.CachePath, s.Type(), "cache"))
if !utils.DirExists(cacheFullPath) {
err = os.MkdirAll(cacheFullPath, 0755)
if err != nil {
return err
}
}
}
}

Expand Down

0 comments on commit 87b7f0b

Please sign in to comment.