Skip to content

Commit

Permalink
use work dir for kurt yml check
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 committed Nov 20, 2024
1 parent 3de186f commit a938a40
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions cli/cli/commands/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,14 @@ func pullPackagesLocally(packageDependencies []string) (map[string]string, error
return nil, stacktrace.Propagate(err, "An error occurred getting current working directory.")
}
// ensure a kurtosis yml exists here so that packages get cloned to the right place (one dir above/nested in the same dir as the package)
if _, err := os.Stat(fmt.Sprintf("%s/%s", workingDirectory, kurtosisYMLFilePath)); err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil, stacktrace.Propagate(err, "'%s' does not exist in current working directory. Make sure you are running this at the root of the package with the %s.", kurtosisYMLFilePath, kurtosisYMLFilePath)
} else {
return nil, stacktrace.Propagate(err, "An error occurred checking if %s exists.", kurtosisYMLFilePath)
}
}

file, err := os.OpenFile(kurtosisYMLFilePath, os.O_WRONLY|os.O_APPEND, kurtosisYMLFilePerms)
if err != nil {
return nil, stacktrace.Propagate(err, "An error occurred opening '%s' file. Make sure this command is being run from within the directory of a kurtosis package.", kurtosisYMLFilePath)
Expand All @@ -879,14 +887,6 @@ func pullPackagesLocally(packageDependencies []string) (map[string]string, error
if err != nil {
return nil, stacktrace.Propagate(err, "An error occurred getting rel path between '%v' and '%v'.", workingDirectory, relParentCwd)
}

if _, err := os.Stat(fmt.Sprintf("%s/%s", parentCwd, kurtosisYMLFilePath)); err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil, stacktrace.Propagate(err, "%s does not exist in current working directory. Make sure you are running this at the root of the package with the %s.", kurtosisYMLFilePath, kurtosisYMLFilePath)
} else {
return nil, stacktrace.Propagate(err, "An error occurred checking if %s exists.", kurtosisYMLFilePath)
}
}
for _, dependency := range packageDependencies {
packageIdParts := strings.Split(dependency, "/")
packageName := packageIdParts[len(packageIdParts)-1]
Expand All @@ -900,7 +900,6 @@ func pullPackagesLocally(packageDependencies []string) (map[string]string, error
repoUrl += ".git"
}
localPackagePath := fmt.Sprintf("%s/%s", parentCwd, packageName)
// find the kurtosis.yml
_, err := git.PlainClone(localPackagePath, shouldCloneNormalRepo, &git.CloneOptions{
URL: repoUrl,
Auth: nil,
Expand Down

0 comments on commit a938a40

Please sign in to comment.