From f7e65daa4b4225d3c181ca09e4d784e918a254c9 Mon Sep 17 00:00:00 2001 From: Christian Haeusler <794584+corvus-ch@users.noreply.github.com> Date: Mon, 21 Dec 2020 15:53:35 +0100 Subject: [PATCH 1/4] Enable auto pre-release detection --- .goreleaser.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 20d3e9c4f..407686ffa 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -34,6 +34,8 @@ changelog: - '^Merge pull request' release: + prerelease: auto + github: owner: vshn name: k8up From e40ff6fe0fe06861e21d71a22c8c0d4d38160b16 Mon Sep 17 00:00:00 2001 From: Christian Haeusler <794584+corvus-ch@users.noreply.github.com> Date: Mon, 21 Dec 2020 16:00:06 +0100 Subject: [PATCH 2/4] Prevent pre-releases from creating `latest` images --- .goreleaser.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 407686ffa..5d828e66c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,11 +16,17 @@ snapshot: name_template: "{{ .Tag }}-snapshot" dockers: +# The `latest` is not touched for pre release. +# The template string `{{ if .Prerelease }}v{{ .Version }}{{ else }}latest{{ end }}` +# will compute to `latest` for regular release. For pre releases, it will +# compute to `v{{ .Version }}`. This duplicates one of the other list items +# and therefore eliminates `latest` from the list. This is OK to do since +# `goreleaser` builds the image only once and tagging is a cheap operation. - image_templates: - - "docker.io/vshn/k8up:latest" + - "docker.io/vshn/k8up:{{ if .Prerelease }}v{{ .Version }}{{ else }}latest{{ end }}" - "docker.io/vshn/k8up:v{{ .Version }}" - "docker.io/vshn/k8up:v{{ .Major }}" - - "quay.io/vshn/k8up:latest" + - "quay.io/vshn/k8up:{{ if .Prerelease }}v{{ .Version }}{{ else }}latest{{ end }}" - "quay.io/vshn/k8up:v{{ .Version }}" - "quay.io/vshn/k8up:v{{ .Major }}" From 260ff3e7cfb46413aa61bc95a352cc13cbfae1c5 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 21 Dec 2020 17:26:36 +0100 Subject: [PATCH 3/4] Prevent pre-releases from creating floating Major version images --- .goreleaser.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 5d828e66c..55477b2bc 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -23,12 +23,14 @@ dockers: # and therefore eliminates `latest` from the list. This is OK to do since # `goreleaser` builds the image only once and tagging is a cheap operation. - image_templates: - - "docker.io/vshn/k8up:{{ if .Prerelease }}v{{ .Version }}{{ else }}latest{{ end }}" - "docker.io/vshn/k8up:v{{ .Version }}" - - "docker.io/vshn/k8up:v{{ .Major }}" - - "quay.io/vshn/k8up:{{ if .Prerelease }}v{{ .Version }}{{ else }}latest{{ end }}" - "quay.io/vshn/k8up:v{{ .Version }}" - - "quay.io/vshn/k8up:v{{ .Major }}" + + - "docker.io/vshn/k8up:{{ if .Prerelease }}v{{ .Version }}{{ else }}v{{ .Major }}{{ end }}" + - "quay.io/vshn/k8up:{{ if .Prerelease }}v{{ .Version }}{{ else }}v{{ .Major }}{{ end }}" + + - "docker.io/vshn/k8up:{{ if .Prerelease }}v{{ .Version }}{{ else }}latest{{ end }}" + - "quay.io/vshn/k8up:{{ if .Prerelease }}v{{ .Version }}{{ else }}latest{{ end }}" changelog: sort: asc From 7b33f43815f0397742e6cf22eb2740222354ca75 Mon Sep 17 00:00:00 2001 From: Christian Haeusler <794584+corvus-ch@users.noreply.github.com> Date: Tue, 22 Dec 2020 09:22:06 +0100 Subject: [PATCH 4/4] Generalize explanation of image tag templating --- .goreleaser.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 55477b2bc..6e62681d4 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,12 +16,14 @@ snapshot: name_template: "{{ .Tag }}-snapshot" dockers: -# The `latest` is not touched for pre release. -# The template string `{{ if .Prerelease }}v{{ .Version }}{{ else }}latest{{ end }}` -# will compute to `latest` for regular release. For pre releases, it will -# compute to `v{{ .Version }}`. This duplicates one of the other list items -# and therefore eliminates `latest` from the list. This is OK to do since -# `goreleaser` builds the image only once and tagging is a cheap operation. +# For pre releases, updating `latest` and the floating tags of the major +# version does not make sense. So only the image for the exact version should +# be pushed. +# For the lack of a less verbose solution, go templating is used to set the +# image tags to the major version or latest for normal releases. For pre +# releases, all image tags are set to the exact version. This will result in +# having the same image tag tree times in the list. This is fine to do as the +# image will be built only once and tagging is a cheap operation. - image_templates: - "docker.io/vshn/k8up:v{{ .Version }}" - "quay.io/vshn/k8up:v{{ .Version }}"