Skip to content

Commit 31ef3e4

Browse files
alopezzchouquette
andauthored
Try to find Windows packages on a pipeline-ID specific folder before common folder (#1613)
Co-authored-by: chouquette <hugo.beauzee@datadoghq.com>
1 parent 2d827e8 commit 31ef3e4

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

components/datadog/agent/package.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +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
63+
if flavor == tifos.WindowsServer {
64+
packagePathWithPipelineID := path.Join(packagePath, "pipeline-"+pipelineID)
65+
if info, err := os.Stat(packagePathWithPipelineID); err == nil && info.IsDir() {
66+
packagePath = packagePathWithPipelineID
67+
}
68+
}
69+
6270
entries, err := os.ReadDir(packagePath)
6371
if err != nil {
6472
return "", err

0 commit comments

Comments
 (0)