Skip to content

Commit

Permalink
fix: only print image banner if image arch is non empty string and di…
Browse files Browse the repository at this point in the history
…fferent (#1854)

Closes #1780 

we'd print the image arch banner incorrectly on k8s as the k8s backend
would return ""
  • Loading branch information
h4ck3rk3y authored Nov 27, 2023
1 parent 633ba42 commit 75b8c84
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const (
containerImageArchitectureMsgLineFormat = "> %s - %s"

linebreak = "\n"

emptyImageArchitecture = ""
)

type StartosisValidator struct {
Expand Down Expand Up @@ -221,15 +223,17 @@ func sendContainerImageSummaryInfoMsg(
pulledFromStr = containerDownloadedImagesMsgFromRemote
}

imageLine := fmt.Sprintf(containerDownloadedImagesMsgLineFormat, image, pulledFromStr)
imageLines = append(imageLines, imageLine)

architecture := validatedImage.GetArchitecture()

if architecture != runtime.GOARCH {
if architecture == emptyImageArchitecture {
logrus.Debugf("Couldn't fetch image architecture for '%v'; this is expected on k8s backend but not docker", image)
} else if architecture != runtime.GOARCH {
imageWithIncorrectArchLine := fmt.Sprintf(containerImageArchitectureMsgLineFormat, image, architecture)
imagesWithIncorrectArchLines = append(imagesWithIncorrectArchLines, imageWithIncorrectArchLine)
}

imageLine := fmt.Sprintf(containerDownloadedImagesMsgLineFormat, image, pulledFromStr)
imageLines = append(imageLines, imageLine)
}

msgLines := []string{containerDownloadedImagesMsgHeader}
Expand Down

0 comments on commit 75b8c84

Please sign in to comment.