@@ -49,58 +49,47 @@ builds:
49
49
- arm64
50
50
mod_timestamp : ' {{ .CommitTimestamp }}'
51
51
hooks :
52
- post :
53
- - cmd : make SKIP_UPX={{ if index .Env "SKIP_UPX" }}{{ .Env.SKIP_UPX }}{{ else }}{{ .IsSnapshot }}{{ end }} GOOS={{ .Os }} GOARCH={{ .Arch }} UPX_TARGET={{ .Path }} upx
52
+ post : |
53
+ sh -ec 'if [ {{ .IsSnapshot }} == true ] && [ {{ .Runtime.Goarch }} == {{ .Arch }} ]; then
54
+ env GOOS=linux GOARCH={{ .Arch }} \
55
+ SOURCE_DATE_EPOCH=$(date +%s) \
56
+ KO_DOCKER_REPO=ko.local/capi-runtime-extensions \
57
+ ko build \
58
+ --bare \
59
+ -t {{ .Version }} \
60
+ ./cmd
61
+ fi'
54
62
archives :
55
63
- name_template : ' {{ .ProjectName }}_v{{trimprefix .Version "v"}}_{{ .Os }}_{{ .Arch }}'
56
64
rlcp : true
57
65
builds :
58
66
- capi-runtime-extensions
59
- dockers :
60
- - image_templates :
61
- # Specify the image tag including `-amd64` suffix if the build is not a snapshot build or is not being built on
62
- # arm64 machine. This allows for using the snapshot image build without the architecture specific suffix
63
- # consistently on local machines, i.e. can always use `ghcr.io/d2iq-labs/capi-runtime-extensions:v<VERSION>` on the machine the snapshot
64
- # is built on.
65
- #
66
- # For a release build the `-amd64` suffix will always be included and the `docker_manifests` specification below
67
- # will create the final multiplatform manifest to be pushed to the registry.
68
- - ghcr.io/d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "amd64")) }}-amd64{{ end }}
69
- use : buildx
70
- dockerfile : Dockerfile
71
- build_flag_templates :
72
- - " --platform=linux/amd64"
73
- - " --pull"
74
- - " --label=org.opencontainers.image.created={{.Date}}"
75
- - " --label=org.opencontainers.image.title={{.ProjectName}}"
76
- - " --label=org.opencontainers.image.revision={{.FullCommit}}"
77
- - " --label=org.opencontainers.image.version={{.Version}}"
78
- - " --label=org.opencontainers.image.source={{.GitURL}}"
79
- - image_templates :
80
- # Specify the image tag including `-amd64v8` suffix if the build is not a snapshot build or is not being built on
81
- # arm64 machine. This allows for using the snapshot image build without the architecture specific suffix
82
- # consistently on local machines, i.e. can always use `ghcr.io/d2iq-labs/capi-runtime-extensions:v<VERSION>` on the machine the snapshot
83
- # is built on.
84
- #
85
- # For a release build the `-amd64v8` suffix will always be included and the `docker_manifests` specification below
86
- # will create the final multiplatform manifest to be pushed to the registry.
87
- - ghcr.io/d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}{{ if or (not .IsSnapshot) (not (eq .Runtime.Goarch "arm64")) }}-arm64v8{{ end }}
88
- use : buildx
89
- goarch : arm64
90
- dockerfile : Dockerfile
91
- build_flag_templates :
92
- - " --platform=linux/arm64"
93
- - " --pull"
94
- - " --label=org.opencontainers.image.created={{.Date}}"
95
- - " --label=org.opencontainers.image.title={{.ProjectName}}"
96
- - " --label=org.opencontainers.image.revision={{.FullCommit}}"
97
- - " --label=org.opencontainers.image.version={{.Version}}"
98
- - " --label=org.opencontainers.image.source={{.GitURL}}"
99
- docker_manifests :
100
- - name_template : ghcr.io/d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}
101
- image_templates :
102
- - ghcr.io/d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}-amd64
103
- - ghcr.io/d2iq-labs/{{.ProjectName}}:v{{trimprefix .Version "v"}}-arm64v8
67
+ kos :
68
+ - id : capi-runtime-extensions
69
+ build : capi-runtime-extensions
70
+ ldflags :
71
+ - -s
72
+ - -w
73
+ - -X 'k8s.io/component-base/version.buildDate={{ .CommitDate }}'
74
+ - -X 'k8s.io/component-base/version.gitCommit={{ .FullCommit }}'
75
+ - -X 'k8s.io/component-base/version.gitTreeState={{ .Env.GIT_TREE_STATE }}'
76
+ - -X 'k8s.io/component-base/version.gitVersion=v{{ trimprefix .Version "v" }}'
77
+ - -X 'k8s.io/component-base/version.major={{ .Major }}'
78
+ - -X 'k8s.io/component-base/version.minor={{ .Minor }}'
79
+ - -X 'k8s.io/component-base/version/verflag.programName={{ .ProjectName }}'
80
+ labels :
81
+ org.opencontainers.image.created : " {{ .CommitDate }}"
82
+ org.opencontainers.image.title : capi-runtime-extensions
83
+ org.opencontainers.image.revision : " {{ .FullCommit }}"
84
+ org.opencontainers.image.version : v{{trimprefix .Version "v"}}
85
+ org.opencontainers.image.source : " {{ .GitURL }}"
86
+ platforms :
87
+ - linux/amd64
88
+ - linux/arm64
89
+ repository : ' {{ envOrDefault "KO_DOCKER_REPO" "ghcr.io/d2iq-labs/capi-runtime-extensions" }}'
90
+ bare : true
91
+ tags :
92
+ - v{{trimprefix .Version "v"}}
104
93
checksum :
105
94
name_template : ' checksums.txt'
106
95
snapshot :
0 commit comments