Skip to content

Commit f15a61e

Browse files
committed
Bump go 1.18.1
Kubernetes 1.24 switched to go 1.18.1 as well. * Remove as many hard-coded go versions as possible * Also regenerate go.mod/go.sum for CI dependencies * Add empty go.mod to ignore build directory from go tools See golang/go#30058 (comment) * Add missing dependencies to Makefile targets * Set git config advice.detachedHead=false for embedded binaries So that there's less log spam * Change go get to go install for Konnectivity Signed-off-by: Tom Wieczorek <[email protected]>
1 parent 935859d commit f15a61e

File tree

18 files changed

+641
-617
lines changed

18 files changed

+641
-617
lines changed

.github/workflows/check-network.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ on:
88
schedule:
99
- cron: "0 23 * * *"
1010

11-
env:
12-
GO_VERSION: ~1.17
13-
GO_VERSION_WIN: ~1.17
14-
1511
jobs:
1612
terraform:
1713
env:
@@ -46,7 +42,10 @@ jobs:
4642
with:
4743
ref: ${{ env.github_ref }}
4844

49-
- name: Set up Go 1.x
45+
- name: Prepare build environment
46+
run: .github/workflows/prepare-build-env.sh
47+
48+
- name: Set up Go
5049
uses: actions/setup-go@v2
5150
with:
5251
go-version: ${{ env.GO_VERSION }}

.github/workflows/lint.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ on:
2929
- 'mkdocs.yml'
3030
- '*.md'
3131

32-
env:
33-
GO_VERSION: ~1.17
34-
GO_VERSION_WIN: ~1.17
35-
3632
jobs:
3733
lint:
3834
name: Lint
@@ -46,7 +42,10 @@ jobs:
4642
env:
4743
EMBEDDED_BINS_BUILDMODE: none
4844

49-
- name: Set up Go 1.x
45+
- name: Prepare build environment
46+
run: .github/workflows/prepare-build-env.sh
47+
48+
- name: Set up Go
5049
uses: actions/setup-go@v2
5150
with:
5251
go-version: ${{ env.GO_VERSION }}

.github/workflows/release.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
tags:
66
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
77
#pull_request:
8-
env:
9-
GO_VERSION: ~1.17
10-
GO_VERSION_WIN: ~1.17
118

129
jobs:
1310
release:
@@ -51,7 +48,10 @@ jobs:
5148
- name: Check out code into the Go module directory
5249
uses: actions/checkout@v2
5350

54-
- name: Set up Go 1.16
51+
- name: Prepare build environment
52+
run: .github/workflows/prepare-build-env.sh
53+
54+
- name: Set up Go
5555
uses: actions/setup-go@v2
5656
with:
5757
go-version: ${{ env.GO_VERSION }}
@@ -118,7 +118,10 @@ jobs:
118118
- name: Check out code into the Go module directory
119119
uses: actions/checkout@v2
120120

121-
- name: Set up Go 1.x
121+
- name: Prepare build environment
122+
run: .github/workflows/prepare-build-env.sh
123+
124+
- name: Set up Go
122125
uses: actions/setup-go@v2
123126
with:
124127
go-version: ${{ env.GO_VERSION }}
@@ -154,7 +157,10 @@ jobs:
154157
- name: Check out code into the Go module directory
155158
uses: actions/checkout@v2
156159

157-
- name: Set up Go 1.x
160+
- name: Prepare build environment
161+
run: .github/workflows/prepare-build-env.sh
162+
163+
- name: Set up Go
158164
uses: actions/setup-go@v2
159165
with:
160166
go-version: ${{ env.GO_VERSION }}
@@ -345,7 +351,10 @@ jobs:
345351
- name: Run git checkout
346352
uses: actions/checkout@v2
347353

348-
- name: Set up Go 1.x
354+
- name: Prepare build environment
355+
run: .github/workflows/prepare-build-env.sh
356+
357+
- name: Set up Go
349358
uses: actions/setup-go@v2
350359
with:
351360
go-version: ${{ env.GO_VERSION }}

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ endif
105105
.PHONY: all
106106
all: k0s k0s.exe
107107

108-
go.sum: go.mod
108+
go.sum: go.mod static/gen_manifests.go .k0sbuild.docker-image.k0s
109109
$(GO) mod tidy
110110

111111
zz_os = $(patsubst pkg/assets/zz_generated_offsets_%.go,%,$@)
@@ -139,7 +139,7 @@ k0s: .k0sbuild.docker-image.k0s
139139

140140
k0s.exe: TARGET_OS = windows
141141
k0s.exe: BUILD_GO_CGO_ENABLED = 0
142-
k0s.exe: GOLANG_IMAGE = golang:1.17-alpine
142+
k0s.exe: GOLANG_IMAGE = golang:$(go_version)-alpine
143143
k0s.exe: pkg/assets/zz_generated_offsets_windows.go
144144

145145
k0s.exe k0s: static/gen_manifests.go
@@ -157,7 +157,7 @@ k0s.exe k0s: $(GO_SRCS) go.sum
157157

158158

159159
.PHONY: lint
160-
lint: pkg/assets/zz_generated_offsets_$(shell go env GOOS).go
160+
lint: go.sum static/gen_manifests.go pkg/assets/zz_generated_offsets_$(shell go env GOOS).go
161161
$(golint) run --verbose $(GO_DIRS)
162162

163163
.PHONY: $(smoketests)

build/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
ARG BUILDIMAGE=golang:1.17-alpine
2-
1+
ARG BUILDIMAGE
32
FROM $BUILDIMAGE
43
RUN apk add --no-cache gcc musl-dev binutils-gold
54

build/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Intentionally left empty
2+
// https://github.com/golang/go/issues/30058#issuecomment-543815369

embedded-bins/Makefile.variables

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
go_version = 1.17.9
1+
go_version = 1.18.1
22

33
runc_version = 1.1.1
44
runc_buildimage = golang:$(go_version)-alpine

embedded-bins/containerd/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BUILDIMAGE=golang:1.17-alpine
1+
ARG BUILDIMAGE
22
FROM $BUILDIMAGE AS build
33

44
ARG VERSION
@@ -16,7 +16,7 @@ RUN apk upgrade -U -a && apk add \
1616
protoc
1717

1818
RUN mkdir -p $GOPATH/src/github.com/containerd/containerd
19-
RUN git clone -b v$VERSION --depth=1 https://github.com/containerd/containerd.git $GOPATH/src/github.com/containerd/containerd
19+
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/containerd/containerd.git $GOPATH/src/github.com/containerd/containerd
2020
WORKDIR /go/src/github.com/containerd/containerd
2121
RUN go version
2222
RUN make \

embedded-bins/etcd/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BUILDIMAGE=golang:1.17-alpine
1+
ARG BUILDIMAGE
22
FROM $BUILDIMAGE AS build
33

44
ARG VERSION
@@ -10,7 +10,7 @@ ARG BUILD_GO_LDFLAGS_EXTRA
1010

1111
RUN apk add build-base git
1212

13-
RUN cd / && git clone -b v$VERSION --depth=1 https://github.com/etcd-io/etcd.git
13+
RUN cd / && git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/etcd-io/etcd.git
1414
WORKDIR /etcd/server
1515
RUN go version
1616
RUN CGO_ENABLED=${BUILD_GO_CGO_ENABLED} \

embedded-bins/kine/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BUILDIMAGE=golang:1.17-alpine
1+
ARG BUILDIMAGE
22
FROM $BUILDIMAGE AS build
33

44
ARG VERSION
@@ -11,7 +11,7 @@ ARG BUILD_GO_LDFLAGS_EXTRA
1111
RUN apk add build-base git
1212

1313

14-
RUN cd / && git clone -b v$VERSION --depth=1 https://github.com/rancher/kine.git
14+
RUN cd / && git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/rancher/kine.git
1515
WORKDIR /kine
1616
RUN go version
1717
RUN CGO_ENABLED=${BUILD_GO_CGO_ENABLED} \

embedded-bins/konnectivity/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BUILDIMAGE=golang:1.17-alpine
1+
ARG BUILDIMAGE
22
FROM $BUILDIMAGE AS build
33

44
ARG VERSION
@@ -10,10 +10,11 @@ ARG BUILD_GO_LDFLAGS_EXTRA
1010

1111
RUN apk add build-base git make protoc
1212

13-
RUN git clone -b v$VERSION --depth=1 https://github.com/k0sproject/apiserver-network-proxy.git /apiserver-network-proxy
13+
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/k0sproject/apiserver-network-proxy.git /apiserver-network-proxy
1414
WORKDIR /apiserver-network-proxy
1515
RUN go version
16-
RUN GO111MODULE=on go get github.com/golang/mock/[email protected] github.com/golang/protobuf/[email protected] && \
16+
RUN go install github.com/golang/mock/[email protected] && \
17+
go install github.com/golang/protobuf/[email protected] && \
1718
make gen && \
1819
CGO_ENABLED=${BUILD_GO_CGO_ENABLED} \
1920
GOOS=linux \

embedded-bins/kubernetes/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BUILDIMAGE=golang:1.17-alpine
1+
ARG BUILDIMAGE
22
FROM $BUILDIMAGE AS build
33

44
ARG VERSION
@@ -13,18 +13,19 @@ ENV COMMANDS="kubelet kube-apiserver kube-scheduler kube-controller-manager"
1313
RUN apk add build-base git go-bindata linux-headers rsync grep coreutils bash
1414

1515
RUN mkdir -p $GOPATH/src/github.com/kubernetes/kubernetes
16-
RUN git clone -b v$VERSION --depth=1 https://github.com/kubernetes/kubernetes.git $GOPATH/src/github.com/kubernetes/kubernetes
16+
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/kubernetes/kubernetes.git $GOPATH/src/github.com/kubernetes/kubernetes
1717
WORKDIR /go/src/github.com/kubernetes/kubernetes
1818

1919
RUN go version
2020
RUN \
21+
set -e; \
2122
# Ensure that all of the binaries are built with CGO \
2223
if [ ${BUILD_GO_CGO_ENABLED:-0} -eq 1 ]; then \
2324
export KUBE_CGO_OVERRIDES="${COMMANDS}"; \
2425
fi; \
2526
for cmd in $COMMANDS; do \
2627
export KUBE_GIT_VERSION="v$VERSION+k0s"; \
27-
make GOFLAGS="${BUILD_GO_FLAGS} -tags=${BUILD_GO_TAGS}" GOLDFLAGS="${BUILD_GO_LDFLAGS_EXTRA}" WHAT=cmd/$cmd || break;\
28+
make GOFLAGS="${BUILD_GO_FLAGS} -tags=${BUILD_GO_TAGS}" GOLDFLAGS="${BUILD_GO_LDFLAGS_EXTRA}" WHAT=cmd/$cmd; \
2829
done
2930

3031
FROM scratch

embedded-bins/kubernetes/Dockerfile.windows

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ ENV KUBE_BUILD_PLATFORMS=windows/amd64
99
RUN apk add build-base git go-bindata linux-headers rsync grep coreutils bash
1010

1111
RUN mkdir -p $GOPATH/src/github.com/kubernetes/kubernetes
12-
RUN git clone -b v$VERSION --depth=1 https://github.com/kubernetes/kubernetes.git $GOPATH/src/github.com/kubernetes/kubernetes
12+
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/kubernetes/kubernetes.git $GOPATH/src/github.com/kubernetes/kubernetes
1313
WORKDIR /go/src/github.com/kubernetes/kubernetes
1414
RUN \
15+
set -e; \
1516
for cmd in $COMMANDS; do \
16-
make GOFLAGS="-v -tags=providerless" GOLDFLAGS="-extldflags=-static -w -s" WHAT=cmd/$cmd || break;\
17+
make GOFLAGS="-v -tags=providerless" GOLDFLAGS="-extldflags=-static -w -s" WHAT=cmd/$cmd; \
1718
done
1819

1920
FROM scratch

embedded-bins/runc/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG BUILDIMAGE=golang:1.17-alpine
1+
ARG BUILDIMAGE
22
FROM $BUILDIMAGE AS build
33

44
ARG VERSION
@@ -24,7 +24,7 @@ RUN make -j$(nproc) -C /libseccomp-$LIBSECCOMP_VERSION check
2424
RUN make -C /libseccomp-$LIBSECCOMP_VERSION install
2525

2626
RUN mkdir -p $GOPATH/src/github.com/opencontainers/runc
27-
RUN git clone -b v$VERSION --depth=1 https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc
27+
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc
2828
WORKDIR /go/src/github.com/opencontainers/runc
2929
RUN go version
3030
RUN make \

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/k0sproject/k0s
22

3-
go 1.17
3+
go 1.18
44

55
require (
66
github.com/Masterminds/sprig v2.22.0+incompatible

0 commit comments

Comments
 (0)