mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
fix(whitesourceExecuteScan) npm modules only (#2670)
do not fail step in case mta contains only node modules. No pom.xml required then. Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
This commit is contained in:
parent
cc66b7cabd
commit
4f9eff2303
@ -27,9 +27,9 @@ func (s *Scan) ExecuteUAScan(config *ScanOptions, utils Utils) error {
|
||||
return errors.Wrap(err, "failed to run scan for maven modules of mta")
|
||||
}
|
||||
} else {
|
||||
// ToDo: only warning message?
|
||||
//log.Entry().Warning("MTA project does not contain a pom.xml in the root. Scan results might be incomplete")
|
||||
return fmt.Errorf("mta project does not contain an aggregator pom.xml in the root - this is mandatory")
|
||||
if pomFiles, _ := utils.Glob("**/pom.xml"); len(pomFiles) > 0 {
|
||||
return fmt.Errorf("mta project with java modules does not contain an aggregator pom.xml in the root - this is mandatory")
|
||||
}
|
||||
}
|
||||
|
||||
packageJSONFiles, err := utils.FindPackageJSONFiles(config)
|
||||
|
@ -68,10 +68,24 @@ func TestExecuteUAScan(t *testing.T) {
|
||||
ProductName: "test-product",
|
||||
}
|
||||
utilsMock := NewScanUtilsMock()
|
||||
utilsMock.AddFile(filepath.Join("sub", "pom.xml"), []byte("dummy"))
|
||||
scan := newTestScan(&config)
|
||||
|
||||
err := scan.ExecuteUAScan(&config, utilsMock)
|
||||
assert.EqualError(t, err, "mta project does not contain an aggregator pom.xml in the root - this is mandatory")
|
||||
assert.EqualError(t, err, "mta project with java modules does not contain an aggregator pom.xml in the root - this is mandatory")
|
||||
})
|
||||
|
||||
t.Run("error - no pom.xml & only npm", func(t *testing.T) {
|
||||
config := ScanOptions{
|
||||
BuildTool: "mta",
|
||||
ProjectName: "test-project",
|
||||
ProductName: "test-product",
|
||||
}
|
||||
utilsMock := NewScanUtilsMock()
|
||||
scan := newTestScan(&config)
|
||||
|
||||
err := scan.ExecuteUAScan(&config, utilsMock)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("error - npm no name", func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user