Skip to content

Commit

Permalink
Generalize explanation of image tag templating
Browse files Browse the repository at this point in the history
  • Loading branch information
corvus-ch committed Dec 22, 2020
1 parent 260ff3e commit 7b33f43
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down

0 comments on commit 7b33f43

Please sign in to comment.