Skip to content

Commit 8cb24dd

Browse files
authored
🤖 ci: fix GoReleaser warnings (#86)
Summary - Fixes GoReleaser warnings seen in Actions run 22005983139 (job 63589721092) by pinning the action to GoReleaser v2 and updating our GoReleaser configuration to v2. Background - The release workflow was installing GoReleaser with `version: latest`, and GoReleaser v2 emits warnings for v0/v1 config and several deprecated keys. Implementation - Pin `goreleaser/goreleaser-action` to `version: "~> v2"`. - Update `.goreleaser.yaml`: - add `version: 2` - migrate `archives.format` -> `archives.formats` - migrate `dockers` -> `dockers_v2` - Update `Dockerfile.goreleaser` to use `$TARGETPLATFORM/...` copy layout required by `dockers_v2`. Validation - `goreleaser check` - `go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.10` - `make test` - `make build` - `make verify-vendor` - `make lint` Risks - Low; changes are limited to release tooling/config. --- _Generated with [`mux`](https://github.com/coder/mux) • Model: `openai:gpt-5.2` • Thinking: `xhigh` • Cost: `$0.00`_ <!-- mux-attribution: model=openai:gpt-5.2 thinking=xhigh costs=0.00 -->
1 parent e7fe0e0 commit 8cb24dd

5 files changed

Lines changed: 57 additions & 26 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ jobs:
194194
CGO_ENABLED: "0"
195195
GOOS: linux
196196
GOARCH: amd64
197-
run: go build -o coder-k8s ./
197+
run: |
198+
mkdir -p linux/amd64
199+
go build -o linux/amd64/coder-k8s ./
198200
199201
- name: Build and load image
200202
if: github.event_name != 'pull_request'
@@ -425,7 +427,9 @@ jobs:
425427
CGO_ENABLED: "0"
426428
GOOS: linux
427429
GOARCH: amd64
428-
run: go build -o coder-k8s ./
430+
run: |
431+
mkdir -p linux/amd64
432+
go build -o linux/amd64/coder-k8s ./
429433
430434
- name: Set up Docker Buildx
431435
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0

‎.github/workflows/release.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
4040
with:
4141
distribution: goreleaser
42-
version: latest
42+
version: "~> v2"
4343
args: release --clean
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.goreleaser.yaml‎

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: 2
2+
13
project_name: coder-k8s
24

35
before:
@@ -19,31 +21,39 @@ builds:
1921

2022
archives:
2123
- id: default
22-
format: tar.gz
24+
formats: [tar.gz]
2325
files:
24-
- none*
26+
- LICENSE
27+
- README.md
2528

26-
dockers:
29+
dockers_v2:
2730
- id: coder-k8s-image
28-
image_templates:
29-
- "ghcr.io/coder/coder-k8s:{{ .Version }}"
30-
- "ghcr.io/coder/coder-k8s:latest"
3131
dockerfile: Dockerfile.goreleaser
32-
use: buildx
33-
build_flag_templates:
34-
- "--pull"
35-
- "--platform=linux/amd64"
36-
- "--label=org.opencontainers.image.created={{ .Date }}"
37-
- "--label=org.opencontainers.image.source=https://github.com/coder/coder-k8s"
38-
- "--label=org.opencontainers.image.url=https://coder.github.io/coder-k8s/"
39-
- "--label=org.opencontainers.image.documentation=https://coder.github.io/coder-k8s/"
40-
- "--label=org.opencontainers.image.title=coder-k8s"
41-
- "--label=org.opencontainers.image.description=Kubernetes operator for Coder"
42-
- "--label=org.opencontainers.image.version={{ .Version }}"
43-
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
44-
- "--label=org.opencontainers.image.vendor=Coder"
45-
- "--label=org.opencontainers.image.licenses=Apache-2.0"
46-
- "--label=org.opencontainers.image.authors=Coder"
32+
ids:
33+
- coder-k8s
34+
images:
35+
- ghcr.io/coder/coder-k8s
36+
tags:
37+
- "{{ .Version }}"
38+
- latest
39+
platforms:
40+
- linux/amd64
41+
sbom: false
42+
labels:
43+
org.opencontainers.image.created: "{{ .Date }}"
44+
org.opencontainers.image.source: https://github.com/coder/coder-k8s
45+
org.opencontainers.image.url: https://coder.github.io/coder-k8s/
46+
org.opencontainers.image.documentation: https://coder.github.io/coder-k8s/
47+
org.opencontainers.image.title: coder-k8s
48+
org.opencontainers.image.description: Kubernetes operator for Coder
49+
org.opencontainers.image.version: "{{ .Version }}"
50+
org.opencontainers.image.revision: "{{ .FullCommit }}"
51+
org.opencontainers.image.vendor: Coder
52+
org.opencontainers.image.licenses: Apache-2.0
53+
org.opencontainers.image.authors: Coder
54+
flags:
55+
- "--pull=true"
56+
- "--provenance=false"
4757

4858
changelog:
4959
use: github

‎Dockerfile.goreleaser‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM gcr.io/distroless/static:nonroot
22

3+
ARG TARGETPLATFORM
4+
35
ENTRYPOINT ["/coder-k8s"]
4-
COPY coder-k8s /coder-k8s
6+
COPY $TARGETPLATFORM/coder-k8s /coder-k8s
57
USER nonroot:nonroot

‎hack/kind-dev.sh‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,22 @@ build_binary() {
109109
fi
110110
fi
111111

112-
GOFLAGS=-mod=vendor CGO_ENABLED=0 GOOS=linux GOARCH="${resolved_goarch}" go build -o coder-k8s ./
112+
local resolved_goarm=""
113+
local target_platform="linux/${resolved_goarch}"
114+
if [[ "${resolved_goarch}" == "arm" ]]; then
115+
resolved_goarm="${GOARM:-}"
116+
if [[ -z "${resolved_goarm}" ]]; then
117+
resolved_goarm="$(go env GOARM)"
118+
if [[ -z "${resolved_goarm}" ]]; then
119+
echo "assertion failed: go env GOARM returned an empty value for GOARCH=arm" >&2
120+
exit 1
121+
fi
122+
fi
123+
target_platform="linux/arm/v${resolved_goarm}"
124+
fi
125+
126+
mkdir -p "${target_platform}"
127+
GOFLAGS=-mod=vendor CGO_ENABLED=0 GOOS=linux GOARCH="${resolved_goarch}" GOARM="${resolved_goarm}" go build -o "${target_platform}/coder-k8s" ./
113128
}
114129

115130
build_and_load_image() {

0 commit comments

Comments
 (0)