Skip to content

Commit 1e1ac24

Browse files
committed
Make path determination more resilient w.r.t. including pipeline id or not
1 parent 0ff08a4 commit 1e1ac24

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

components/datadog/agent/package.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,16 @@ func GetPackagePath(localPath string, flavor tifos.Flavor, agentFlavor string, a
5757
packagePath := localPath
5858
matches := []string{}
5959
if pathInfo.IsDir() {
60-
packagePath = path.Join(packagePath, subFolder)
61-
packagePath = path.Join(packagePath, "pkg")
60+
packagePath = path.Join(packagePath, subFolder, "pkg")
61+
62+
// On Windows, if a dedicated pipeline-identified folder is available, use that
6263
if flavor == tifos.WindowsServer {
63-
packagePath = path.Join(packagePath, "pipeline-"+pipelineID)
64+
packagePathWithPipelineID := path.Join(packagePath, "pipeline-"+pipelineID)
65+
if info, err := os.Stat(packagePathWithPipelineID); err == nil && info.IsDir() {
66+
packagePath = packagePathWithPipelineID
67+
}
6468
}
69+
6570
entries, err := os.ReadDir(packagePath)
6671
if err != nil {
6772
return "", err

0 commit comments

Comments
 (0)