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:
Alex Goodman 2021-04-22 13:33:17 -04:00 committed by GitHub
commit c34060d188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package pkg
import (
"strings"
"github.com/anchore/syft/internal"
"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.
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
}

View File

@ -90,6 +90,17 @@ func TestPomProperties_PkgTypeIndicated(t *testing.T) {
},
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 {