1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

detectExecuteScan: fix toolrun data (#4366)

This commit is contained in:
larsbrueckner
2023-05-17 13:51:03 +02:00
committed by GitHub
parent a76b20f09f
commit 1e4b88a6f8
2 changed files with 16 additions and 4 deletions

View File

@@ -849,10 +849,20 @@ func createToolRecordDetect(utils detectUtils, workspace string, config detectEx
return "", err
}
projectVersionUrl := projectVersion.Href
if projectVersionUrl == "" {
return "", fmt.Errorf("TR_DETECT: no projectversion URL")
}
// projectVersion UUID comes as last part of the URL
vparts := strings.Split(projectVersionUrl, "/")
projectVersionId := vparts[len(vparts)-1]
if projectVersionId == "" {
return "", fmt.Errorf("TR_DETECT: no projectversion id in %v", projectVersionUrl)
}
err = record.AddKeyData("version",
projectVersionId,
projectVersion.Name,
projectVersionUrl,
projectVersionUrl)
projectVersion.Href)
if err != nil {
return "", err
}

View File

@@ -69,8 +69,10 @@ func New(fileUtils fileWriteUtils, workspace, toolName, toolInstance string) *To
now.Format("20060102150405")+
".json")
tr.reportFileName = reportFileName
return &tr
// keep the timestamp inside the object too
var otr = &tr
otr.AddContext("generatedOnUtc", now.Format("20060102150405"))
return otr
}
// AddKeyData - add one key to the current toolrecord