Skip to content

Commit

Permalink
Fix canary build of the server image (#3174)
Browse files Browse the repository at this point in the history
Building and publishing the server image during a canary build, did not
use the canary tag, instead it used the version of the build, e.g.,
v1.1.0-7-gd0387ecb. It also means that on each canary build a new tag
is used when publishing the image.

By checking if we are doing a release of a tagged version or a canary
build we can use the correct tag.

Signed-off-by: Kim Christensen <[email protected]>
Co-authored-by: schristoff <[email protected]>
  • Loading branch information
kichristensen and schristoff authored Jul 9, 2024
1 parent 0e7a80e commit 91ae5c3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,22 @@ func pushImagesTo(registry string, info releases.GitMetadata) {
func PublishServerMultiArchImages() {
registry := getRegistry()
info := releases.LoadMetadata()
buildAndPushServerMultiArch(registry, info)

if info.IsTaggedRelease {
buildAndPushServerMultiArch(registry, info.Version)
} else {
fmt.Println("Skipping server image publish for not tagged release", info.Version)
}

if info.ShouldPublishPermalink() {
buildAndPushServerMultiArch(registry, info.Permalink)
} else {
fmt.Println("Skipping server image publish for permalink", info.Permalink)
}
}

func buildAndPushServerMultiArch(registry string, info releases.GitMetadata) {
img := fmt.Sprintf("%s/server:%s", registry, info.Version)
func buildAndPushServerMultiArch(registry string, tag string) {
img := fmt.Sprintf("%s/server:%s", registry, tag)
must.RunV("docker", "buildx", "create", "--use")
must.RunV("docker", "buildx", "bake", "-f", "docker-bake.json", "--push", "--set", "server.tags="+img, "server")
}
Expand Down

0 comments on commit 91ae5c3

Please sign in to comment.