Skip to content

Commit 4b5e600

Browse files
committed
Don't include SHA in output if not present in cache
As we might not have retrieved a SHA (dependent on registry type), don't try to include one if it's empty.
1 parent f8d0bda commit 4b5e600

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/controller/checker/checker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (c *Checker) Container(ctx context.Context, log *logrus.Entry,
7676
latestVersion := latestImage.Tag
7777

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

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

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

0 commit comments

Comments
 (0)