Skip to content

Commit

Permalink
Upgrade go to 1.16 (#4706)
Browse files Browse the repository at this point in the history
* bump golang to 1.16

* bump e2e image to v20210808-1eaeec7-master

* fix lint

* update build pod label for jenkins

* add gocovmerge

* fix docker regisrty

* pull ci image from harbor
  • Loading branch information
KanShiori authored Sep 16, 2022
1 parent 00a126c commit 89faa4d
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 81 deletions.
2 changes: 1 addition & 1 deletion ci/e2e_eks.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ kind: Pod
spec:
containers:
- name: main
image: gcr.io/k8s-testimages/kubekins-e2e:v20200311-1e25827-master
image: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v20210808-1eaeec7-master
command:
- runner.sh
- sleep
Expand Down
2 changes: 1 addition & 1 deletion ci/e2e_gke.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ kind: Pod
spec:
containers:
- name: main
image: gcr.io/k8s-testimages/kubekins-e2e:v20200311-1e25827-master
image: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v20210808-1eaeec7-master
command:
- runner.sh
- sleep
Expand Down
2 changes: 1 addition & 1 deletion ci/e2e_kind.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
spec:
containers:
- name: main
image: gcr.io/k8s-testimages/kubekins-e2e:v20200311-1e25827-master
image: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v20210808-1eaeec7-master
command:
- runner.sh
# Clean containers on TERM signal in root process to avoid cgroup leaking.
Expand Down
14 changes: 4 additions & 10 deletions ci/pull_e2e_kind.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ metadata:
spec:
containers:
- name: main
image: gcr.io/k8s-testimages/kubekins-e2e:v20200311-1e25827-master
image: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v20210808-1eaeec7-master
command:
- runner.sh
# Clean containers on TERM signal in root process to avoid cgroup leaking.
Expand All @@ -52,13 +52,7 @@ spec:
docker system prune -af || true
}
function setup_docker_mirror() {
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": [
"https://registry-mirror.pingcap.net"
]
}
EOF
sed -i "s/mirror.gcr.io/registry-mirror.pingcap.net/g" /etc/default/docker
service docker restart
}
setup_docker_mirror
Expand Down Expand Up @@ -277,7 +271,7 @@ try {
timeout (time: 2, unit: 'HOURS') {
// use fixed label, so we can reuse previous workers
// increase version in pod label when we update pod template
def buildPodLabel = "tidb-operator-build-v1-pingcap-docker-mirror"
def buildPodLabel = "tidb-operator-build-v2-pingcap-docker-mirror"
def resources = [
requests: [
cpu: "4",
Expand Down Expand Up @@ -369,7 +363,7 @@ try {
docker login -u \$USERNAME --password-stdin hub.pingcap.net <<< \$PASSWORD
echo "info: build and push images for e2e"
echo "test: show docker daemon config file"
cat /etc/docker/daemon.json
cat /etc/docker/daemon.json || true
E2E=y NO_BUILD=y DOCKER_REPO=hub.pingcap.net/tidb-operator-e2e IMAGE_TAG=${IMAGE_TAG} make docker-push e2e-docker-push
echo "info: download binaries for e2e"
E2E=y SKIP_BUILD=y SKIP_IMAGE_BUILD=y SKIP_UP=y SKIP_TEST=y SKIP_DOWN=y ./hack/e2e.sh
Expand Down
12 changes: 3 additions & 9 deletions ci/pull_e2e_release.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ metadata:
spec:
containers:
- name: main
image: gcr.io/k8s-testimages/kubekins-e2e:v20200311-1e25827-master
image: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v20210808-1eaeec7-master
command:
- runner.sh
# Clean containers on TERM signal in root process to avoid cgroup leaking.
Expand All @@ -52,13 +52,7 @@ spec:
docker system prune -af || true
}
function setup_docker_mirror() {
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": [
"https://registry-mirror.pingcap.net"
]
}
EOF
sed -i "s/mirror.gcr.io/registry-mirror.pingcap.net/g" /etc/default/docker
service docker restart
}
setup_docker_mirror
Expand Down Expand Up @@ -240,7 +234,7 @@ try {
timeout (time: 2, unit: 'HOURS') {
// use fixed label, so we can reuse previous workers
// increase version in pod label when we update pod template
def buildPodLabel = "tidb-operator-build-v1-pingcap-docker-mirror"
def buildPodLabel = "tidb-operator-build-v2-pingcap-docker-mirror"
def resources = [
requests: [
cpu: "6",
Expand Down
2 changes: 1 addition & 1 deletion ci/vm.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ kind: Pod
spec:
containers:
- name: main
image: gcr.io/k8s-testimages/kubekins-e2e:v20200311-1e25827-master
image: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v20210808-1eaeec7-master
command:
- runner.sh
- sleep
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/pingcap/tidb-operator

go 1.13
go 1.16

require (
cloud.google.com/go/storage v1.0.0
Expand All @@ -22,7 +22,6 @@ require (
github.com/dsnet/compress v0.0.1 // indirect
github.com/dustin/go-humanize v1.0.0
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect; indirectload
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/emicklei/go-restful v2.9.5+incompatible
github.com/fatih/color v1.7.0
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
Expand Down Expand Up @@ -68,6 +67,7 @@ require (
github.com/uber/jaeger-lib v2.2.0+incompatible // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/yisaer/crd-validation v0.0.3
github.com/zhouqiang-cl/gocovmerge v0.0.0-20190125174600-5256314471af
go.etcd.io/etcd v0.5.0-alpha.5.0.20200819165624-17cef6e3e9d5
gocloud.dev v0.18.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f h1:8GDPb0tCY8LQ+OJ3dbHb5sA6YZWXFORQYZx5sdsTlMs=
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f h1:AUj1VoZUfhPhOPHULCQQDnGhRelpFWHMLhQVWDsS0v4=
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk=
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
Expand Down Expand Up @@ -808,7 +806,6 @@ github.com/robfig/cron v1.1.0 h1:jk4/Hud3TTdcrJgUOBgsqrZBarcxl6ADIjSC2iniwLY=
github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
github.com/rogpeppe/go-internal v1.0.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.0.1-alpha.3/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
Expand Down Expand Up @@ -919,6 +916,8 @@ github.com/yisaer/crd-validation v0.0.3 h1:PmhrjDQbdkZOYz/1iVnK1UlY8q8Uw7hn1rlGm
github.com/yisaer/crd-validation v0.0.3/go.mod h1:aWBclg0rUEvCnOnRZGDF6oC9Ljni2s17G/YVdYuTTww=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/zhouqiang-cl/gocovmerge v0.0.0-20190125174600-5256314471af h1:TscntfU6Necy6hfH+hcow8QSg8DJq47Fe/rqpZZS9U4=
github.com/zhouqiang-cl/gocovmerge v0.0.0-20190125174600-5256314471af/go.mod h1:Zot6ZD+7MXm1DzYOkmHNMcq72CRIdbh1qSsEbaxhHgY=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
Expand All @@ -939,7 +938,6 @@ go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
Expand Down
41 changes: 0 additions & 41 deletions hack/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -268,43 +268,6 @@ function e2e::image_build() {
DOCKER_REPO=$DOCKER_REPO IMAGE_TAG=$IMAGE_TAG make e2e-docker
}

function e2e::__restart_docker() {
echo "info: restarting docker"
service docker restart
# the service can be started but the docker socket not ready, wait for ready
local WAIT_N=0
local MAX_WAIT=5
while true; do
# docker ps -q should only work if the daemon is ready
docker ps -q > /dev/null 2>&1 && break
if [[ ${WAIT_N} -lt ${MAX_WAIT} ]]; then
WAIT_N=$((WAIT_N+1))
echo "info; Waiting for docker to be ready, sleeping for ${WAIT_N} seconds."
sleep ${WAIT_N}
else
echo "info: Reached maximum attempts, not waiting any longer..."
break
fi
done
echo "info: done restarting docker"
}

function e2e::__configure_docker_mirror_for_dind() {
echo "info: configure docker.io mirror '$DOCKER_IO_MIRROR' for DinD"
cat <<EOF > /etc/docker/daemon.json.tmp
{
"registry-mirrors": ["$DOCKER_IO_MIRROR"]
}
EOF
if diff /etc/docker/daemon.json.tmp /etc/docker/daemon.json 1>/dev/null 2>&1; then
echo "info: already configured"
rm /etc/docker/daemon.json.tmp
else
mv /etc/docker/daemon.json.tmp /etc/docker/daemon.json
e2e::__restart_docker
fi
}

# TODO: review this
function e2e::create_kindconfig() {
local tmpfile=${1}
Expand Down Expand Up @@ -430,10 +393,6 @@ hack::ensure_kind
hack::ensure_kubectl
hack::ensure_helm

if [ -n "$DOCKER_IO_MIRROR" -a -n "${DOCKER_IN_DOCKER_ENABLED:-}" ]; then
e2e::__configure_docker_mirror_for_dind
fi

e2e::image_build

kubetest2_args=(
Expand Down
2 changes: 1 addition & 1 deletion hack/run-in-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,5 @@ docker run ${docker_args[@]} \
-v $ROOT:/go/src/github.com/pingcap/tidb-operator \
-w /go/src/github.com/pingcap/tidb-operator \
--entrypoint /usr/local/bin/runner.sh \
gcr.io/k8s-testimages/kubekins-e2e:v20200311-1e25827-master \
gcr.io/k8s-testimages/kubekins-e2e:v20210808-1eaeec7-master \
"${args[@]}"
2 changes: 1 addition & 1 deletion hack/tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/kubernetes/hack/tools

go 1.14
go 1.16

require (
github.com/client9/misspell v0.3.4
Expand Down
13 changes: 8 additions & 5 deletions hack/update-api-references.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ source hack/lib.sh
hack::ensure_gen_crd_api_references_docs

DOCS_PATH="$ROOT/docs/api-references"
API_DIR="${ROOT}/pkg/apis/pingcap/v1alpha1"

GOROOT=$(go env GOROOT) ${DOCS_BIN} \
-config "$DOCS_PATH/config.json" \
-template-dir "$DOCS_PATH/template" \
-api-dir "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" \
-out-file "$DOCS_PATH/docs.md"
pushd ${API_DIR} >/dev/null
GOROOT=$(go env GOROOT) ${DOCS_BIN} \
-config "$DOCS_PATH/config.json" \
-template-dir "$DOCS_PATH/template" \
-api-dir "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" \
-out-file "$DOCS_PATH/docs.md"
popd >/dev/null
2 changes: 1 addition & 1 deletion pkg/apis/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pingcap/tidb-operator/pkg/apis

go 1.13
go 1.16

require (
github.com/BurntSushi/toml v0.3.1
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
Expand Down Expand Up @@ -548,7 +547,6 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0 h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pingcap/tidb-operator/pkg/client

go 1.13
go 1.16

require (
github.com/pingcap/tidb-operator/pkg/apis v1.3.8
Expand Down
4 changes: 4 additions & 0 deletions tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build tools
// +build tools

// Tool dependencies are tracked here to make go module happy
Expand All @@ -25,4 +26,7 @@ import (
// TODO remove this if we 1) avoid the issue in a better way or 2) go both
// in local development and ci have the bug fixed
_ "github.com/fatih/color"

// in order to import the pkg in vendor
_ "github.com/zhouqiang-cl/gocovmerge"
)

0 comments on commit 89faa4d

Please sign in to comment.