Skip to content

Commit 847a899

Browse files
authored
sboms: Update changelog and improve error message (#1116)
* Update changelog + improve error message * Remove newline
1 parent ffe0913 commit 847a899

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ All notable changes to `src-cli` are documented in this file.
1313

1414
## 5.8.0
1515

16+
### Added
17+
18+
- SBOM support: Software Bill of Materials (SBOMs) can now be fetched for Sourcegraph releases after 5.8.0 using `src sbom fetch -v <release>`. [#1115](https://github.com/sourcegraph/src-cli/pull/1115)
19+
1620
### Changed
1721

1822
- Update Go to 1.22.8

cmd/src/sbom_fetch.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"strings"
1515
"unicode"
1616

17+
"github.com/grafana/regexp"
1718
"github.com/sourcegraph/sourcegraph/lib/errors"
1819
"github.com/sourcegraph/sourcegraph/lib/output"
1920

@@ -186,6 +187,11 @@ func (c sbomConfig) getImageList() ([]string, error) {
186187
defer resp.Body.Close()
187188

188189
if resp.StatusCode != http.StatusOK {
190+
// Compare version number against a regex that matches versions up to and including 5.8.0
191+
versionRegex := regexp.MustCompile(`^v?[0-5]\.([0-7]\.[0-9]+|8\.0)$`)
192+
if versionRegex.MatchString(c.version) {
193+
return nil, fmt.Errorf("unsupported version %s: SBOMs are only available for Sourcegraph releases after 5.8.0", c.version)
194+
}
189195
return nil, fmt.Errorf("failed to fetch list of images - check that %s is a valid Sourcegraph release: HTTP status %d", c.version, resp.StatusCode)
190196
}
191197

0 commit comments

Comments
 (0)