Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #834 from StrongMonkey/fix-panic
Browse files Browse the repository at this point in the history
Don't assume revision has fixed length
  • Loading branch information
StrongMonkey authored Nov 19, 2019
2 parents f99a89d + dacbc28 commit 23956ab
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions modules/build/controllers/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,12 @@ func ImageName(rev string, namespace, name string, build *riov1.ImageBuildSpec)
imageName = build.ImageName
}

return fmt.Sprintf("%s/%s:%s", registry, imageName, rev[:5])
suffix := rev
if len(rev) > 5 {
suffix = rev[:5]
}

return fmt.Sprintf("%s/%s:%s", registry, imageName, suffix)
}

func PullImageName(rev string, namespace, name string, build *riov1.ImageBuildSpec) string {
Expand All @@ -371,5 +376,10 @@ func PullImageName(rev string, namespace, name string, build *riov1.ImageBuildSp
imageName = build.ImageName
}

return fmt.Sprintf("%s/%s:%s", registry, imageName, rev[:5])
suffix := rev
if len(rev) > 5 {
suffix = rev[:5]
}

return fmt.Sprintf("%s/%s:%s", registry, imageName, suffix)
}

0 comments on commit 23956ab

Please sign in to comment.