Skip to content

Commit b1c0cad

Browse files
committed
Build with Go 1.25
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 47cc2cb commit b1c0cad

File tree

7 files changed

+34
-115
lines changed

7 files changed

+34
-115
lines changed

.github/workflows/build.yaml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: build
22
on:
3+
workflow_dispatch:
34
pull_request:
45
push:
56
branches: [ 'main', 'release/**' ]
@@ -16,31 +17,26 @@ jobs:
1617
- name: Setup Go
1718
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1819
with:
19-
go-version: 1.24.x
20+
go-version: 1.25.x
2021
cache-dependency-path: |
2122
**/go.sum
2223
**/go.mod
24+
- name: Setup QEMU
25+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
26+
- name: Setup Docker Buildx
27+
id: buildx
28+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
2329
- name: Run tests
2430
run: make test
2531
- name: Verify
2632
run: make verify
27-
28-
kind-linux-arm64:
29-
runs-on:
30-
group: "ARM64"
31-
steps:
32-
- name: checkout
33-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
34-
- name: Setup Go
35-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
36-
with:
37-
go-version: 1.24.x
38-
cache-dependency-path: |
39-
**/go.sum
40-
**/go.mod
41-
- name: Run tests
42-
run: make test
43-
env:
44-
SKIP_COSIGN_VERIFICATION: true
45-
- name: Verify
46-
run: make verify
33+
- name: Build multi-arch container image
34+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
35+
with:
36+
push: false
37+
builder: ${{ steps.buildx.outputs.name }}
38+
context: .
39+
file: ./Dockerfile
40+
platforms: linux/amd64,linux/arm/v7,linux/arm64
41+
tags: |
42+
${{ github.repository }}:latest

.github/workflows/cifuzz.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Go
1616
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1717
with:
18-
go-version: 1.24.x
18+
go-version: 1.25.x
1919
cache-dependency-path: |
2020
**/go.sum
2121
**/go.mod

.github/workflows/nightly.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Setup Go
3636
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
3737
with:
38-
go-version: 1.24.x
38+
go-version: 1.25.x
3939
cache-dependency-path: |
4040
**/go.sum
4141
**/go.mod

DEVELOPMENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ There are a number of dependencies required to be able to run the controller and
1515

1616
The following dependencies are also used by some of the `make` targets:
1717

18-
- `controller-gen` (v0.7.0)
18+
- `controller-gen` (v0.19.0)
1919
- `gen-crd-api-reference-docs` (v0.3.0)
2020
- `setup-envtest` (latest)
2121

@@ -24,7 +24,7 @@ If any of the above dependencies are not present on your system, the first invoc
2424
## How to run the test suite
2525

2626
Prerequisites:
27-
* Go >= 1.24
27+
* Go >= 1.25
2828

2929
You can run the test suite by simply doing
3030

Dockerfile

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
1-
ARG BASE_VARIANT=alpine
2-
ARG GO_VERSION=1.24
1+
ARG GO_VERSION=1.25
32
ARG XX_VERSION=1.6.1
43

54
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
65

7-
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${BASE_VARIANT} AS gostable
8-
9-
FROM gostable AS go-linux
10-
11-
# Build-base consists of build platform dependencies and xx.
12-
# These will be used at current arch to yield execute the cross compilations.
13-
FROM go-${TARGETOS} AS build-base
14-
15-
RUN apk add clang lld
6+
# Docker buildkit multi-arch build requires golang alpine
7+
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS builder
168

9+
# Copy the build utilities.
1710
COPY --from=xx / /
1811

19-
# build can still be cached at build platform architecture.
20-
FROM build-base AS build
21-
2212
ARG TARGETPLATFORM
2313

24-
# Some dependencies have to installed for the target platform:
25-
# https://github.com/tonistiigi/xx#go--cgo
26-
RUN xx-apk add musl-dev gcc
27-
2814
# Configure workspace
2915
WORKDIR /workspace
3016

@@ -45,28 +31,17 @@ COPY internal/ internal/
4531
ARG TARGETPLATFORM
4632
ARG TARGETARCH
4733

48-
# Reasons why CGO is in use:
49-
# - The SHA1 implementation (sha1cd) used by go-git depends on CGO for
50-
# performance reasons. See: https://github.com/pjbgf/sha1cd/issues/15
51-
ENV CGO_ENABLED=1
52-
53-
RUN export CGO_LDFLAGS="-static -fuse-ld=lld" && \
54-
xx-go build \
55-
-ldflags "-s -w" \
56-
-tags 'netgo,osusergo,static_build' \
57-
-o /image-automation-controller -trimpath main.go;
58-
59-
# Ensure that the binary was cross-compiled correctly to the target platform.
60-
RUN xx-verify --static /image-automation-controller
34+
# build without specifing the arch
35+
ENV CGO_ENABLED=0
36+
RUN xx-go build -trimpath -a -o image-automation-controller main.go
6137

62-
FROM alpine:3.21
38+
FROM alpine:3.22
6339

6440
ARG TARGETPLATFORM
6541
RUN apk --no-cache add ca-certificates \
6642
&& update-ca-certificates
6743

68-
# Copy over binary from build
69-
COPY --from=build /image-automation-controller /usr/local/bin/
44+
COPY --from=builder /workspace/image-automation-controller /usr/local/bin/
7045

7146
USER 65534:65534
7247
ENTRYPOINT [ "image-automation-controller" ]

Makefile

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7
1515
# Allows for defining additional Go test args, e.g. '-tags integration'.
1616
GO_TEST_ARGS ?= -race
1717

18-
# Defines whether cosign verification should be skipped.
19-
SKIP_COSIGN_VERIFICATION ?= false
20-
2118
# Directory with versioned, downloaded things
2219
CACHE := cache
2320

@@ -37,14 +34,6 @@ BUILD_DIR := $(REPOSITORY_ROOT)/build
3734
# each fuzzer should run for.
3835
FUZZ_TIME ?= 1m
3936

40-
ifeq ($(shell uname -s),Darwin)
41-
GO_STATIC_FLAGS=-ldflags "-s -w" -tags 'netgo,osusergo,static_build'
42-
endif
43-
44-
ifeq ($(shell uname -s),Linux)
45-
GO_STATIC_FLAGS=-ldflags "-s -w" -tags 'netgo,osusergo,static_build'
46-
endif
47-
4837
# API (doc) generation utilities
4938
CONTROLLER_GEN_VERSION ?= v0.19.0
5039
GEN_API_REF_DOCS_VERSION ?= e327d0730470cbd61b06300f81c5fcf91c23c113
@@ -103,15 +92,10 @@ ${CACHE}/imagepolicies_${REFLECTOR_VER}.yaml:
10392
curl -s --fail https://raw.githubusercontent.com/fluxcd/image-reflector-controller/${REFLECTOR_VER}/config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml \
10493
-o ${CACHE}/imagepolicies_${REFLECTOR_VER}.yaml
10594

106-
check-deps:
107-
ifeq ($(shell uname -s),Darwin)
108-
if ! command -v pkg-config &> /dev/null; then echo "pkg-config is required"; exit 1; fi
109-
endif
110-
11195
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
11296
test: tidy test-api test_deps generate fmt vet manifests api-docs install-envtest ## Run tests
11397
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) \
114-
go test $(GO_STATIC_FLAGS) $(GO_TEST_ARGS) ./... -coverprofile cover.out
98+
go test $(GO_TEST_ARGS) ./... -coverprofile cover.out
11599

116100
test-api: ## Run api tests
117101
cd api; go test $(GO_TEST_ARGS) ./... -coverprofile cover.out
@@ -120,7 +104,7 @@ manager: generate fmt vet ## Build manager binary
120104
go build -o $(BUILD_DIR)/bin/manager ./main.go
121105

122106
run: generate fmt vet manifests # Run against the configured Kubernetes cluster in ~/.kube/config
123-
go run $(GO_STATIC_FLAGS) ./main.go --log-level=${LOG_LEVEL} --log-encoding=console
107+
go run ./main.go --log-level=${LOG_LEVEL} --log-encoding=console
124108

125109
install: manifests ## Install CRDs into a cluster
126110
kustomize build config/crd | kubectl apply -f -
@@ -146,8 +130,8 @@ api-docs: gen-crd-api-reference-docs ## Generate API reference documentation
146130
$(GEN_CRD_API_REFERENCE_DOCS) -api-dir=./api/v1beta2 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/v1beta2/image-automation.md
147131

148132
tidy: ## Run go mod tidy
149-
cd api; rm -f go.sum; go mod tidy -compat=1.24
150-
rm -f go.sum; go mod tidy -compat=1.24
133+
cd api; rm -f go.sum; go mod tidy -compat=1.25
134+
rm -f go.sum; go mod tidy -compat=1.25
151135

152136
fmt: ## Run go fmt against code
153137
go fmt ./...
@@ -236,9 +220,6 @@ rm -rf $$TMP_DIR ;\
236220
}
237221
endef
238222

239-
update-attributions:
240-
./hack/update-attributions.sh
241-
242223
verify:
243224
ifneq (, $(shell git status --porcelain --untracked-files=no))
244225
@{ \

0 commit comments

Comments
 (0)