Skip to content

Commit

Permalink
WIP: Don't include SHA if not present in cache
Browse files Browse the repository at this point in the history
As we might not have retrieved a SHA (dependent on registry type), don't
try to include one if it's empty.
  • Loading branch information
aidy committed Mar 1, 2024
1 parent 19be5da commit b280d1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (c *Checker) Container(ctx context.Context, log *logrus.Entry,
latestVersion := latestImage.Tag

// If we are using SHA and tag, make latest version include both
if usingSHA && !strings.Contains(latestVersion, "@") {
if usingSHA && !strings.Contains(latestVersion, "@") && latestImage.SHA != "" {
latestVersion = fmt.Sprintf("%s@%s", latestVersion, latestImage.SHA)
}

Expand Down Expand Up @@ -148,7 +148,7 @@ func (c *Checker) isLatestSemver(ctx context.Context, imageURL, currentSHA strin

// If using the same image version, but the SHA has been updated upstream,
// make not latest
if currentImage.Equal(latestImageV) && currentSHA != latestImage.SHA {
if currentImage.Equal(latestImageV) && currentSHA != latestImage.SHA && latestImage.SHA != "" {
isLatest = false
latestImage.Tag = fmt.Sprintf("%s@%s", latestImage.Tag, latestImage.SHA)
}
Expand Down

0 comments on commit b280d1e

Please sign in to comment.