mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 08:53:15 +01:00
Merge pull request #404 from anchore/add-more-jenkins-plugin-group-ids
Add additional cases for categorizing jenkins package type by group id
This commit is contained in:
commit
c34060d188
@ -1,6 +1,8 @@
|
|||||||
package pkg
|
package pkg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/anchore/syft/internal"
|
"github.com/anchore/syft/internal"
|
||||||
"github.com/package-url/packageurl-go"
|
"github.com/package-url/packageurl-go"
|
||||||
)
|
)
|
||||||
@ -35,7 +37,7 @@ type PomProperties struct {
|
|||||||
|
|
||||||
// PkgTypeIndicated returns the package Type indicated by the data contained in the PomProperties.
|
// PkgTypeIndicated returns the package Type indicated by the data contained in the PomProperties.
|
||||||
func (p PomProperties) PkgTypeIndicated() Type {
|
func (p PomProperties) PkgTypeIndicated() Type {
|
||||||
if internal.HasAnyOfPrefixes(p.GroupID, JenkinsPluginPomPropertiesGroupIDs...) {
|
if internal.HasAnyOfPrefixes(p.GroupID, JenkinsPluginPomPropertiesGroupIDs...) || strings.Contains(p.GroupID, ".jenkins.plugin") {
|
||||||
return JenkinsPluginPkg
|
return JenkinsPluginPkg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,17 @@ func TestPomProperties_PkgTypeIndicated(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectedType: JenkinsPluginPkg,
|
expectedType: JenkinsPluginPkg,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "jenkins.plugin somewhere in group id",
|
||||||
|
pomProperties: PomProperties{
|
||||||
|
Path: "some path",
|
||||||
|
Name: "some name",
|
||||||
|
GroupID: "org.wagoodman.jenkins.plugins.something",
|
||||||
|
ArtifactID: "some artifact ID",
|
||||||
|
Version: "1",
|
||||||
|
},
|
||||||
|
expectedType: JenkinsPluginPkg,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user