-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.goreleaser.yml
169 lines (157 loc) · 6.52 KB
/
.goreleaser.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Copyright 2023 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2
project_name: cluster-api-runtime-extensions-nutanix
changelog:
use: github
groups:
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: 'Bug fixes'
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
filters:
exclude:
- '^docs:'
- '^chore:'
- '^build:'
release:
footer: |
### Summary
**Full Changelog**: https://github.com/nutanix-cloud-native/{{.ProjectName}}/compare/{{ .PreviousTag }}...{{ .Tag }}
extra_files:
- glob: ./examples/capi-quick-start/*.yaml
- glob: release-metadata.yaml
name_template: metadata.yaml
- glob: runtime-extensions-components.yaml
- glob: ./hack/examples/release/*-cluster-class.yaml
- glob: caren-images.txt
before:
hooks:
- |
sh -ec 'cat <<EOF > runtime-extensions-components.yaml
apiVersion: v1
kind: Namespace
metadata:
name: caren-system
$(helm template {{ .ProjectName }} ./charts/{{ .ProjectName }} \
--namespace caren-system \
--set-string image.tag=v{{ trimprefix .Version "v" }}{{ if .IsSnapshot }}-{{ .Runtime.Goarch }}{{ end }} \
--set-string helmRepository.images.bundleInitializer.tag=v{{ trimprefix .Version "v" }}{{ if .IsSnapshot }}-{{ .Runtime.Goarch }} \
--set-string image.repository=ko.local/{{ .ProjectName }}{{ end }} \
)
EOF'
- sed -i -e 's/\${/$${/g' -e 's/v0.0.0-dev/v{{ trimprefix .Version "v" }}/g' runtime-extensions-components.yaml
- |
sh -ec 'gojq --yaml-input --yaml-output \
".releaseSeries |= (. + [{contract: \"v1beta1\", major: {{ .Major }}, minor: {{ .Minor }}}] | unique)" \
metadata.yaml >release-metadata.yaml'
- make template-helm-repository
- |
sh -ec 'if [ {{ .IsSnapshot }} == false ] ; then
make --no-print-directory CAREN_VERSION=v{{ trimprefix .Version "v" }} list-images >caren-images.txt
fi'
- |
sh -ec 'if [ {{ .IsSnapshot }} == false ] ; then
make --no-print-directory CAREN_VERSION=v{{ trimprefix .Version "v" }} add-version-to-clusterclasses
fi'
builds:
- id: cluster-api-runtime-extensions-nutanix
dir: ./cmd
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -X 'k8s.io/component-base/version.buildDate={{ .CommitDate }}'
- -X 'k8s.io/component-base/version.gitCommit={{ .FullCommit }}'
- -X 'k8s.io/component-base/version.gitTreeState={{ .Env.GIT_TREE_STATE }}'
- -X 'k8s.io/component-base/version.gitVersion=v{{ trimprefix .Version "v" }}'
- -X 'k8s.io/component-base/version.major={{ .Major }}'
- -X 'k8s.io/component-base/version.minor={{ .Minor }}'
- -X 'k8s.io/component-base/version/verflag.programName={{ .ProjectName }}'
goos:
- linux
goarch:
- amd64
- arm64
mod_timestamp: '{{ .CommitTimestamp }}'
hooks:
post:
- |
sh -ec 'if [ {{ .IsSnapshot }} == true ] && [ {{ .Runtime.Goarch }} == {{ .Arch }} ]; then
env SOURCE_DATE_EPOCH=$(date +%s) \
KO_DATA_DATE_EPOCH=$(date +%s) \
KO_DOCKER_REPO=ko.local/{{ .ProjectName }} \
ko build \
--bare \
--platform linux/{{ .Arch }} \
-t v{{ trimprefix .Version "v" }}-{{ .Arch }} \
./cmd
fi'
archives:
- name_template: '{{ .ProjectName }}_v{{ trimprefix .Version "v" }}_{{ .Os }}_{{ .Arch }}'
builds:
- cluster-api-runtime-extensions-nutanix
dockers:
- image_templates:
- 'ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-helm-chart-bundle-initializer:v{{ trimprefix .Version "v" }}-amd64'
use: buildx
dockerfile: ./hack/addons/helm-chart-bundler/Dockerfile
extra_files:
- hack/addons/helm-chart-bundler/repos.yaml
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
- '--build-arg=VERSION=v{{ trimprefix .Version "v" }}'
- "--label=org.opencontainers.image.created={{.CommitDate}}"
- "--label=org.opencontainers.image.title=cluster-api-runtime-extensions-helm-chart-bundle-initializer"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- '--label=org.opencontainers.image.version=v{{ trimprefix .Version "v" }}'
- "--label=org.opencontainers.image.source={{.GitURL}}"
goarch: amd64
- image_templates:
- 'ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-helm-chart-bundle-initializer:v{{ trimprefix .Version "v" }}-arm64'
use: buildx
dockerfile: ./hack/addons/helm-chart-bundler/Dockerfile
extra_files:
- hack/addons/helm-chart-bundler/repos.yaml
build_flag_templates:
- "--platform=linux/arm64"
- "--pull"
- '--build-arg=VERSION=v{{ trimprefix .Version "v" }}'
- "--label=org.opencontainers.image.created={{.CommitDate}}"
- "--label=org.opencontainers.image.title=cluster-api-runtime-extensions-helm-chart-bundle-initializer"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- '--label=org.opencontainers.image.version=v{{ trimprefix .Version "v" }}'
- "--label=org.opencontainers.image.source={{.GitURL}}"
goarch: arm64
docker_manifests:
- name_template: ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-helm-chart-bundle-initializer:v{{ trimprefix .Version "v" }}
image_templates:
- ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-helm-chart-bundle-initializer:v{{ trimprefix .Version "v" }}-amd64
- ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-helm-chart-bundle-initializer:v{{ trimprefix .Version "v" }}-arm64
kos:
- id: cluster-api-runtime-extensions-nutanix
build: cluster-api-runtime-extensions-nutanix
labels:
org.opencontainers.image.created: "{{ .CommitDate }}"
org.opencontainers.image.title: "{{ .ProjectName }}"
org.opencontainers.image.revision: "{{ .FullCommit }}"
org.opencontainers.image.version: 'v{{ trimprefix .Version "v" }}'
org.opencontainers.image.source: "{{ .GitURL }}"
platforms:
- linux/amd64
- linux/arm64
repository: ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix
bare: true
creation_time: "{{.CommitTimestamp}}"
ko_data_creation_time: "{{.CommitTimestamp}}"
tags:
- 'v{{ trimprefix .Version "v" }}'
checksum:
name_template: 'checksums.txt'
snapshot:
version_template: "{{ incminor .Tag }}-dev"