Repository navigation
Expand file tree
/
Copy path.goreleaser.yaml
More file actions
82 lines (76 loc) · 2.93 KB
/
Copy path.goreleaser.yaml
File metadata and controls
82 lines (76 loc) · 2.93 KB
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
# GoReleaser configuration.
# Cuts a GitHub release and publishes multi-arch (linux/amd64,linux/arm64)
# container images to the ghcr repo. Runs in CI only; see
# .github/workflows/release.yml. Test locally with `make release-snapshot`.
#
# Docs: https://goreleaser.com/customization/ko/
version: 2
before:
hooks:
# Packages both charts (--version/--app-version) into _artifacts/helm and
# renders infrastructure-components.yaml from the packaged chart. The
# version is passed on the make command line because the top-level `env:`
# section is evaluated before {{ .Version }} is computed.
- make manifests VERSION={{ .Version }} IMAGE_TAG={{ .Version }}
# ko re-builds the binary itself using these settings (results are cached from
# the build pipe). CGO is disabled so the image can run on the distroless base.
builds:
- id: capox
main: ./cmd
binary: capox
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
mod_timestamp: '{{ .CommitTimestamp }}'
goos:
- linux
goarch:
- amd64
- arm64
# Build and publish multi-arch images with ko. Auth comes from the CI env
# (docker login to ghcr.io); the base image defaults to the distroless,
# nonroot cgr.dev/chainguard/static.
kos:
- build: capox
repositories:
- ghcr.io/oxidecomputer/cluster-api-provider-oxide
platforms:
- linux/amd64
- linux/arm64
tags:
- "{{ .Version }}"
- latest
# Push to the bare repo (no import-path or MD5 suffix).
bare: true
preserve_import_paths: false
# Reproducible image/file timestamps from the release commit.
creation_time: "{{ .CommitTimestamp }}"
ko_data_creation_time: "{{ .CommitTimestamp }}"
checksum:
name_template: "checksums.txt"
extra_files:
- glob: ./_artifacts/helm/*.tgz
- glob: ./_artifacts/infrastructure-components.yaml
- glob: ./_artifacts/metadata.yaml
- glob: ./templates/cluster-template.yaml
# Attach the clusterctl provider artifacts to the GitHub release so
# `clusterctl init --infrastructure oxide` can discover and install the
# provider. metadata.yaml maps release versions to CAPI contract versions and
# must accompany the components manifest. It is not tracked in the repo:
# hack/gen-capi-metadata.sh derives it entirely from git tags, and the
# Makefile release targets generate it at _artifacts/metadata.yaml before
# invoking goreleaser.
release:
extra_files:
- glob: ./_artifacts/infrastructure-components.yaml
- glob: ./_artifacts/metadata.yaml
- glob: ./templates/cluster-template.yaml
# NOTE: helm charts are pushed to the OCI registry by the `release` Makefile
# target after goreleaser finishes. A custom publisher can't do it: goreleaser
# runs publishers against every extra file attached to the release, so
# `helm push` would also be invoked on metadata.yaml and infrastructure-components.yaml.