Skip to content

Commit

Permalink
Bump go 1.18.1
Browse files Browse the repository at this point in the history
* 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 <twieczorek@mirantis.com>
  • Loading branch information
twz123 committed Apr 28, 2022
1 parent 935859d commit ba7a2cd
Show file tree
Hide file tree
Showing 18 changed files with 639 additions and 616 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/check-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
schedule:
- cron: "0 23 * * *"

env:
GO_VERSION: ~1.17
GO_VERSION_WIN: ~1.17

jobs:
terraform:
env:
Expand Down Expand Up @@ -46,7 +42,10 @@ jobs:
with:
ref: ${{ env.github_ref }}

- name: Set up Go 1.x
- name: Prepare build environment
run: .github/workflows/prepare-build-env.sh

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ on:
- 'mkdocs.yml'
- '*.md'

env:
GO_VERSION: ~1.17
GO_VERSION_WIN: ~1.17

jobs:
lint:
name: Lint
Expand All @@ -46,7 +42,10 @@ jobs:
env:
EMBEDDED_BINS_BUILDMODE: none

- name: Set up Go 1.x
- name: Prepare build environment
run: .github/workflows/prepare-build-env.sh

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
#pull_request:
env:
GO_VERSION: ~1.17
GO_VERSION_WIN: ~1.17

jobs:
release:
Expand Down Expand Up @@ -51,7 +48,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Set up Go 1.16
- name: Prepare build environment
run: .github/workflows/prepare-build-env.sh

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
Expand Down Expand Up @@ -118,7 +118,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Set up Go 1.x
- name: Prepare build environment
run: .github/workflows/prepare-build-env.sh

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
Expand Down Expand Up @@ -154,7 +157,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Set up Go 1.x
- name: Prepare build environment
run: .github/workflows/prepare-build-env.sh

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
Expand Down Expand Up @@ -345,7 +351,10 @@ jobs:
- name: Run git checkout
uses: actions/checkout@v2

- name: Set up Go 1.x
- name: Prepare build environment
run: .github/workflows/prepare-build-env.sh

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ endif
.PHONY: all
all: k0s k0s.exe

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

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

k0s.exe: TARGET_OS = windows
k0s.exe: BUILD_GO_CGO_ENABLED = 0
k0s.exe: GOLANG_IMAGE = golang:1.17-alpine
k0s.exe: GOLANG_IMAGE = golang:$(go_version)-alpine
k0s.exe: pkg/assets/zz_generated_offsets_windows.go

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


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

.PHONY: $(smoketests)
Expand Down
3 changes: 1 addition & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BUILDIMAGE=golang:1.17-alpine

ARG BUILDIMAGE
FROM $BUILDIMAGE
RUN apk add --no-cache gcc musl-dev binutils-gold

2 changes: 2 additions & 0 deletions build/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Intentionally left empty
// https://github.com/golang/go/issues/30058#issuecomment-543815369
2 changes: 1 addition & 1 deletion embedded-bins/Makefile.variables
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go_version = 1.17.9
go_version = 1.18.1

runc_version = 1.1.1
runc_buildimage = golang:$(go_version)-alpine
Expand Down
4 changes: 2 additions & 2 deletions embedded-bins/containerd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDIMAGE=golang:1.17-alpine
ARG BUILDIMAGE
FROM $BUILDIMAGE AS build

ARG VERSION
Expand All @@ -16,7 +16,7 @@ RUN apk upgrade -U -a && apk add \
protoc

RUN mkdir -p $GOPATH/src/github.com/containerd/containerd
RUN git clone -b v$VERSION --depth=1 https://github.com/containerd/containerd.git $GOPATH/src/github.com/containerd/containerd
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/containerd/containerd.git $GOPATH/src/github.com/containerd/containerd
WORKDIR /go/src/github.com/containerd/containerd
RUN go version
RUN make \
Expand Down
4 changes: 2 additions & 2 deletions embedded-bins/etcd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDIMAGE=golang:1.17-alpine
ARG BUILDIMAGE
FROM $BUILDIMAGE AS build

ARG VERSION
Expand All @@ -10,7 +10,7 @@ ARG BUILD_GO_LDFLAGS_EXTRA

RUN apk add build-base git

RUN cd / && git clone -b v$VERSION --depth=1 https://github.com/etcd-io/etcd.git
RUN cd / && git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/etcd-io/etcd.git
WORKDIR /etcd/server
RUN go version
RUN CGO_ENABLED=${BUILD_GO_CGO_ENABLED} \
Expand Down
4 changes: 2 additions & 2 deletions embedded-bins/kine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDIMAGE=golang:1.17-alpine
ARG BUILDIMAGE
FROM $BUILDIMAGE AS build

ARG VERSION
Expand All @@ -11,7 +11,7 @@ ARG BUILD_GO_LDFLAGS_EXTRA
RUN apk add build-base git


RUN cd / && git clone -b v$VERSION --depth=1 https://github.com/rancher/kine.git
RUN cd / && git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/rancher/kine.git
WORKDIR /kine
RUN go version
RUN CGO_ENABLED=${BUILD_GO_CGO_ENABLED} \
Expand Down
7 changes: 4 additions & 3 deletions embedded-bins/konnectivity/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDIMAGE=golang:1.17-alpine
ARG BUILDIMAGE
FROM $BUILDIMAGE AS build

ARG VERSION
Expand All @@ -10,10 +10,11 @@ ARG BUILD_GO_LDFLAGS_EXTRA

RUN apk add build-base git make protoc

RUN git clone -b v$VERSION --depth=1 https://github.com/k0sproject/apiserver-network-proxy.git /apiserver-network-proxy
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/k0sproject/apiserver-network-proxy.git /apiserver-network-proxy
WORKDIR /apiserver-network-proxy
RUN go version
RUN GO111MODULE=on go get github.com/golang/mock/mockgen@v1.4.4 github.com/golang/protobuf/protoc-gen-go@v1.4.3 && \
RUN go install github.com/golang/mock/mockgen@v1.4.4 && \
go install github.com/golang/protobuf/protoc-gen-go@v1.4.3 && \
make gen && \
CGO_ENABLED=${BUILD_GO_CGO_ENABLED} \
GOOS=linux \
Expand Down
7 changes: 4 additions & 3 deletions embedded-bins/kubernetes/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDIMAGE=golang:1.17-alpine
ARG BUILDIMAGE
FROM $BUILDIMAGE AS build

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

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

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

FROM scratch
Expand Down
2 changes: 1 addition & 1 deletion embedded-bins/kubernetes/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ENV KUBE_BUILD_PLATFORMS=windows/amd64
RUN apk add build-base git go-bindata linux-headers rsync grep coreutils bash

RUN mkdir -p $GOPATH/src/github.com/kubernetes/kubernetes
RUN git clone -b v$VERSION --depth=1 https://github.com/kubernetes/kubernetes.git $GOPATH/src/github.com/kubernetes/kubernetes
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/kubernetes/kubernetes.git $GOPATH/src/github.com/kubernetes/kubernetes
WORKDIR /go/src/github.com/kubernetes/kubernetes
RUN \
for cmd in $COMMANDS; do \
Expand Down
4 changes: 2 additions & 2 deletions embedded-bins/runc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDIMAGE=golang:1.17-alpine
ARG BUILDIMAGE
FROM $BUILDIMAGE AS build

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

RUN mkdir -p $GOPATH/src/github.com/opencontainers/runc
RUN git clone -b v$VERSION --depth=1 https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc
RUN git -c advice.detachedHead=false clone -b v$VERSION --depth=1 https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc
WORKDIR /go/src/github.com/opencontainers/runc
RUN go version
RUN make \
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/k0sproject/k0s

go 1.17
go 1.18

require (
github.com/Masterminds/sprig v2.22.0+incompatible
Expand Down
Loading

0 comments on commit ba7a2cd

Please sign in to comment.