Skip to content

Commit ce038b7

Browse files
committed
build: Fix image tags in release manifests
Previous releases incorrectly missed the `v` prefix in the image when generating the `runtime-extensions-components.yaml`. This commit fixes that always inculding the `v`. This commit also ensures that the use of `trimPrefix` to remove the `v` prefix is consistently applied. As documented at https://goreleaser.com/customization/templates/#fn:version-prefix, the `Version` variable does not include the `v` prefix, but this is only for releases, and the `v` prefix is actually included in `Version` for snapshot or nightly builds.
1 parent af24170 commit ce038b7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

.goreleaser.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ before:
3737
name: {{.ProjectName}}-system
3838
$(helm template {{.ProjectName}} ./charts/{{.ProjectName}} \
3939
--namespace {{.ProjectName}}-system \
40-
--set-string image.tag={{ .Version }} \
40+
--set-string image.tag=v{{ trimPrefix .Version "v" }} \
4141
{{ if .IsSnapshot }}--set-string image.repository=ko.local/{{ .ProjectName }}{{ end }} \
4242
)
4343
EOF'
@@ -56,7 +56,7 @@ builds:
5656
- -X 'k8s.io/component-base/version.buildDate={{ .CommitDate }}'
5757
- -X 'k8s.io/component-base/version.gitCommit={{ .FullCommit }}'
5858
- -X 'k8s.io/component-base/version.gitTreeState={{ .Env.GIT_TREE_STATE }}'
59-
- -X 'k8s.io/component-base/version.gitVersion=v{{ trimprefix .Version "v" }}'
59+
- -X 'k8s.io/component-base/version.gitVersion=v{{ trimPrefix .Version "v" }}'
6060
- -X 'k8s.io/component-base/version.major={{ .Major }}'
6161
- -X 'k8s.io/component-base/version.minor={{ .Minor }}'
6262
- -X 'k8s.io/component-base/version/verflag.programName={{ .ProjectName }}'
@@ -75,12 +75,12 @@ builds:
7575
KO_DOCKER_REPO=ko.local/{{ .ProjectName }} \
7676
ko build \
7777
--bare \
78-
-t {{ .Version }} \
78+
-t v{{ trimPrefix .Version "v" }} \
7979
./cmd
8080
fi'
8181
8282
archives:
83-
- name_template: '{{ .ProjectName }}_v{{trimprefix .Version "v"}}_{{ .Os }}_{{ .Arch }}'
83+
- name_template: '{{ .ProjectName }}_v{{ trimPrefix .Version "v" }}_{{ .Os }}_{{ .Arch }}'
8484
rlcp: true
8585
builds:
8686
- cluster-api-runtime-extensions-nutanix
@@ -94,23 +94,23 @@ kos:
9494
- -X 'k8s.io/component-base/version.buildDate={{ .CommitDate }}'
9595
- -X 'k8s.io/component-base/version.gitCommit={{ .FullCommit }}'
9696
- -X 'k8s.io/component-base/version.gitTreeState={{ .Env.GIT_TREE_STATE }}'
97-
- -X 'k8s.io/component-base/version.gitVersion=v{{ trimprefix .Version "v" }}'
97+
- -X 'k8s.io/component-base/version.gitVersion=v{{ trimPrefix .Version "v" }}'
9898
- -X 'k8s.io/component-base/version.major={{ .Major }}'
9999
- -X 'k8s.io/component-base/version.minor={{ .Minor }}'
100100
- -X 'k8s.io/component-base/version/verflag.programName={{ .ProjectName }}'
101101
labels:
102102
org.opencontainers.image.created: "{{ .CommitDate }}"
103103
org.opencontainers.image.title: "{{ .ProjectName }}"
104104
org.opencontainers.image.revision: "{{ .FullCommit }}"
105-
org.opencontainers.image.version: v{{trimprefix .Version "v"}}
105+
org.opencontainers.image.version: v{{ .Version }}
106106
org.opencontainers.image.source: "{{ .GitURL }}"
107107
platforms:
108108
- linux/amd64
109109
- linux/arm64
110110
repository: ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix
111111
bare: true
112112
tags:
113-
- v{{trimprefix .Version "v"}}
113+
- v{{ trimPrefix .Version "v" }}
114114

115115
checksum:
116116
name_template: 'checksums.txt'

0 commit comments

Comments
 (0)