Skip to content

Commit

Permalink
Merge pull request #285 from anchore/ldflag-version
Browse files Browse the repository at this point in the history
chore: set the version by ldflag
  • Loading branch information
bradleyjones authored Jul 30, 2024
2 parents 53b773b + 30b5c04 commit 1ff28a4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ builds:
goos:
- linux
- darwin
ldflags:
- -X github.com/anchore/harbor-scanner-adapter/pkg/adapter.AdapterVersion={{.Version}}
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
46 changes: 24 additions & 22 deletions pkg/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,36 @@ const (
HarborMetadataVulnDBUpdateKey = "harbor.scanner-adapter/vulnerability-database-updated-at"
HarborMetadataScannerTypeKey = "harbor.scanner-adapter/scanner-type"
AdapterType = "os-package-vulnerability" // #nosec G101
AdapterVersion = "1.3.2"
AdapterVendor = "Anchore Inc."
AdapterName = "Anchore"
)

var AdapterMetadata = harbor.ScannerAdapterMetadata{
Scanner: harbor.Scanner{
Name: AdapterName,
Version: AdapterVersion,
Vendor: AdapterVendor,
},
Capabilities: []harbor.Capability{
{
ConsumesMIMETypes: []string{
DockerImageMimeType,
OciImageMimeType,
},
ProducesMIMETypes: []string{
HarborVulnReportv1MimeType,
RawVulnReportMimeType,
var (
AdapterVersion = "dev"
AdapterMetadata = harbor.ScannerAdapterMetadata{
Scanner: harbor.Scanner{
Name: AdapterName,
Version: AdapterVersion,
Vendor: AdapterVendor,
},
Capabilities: []harbor.Capability{
{
ConsumesMIMETypes: []string{
DockerImageMimeType,
OciImageMimeType,
},
ProducesMIMETypes: []string{
HarborVulnReportv1MimeType,
RawVulnReportMimeType,
},
},
},
},
Properties: map[string]string{
HarborMetadataVulnDBUpdateKey: "", // This gets updated in response to requests from Harbor
HarborMetadataScannerTypeKey: AdapterType,
},
}
Properties: map[string]string{
HarborMetadataVulnDBUpdateKey: "", // This gets updated in response to requests from Harbor
HarborMetadataScannerTypeKey: AdapterType,
},
}
)

// ScannerAdapter defines methods for scanning container images.
type ScannerAdapter interface {
Expand Down

0 comments on commit 1ff28a4

Please sign in to comment.