diff --git a/reposerver/repository/repository.go b/reposerver/repository/repository.go index 9817b5f7e5e33..5e9d10875a689 100644 --- a/reposerver/repository/repository.go +++ b/reposerver/repository/repository.go @@ -923,8 +923,8 @@ func helmTemplate(appPath string, repoRoot string, env *v1alpha1.Env, q *apiclie pathStrings := strings.Split(val, "/") refVar := strings.Split(val, "/")[0] refSourceRepo := q.RefSources[refVar].Repo.Repo - repoPath, err := gitRepoPaths.GetPath(refSourceRepo) - if err != nil { + repoPath := gitRepoPaths.GetPathIfExists(git.NormalizeGitURL(refSourceRepo)) + if repoPath == "" { log.Warnf("Failed to find path for ref %s", refVar) continue } diff --git a/util/io/paths.go b/util/io/paths.go index b9c20283bcdcd..a32d049778784 100644 --- a/util/io/paths.go +++ b/util/io/paths.go @@ -42,3 +42,13 @@ func (p *TempPaths) GetPath(key string) (string, error) { p.paths[key] = repoPath return repoPath, nil } + +// GetPathIfExists gets a path for the given key if it exists. Otherwise, returns an empty string. +func (p *TempPaths) GetPathIfExists(key string) string { + p.lock.Lock() + defer p.lock.Unlock() + if val, ok := p.paths[key]; ok { + return val + } + return "" +}