Skip to content

Commit df32247

Browse files
authored
Update to Go 1.26.4, build runners and go.mod depedencies (#3108)
* update golang and dependencies * fix incorrect log formatting * clean mod chache and introduce GOARCH in Dockerfile (choose dynamically) * remove GO111MODULE mentions * bump github actions from v2 to v3 * bump docker runners to v7 * use extra event store for backwards compatibility with existing codebase * updated generated opconfig api
1 parent a664816 commit df32247

34 files changed

Lines changed: 1219 additions & 405 deletions

.github/workflows/publish_ghcr_image.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
packages: write
2020
steps:
2121
- name: Checkout repository
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v6
2323

24-
- uses: actions/setup-go@v2
24+
- uses: actions/setup-go@v6
2525
with:
26-
go-version: "^1.25.3"
26+
go-version: "^1.26.4"
2727

2828
- name: Run unit tests
2929
run: make test
@@ -53,20 +53,20 @@ jobs:
5353
echo "BACKUP_IMAGE=$BACKUP_IMAGE" >> $GITHUB_OUTPUT
5454
5555
- name: Set up QEMU
56-
uses: docker/setup-qemu-action@v2
56+
uses: docker/setup-qemu-action@v4
5757

5858
- name: Set up Docker Buildx
59-
uses: docker/setup-buildx-action@v2
59+
uses: docker/setup-buildx-action@v4
6060

6161
- name: Login to GHCR
62-
uses: docker/login-action@v2
62+
uses: docker/login-action@v4
6363
with:
6464
registry: ${{ env.REGISTRY }}
6565
username: ${{ github.actor }}
6666
password: ${{ secrets.GITHUB_TOKEN }}
6767

6868
- name: Build and push multiarch operator image to ghcr
69-
uses: docker/build-push-action@v3
69+
uses: docker/build-push-action@v7
7070
with:
7171
context: .
7272
file: docker/Dockerfile
@@ -76,7 +76,7 @@ jobs:
7676
platforms: linux/amd64,linux/arm64
7777

7878
- name: Build and push multiarch pooler image to ghcr
79-
uses: docker/build-push-action@v3
79+
uses: docker/build-push-action@v7
8080
with:
8181
context: pooler
8282
push: true
@@ -85,7 +85,7 @@ jobs:
8585
platforms: linux/amd64,linux/arm64
8686

8787
- name: Build and push multiarch ui image to ghcr
88-
uses: docker/build-push-action@v3
88+
uses: docker/build-push-action@v7
8989
with:
9090
context: ui
9191
push: true
@@ -94,7 +94,7 @@ jobs:
9494
platforms: linux/amd64,linux/arm64
9595

9696
- name: Build and push multiarch logical-backup image to ghcr
97-
uses: docker/build-push-action@v3
97+
uses: docker/build-push-action@v7
9898
with:
9999
context: logical-backup
100100
push: true

.github/workflows/run_e2e.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
name: End-2-End tests
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v1
15-
- uses: actions/setup-go@v2
14+
- uses: actions/checkout@v6
15+
- uses: actions/setup-go@v6
1616
with:
17-
go-version: "^1.25.3"
17+
go-version: "^1.26.4"
1818
- name: Make dependencies
1919
run: make mocks
2020
- name: Code generation

.github/workflows/run_tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
name: Unit tests and coverage
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-go@v2
14+
- uses: actions/checkout@v6
15+
- uses: actions/setup-go@v6
1616
with:
17-
go-version: "^1.25.3"
17+
go-version: "^1.26.4"
1818
- name: Make dependencies
1919
run: make mocks
2020
- name: Compile

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
BINARY ?= postgres-operator
44
BUILD_FLAGS ?= -v
5+
GOARCH ?= amd64
56
CGO_ENABLED ?= 0
67
ifeq ($(RACE),1)
78
BUILD_FLAGS += -race -a
@@ -83,10 +84,10 @@ wasm: ${SOURCES} $(GENERATED_CRDS)
8384
GOOS=wasip1 GOARCH=wasm CGO_ENABLED=${CGO_ENABLED} go build -o build/${BINARY}.wasm ${BUILD_FLAGS} -ldflags "$(LDFLAGS)" $(SOURCES)
8485

8586
linux: ${SOURCES} $(GENERATED_CRDS)
86-
GOOS=linux GOARCH=amd64 CGO_ENABLED=${CGO_ENABLED} go build -o build/linux/${BINARY} ${BUILD_FLAGS} -ldflags "$(LDFLAGS)" $(SOURCES)
87+
GOOS=linux GOARCH=${GOARCH} CGO_ENABLED=${CGO_ENABLED} go build -o build/linux/${BINARY} ${BUILD_FLAGS} -ldflags "$(LDFLAGS)" $(SOURCES)
8788

8889
macos: ${SOURCES} $(GENERATED_CRDS)
89-
GOOS=darwin GOARCH=amd64 CGO_ENABLED=${CGO_ENABLED} go build -o build/macos/${BINARY} ${BUILD_FLAGS} -ldflags "$(LDFLAGS)" $(SOURCES)
90+
GOOS=darwin GOARCH=${GOARCH} CGO_ENABLED=${CGO_ENABLED} go build -o build/macos/${BINARY} ${BUILD_FLAGS} -ldflags "$(LDFLAGS)" $(SOURCES)
9091

9192
docker: $(GENERATED_CRDS) ${DOCKERDIR}/${DOCKERFILE}
9293
echo `(env)`
@@ -100,10 +101,10 @@ pooler:
100101
cd pooler; docker build --rm -t "$(POOLER_TAG)" --build-arg VERSION="${VERSION}" --build-arg BASE_IMAGE="${BASE_IMAGE}" .
101102

102103
indocker-race:
103-
docker run --rm -v "${GOPATH}":"${GOPATH}" -e GOPATH="${GOPATH}" -e RACE=1 -w ${PWD} golang:1.25.3 bash -c "make linux"
104+
docker run --rm -v "${GOPATH}":"${GOPATH}" -e GOPATH="${GOPATH}" -e RACE=1 -w ${PWD} golang:1.26.4 bash -c "make linux"
104105

105106
mocks:
106-
GO111MODULE=on go generate ./...
107+
go generate ./...
107108

108109
fmt:
109110
@gofmt -l -w -s $(DIRS)
@@ -113,7 +114,7 @@ vet:
113114
@staticcheck $(PKG)
114115

115116
test: mocks $(GENERATED) $(GENERATED_CRDS)
116-
GO111MODULE=on go test ./...
117+
go test ./...
117118

118119
codegen: $(GENERATED)
119120

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ production for over five years.
6363

6464
| Release | Postgres versions | K8s versions | Golang |
6565
| :-------- | :---------------: | :---------------: | :-----: |
66+
| next | 14 → 18 | 1.27+ | 1.26.4 |
6667
| v1.15.1 | 13 → 17 | 1.27+ | 1.25.3 |
6768
| v1.14.0 | 13 → 17 | 1.27+ | 1.23.4 |
6869
| v1.13.0 | 12 → 16 | 1.27+ | 1.22.5 |

docker/DebugDockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.25-alpine
1+
FROM golang:1.26-alpine
22
LABEL maintainer="Team ACID @ Zalando <team-acid@zalando.de>"
33

44
# We need root certificates to deal with teams api over https

docker/Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
ARG BASE_IMAGE=alpine:latest
2-
FROM golang:1.25-alpine AS builder
2+
3+
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
34
ARG VERSION=latest
5+
ARG TARGETOS
6+
ARG TARGETARCH
47

58
COPY . /go/src/github.com/zalando/postgres-operator
69
WORKDIR /go/src/github.com/zalando/postgres-operator
710

8-
RUN GO111MODULE=on go mod vendor \
9-
&& CGO_ENABLED=0 go build -o build/postgres-operator -v -ldflags "-X=main.version=${VERSION}" cmd/main.go
11+
RUN go clean -cache -modcache
12+
RUN go mod vendor \
13+
&& CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o build/postgres-operator -v -ldflags "-X=main.version=${VERSION}" cmd/main.go
1014

11-
FROM ${BASE_IMAGE}
15+
ARG BASE_IMAGE
16+
FROM --platform=$TARGETPLATFORM ${BASE_IMAGE}
1217
LABEL maintainer="Team ACID @ Zalando <team-acid@zalando.de>"
1318
LABEL org.opencontainers.image.source="https://github.com/zalando/postgres-operator"
1419

docker/build_operator.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ apt-get install -y wget
1313

1414
(
1515
cd /tmp
16-
wget -q "https://storage.googleapis.com/golang/go1.25.3.linux-${arch}.tar.gz" -O go.tar.gz
16+
wget -q "https://storage.googleapis.com/golang/go1.26.4.linux-${arch}.tar.gz" -O go.tar.gz
1717
tar -xf go.tar.gz
1818
mv go /usr/local
1919
ln -s /usr/local/go/bin/go /usr/bin/go
@@ -26,5 +26,6 @@ export PATH="$PATH:$HOME/go/bin"
2626
export GOPATH="$HOME/go"
2727
mkdir -p build
2828

29-
GO111MODULE=on go mod vendor
29+
go clean -cache -modcache
30+
go mod vendor
3031
CGO_ENABLED=0 go build -o build/postgres-operator -v -ldflags "$OPERATOR_LDFLAGS" cmd/main.go

e2e/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENV TERM xterm-256color
88
RUN apt-get -qq -y update \
99
# https://www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary
1010
&& apt-get -qq -y install --no-install-recommends curl vim python3-dev \
11-
&& curl -LO https://dl.k8s.io/release/v1.32.9/bin/linux/amd64/kubectl \
11+
&& curl -LO https://dl.k8s.io/release/v1.36.1/bin/linux/amd64/kubectl \
1212
&& chmod +x ./kubectl \
1313
&& mv ./kubectl /usr/local/bin/kubectl \
1414
&& apt-get -qq -y clean \

e2e/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ tools:
4646
# install pinned version of 'kind'
4747
# go install must run outside of a dir with a (module-based) Go project !
4848
# otherwise go install updates project's dependencies and/or behaves differently
49-
cd "/tmp" && GO111MODULE=on go install sigs.k8s.io/kind@v0.27.0
49+
cd "/tmp" && go install sigs.k8s.io/kind@v0.27.0
5050

5151
e2etest: tools copy clean
5252
./run.sh main

0 commit comments

Comments
 (0)