Skip to content

Commit

Permalink
bump go version to 1.21.3 for security (#5337) (#5341)
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
Co-authored-by: Xuecheng Zhang <[email protected]>
  • Loading branch information
ti-chi-bot and csuzhangxc authored Oct 17, 2023
1 parent 8dae55b commit 8a6fdd9
Show file tree
Hide file tree
Showing 32 changed files with 96 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-go@v3
with:
go-version-file: go/src/github.com/${{ github.repository }}/go.mod
check-latest: true
go-version: 1.21.3
- name: Set vars
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: actions/setup-go@v3
with:
go-version-file: go/src/github.com/${{ github.repository }}/go.mod
check-latest: true
go-version: 1.21.3
- name: Set vars
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
timeout: 10m
timeout: 20m

linters:
enable:
Expand Down
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: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v5-go1.19
image: hub.pingcap.net/tidb-operator/kubekins-e2e:v6-go1.21.3
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: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v5-go1.19
image: hub.pingcap.net/tidb-operator/kubekins-e2e:v6-go1.21.3
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: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v5-go1.19
image: hub.pingcap.net/tidb-operator/kubekins-e2e:v6-go1.21.3
command:
- runner.sh
- exec
Expand Down
2 changes: 1 addition & 1 deletion ci/pull_e2e_kind.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ metadata:
spec:
containers:
- name: main
image: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v5-go1.19
image: hub.pingcap.net/tidb-operator/kubekins-e2e:v6-go1.21.3
command:
- runner.sh
- exec
Expand Down
2 changes: 1 addition & 1 deletion 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: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v5-go1.19
image: hub.pingcap.net/tidb-operator/kubekins-e2e:v6-go1.21.3
command:
- runner.sh
- exec
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: hub-new.pingcap.net/tidb-operator/kubekins-e2e:v5-go1.19
image: hub.pingcap.net/tidb-operator/kubekins-e2e:v6-go1.21.3
command:
- runner.sh
- sleep
Expand Down
2 changes: 1 addition & 1 deletion 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.19
go 1.21

require (
cloud.google.com/go/storage v1.6.0
Expand Down
2 changes: 1 addition & 1 deletion hack/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function hack::ensure_misspell() {

function hack::ensure_golangci_lint() {
echo "Installing golangci_lint..."
GOBIN=$OUTPUT_BIN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
GOBIN=$OUTPUT_BIN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
}

function hack::ensure_controller_gen() {
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 \
"pingcap/kubekins-e2e:v5-go1.19" \
"pingcap/kubekins-e2e:v6-go1.21.3" \
"${args[@]}"
4 changes: 2 additions & 2 deletions hack/verify-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ source hack/lib.sh
hack::ensure_golangci_lint

# main module
${OUTPUT_BIN}/golangci-lint run --timeout 10m $(go list ./... | sed 's|github.com/pingcap/tidb-operator/||')
${OUTPUT_BIN}/golangci-lint run --timeout 20m -v $(go list ./... | sed 's|github.com/pingcap/tidb-operator/||')

# sub modules
for dir in ${GO_SUBMODULE_DIRS[@]}; do
pushd "${ROOT}/${dir}" >/dev/null
${OUTPUT_BIN}/golangci-lint run --timeout 10m
${OUTPUT_BIN}/golangci-lint run --timeout 20m -v
popd >/dev/null
done
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.19
go 1.21

require (
github.com/BurntSushi/toml v0.3.1
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
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.19
go 1.21

require (
github.com/pingcap/tidb-operator/pkg/apis v1.5.0
Expand Down
1 change: 1 addition & 0 deletions pkg/client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs=
github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
Expand Down
12 changes: 8 additions & 4 deletions pkg/manager/member/dm_master_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,8 @@ func TestGetNewMasterHeadlessServiceForDMCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
svc := getNewMasterHeadlessServiceForDMCluster(&tt.dc)
if diff := cmp.Diff(tt.expected, *svc); diff != "" {
Expand Down Expand Up @@ -1376,7 +1377,8 @@ func TestGetNewMasterSetForDMCluster(t *testing.T) {
// TODO add more tests
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
var cm *corev1.ConfigMap
if !tt.nilCM {
Expand Down Expand Up @@ -1547,7 +1549,8 @@ ssl-key = "/var/lib/dm-master-tls/tls.key"
},
}

for _, tt := range testCases {
for i := range testCases {
tt := testCases[i]
t.Run(tt.name, func(t *testing.T) {
cm, err := getMasterConfigMap(&tt.dc)
g.Expect(err).To(Succeed())
Expand Down Expand Up @@ -1882,7 +1885,8 @@ func TestGetNewMasterServiceForDMCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
mmm, _, _, _, _, _, _ := newFakeMasterMemberManager()
svc := mmm.getNewMasterServiceForDMCluster(&tt.dc)
Expand Down
9 changes: 6 additions & 3 deletions pkg/manager/member/dm_worker_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,8 @@ func TestGetNewWorkerHeadlessService(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
svc := getNewWorkerHeadlessServiceForDMCluster(&tt.dc)
if diff := cmp.Diff(tt.expected, *svc); diff != "" {
Expand Down Expand Up @@ -1325,7 +1326,8 @@ func TestGetNewWorkerSetForDMCluster(t *testing.T) {
// TODO add more tests
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
var cm *corev1.ConfigMap
if !tt.nilCM {
Expand Down Expand Up @@ -1445,7 +1447,8 @@ log-level = "info"
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
cm, err := getWorkerConfigMap(&tt.dc)
g.Expect(err).To(Succeed())
Expand Down
12 changes: 8 additions & 4 deletions pkg/manager/member/pd_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,8 @@ func TestGetNewPDHeadlessServiceForTidbCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
svc := getNewPDHeadlessServiceForTidbCluster(&tt.tc)
if diff := cmp.Diff(tt.expected, *svc); diff != "" {
Expand Down Expand Up @@ -1980,7 +1981,8 @@ func TestGetNewPDSetForTidbCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
sts, err := getNewPDSetForTidbCluster(&tt.tc, nil)
if (err != nil) != tt.wantErr {
Expand Down Expand Up @@ -2305,7 +2307,8 @@ func TestGetPDConfigMap(t *testing.T) {
},
}

for _, tt := range testCases {
for i := range testCases {
tt := testCases[i]
t.Run(tt.name, func(t *testing.T) {
cm, err := getPDConfigMap(&tt.tc)
g.Expect(err).To(Succeed())
Expand Down Expand Up @@ -2673,7 +2676,8 @@ func TestGetNewPdServiceForTidbCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
pmm, _, _ := newFakePDMemberManager()
svc := pmm.getNewPDServiceForTidbCluster(&tt.tc)
Expand Down
6 changes: 4 additions & 2 deletions pkg/manager/member/pump_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,8 @@ func TestGetNewPumpHeadlessService(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
svc := getNewPumpHeadlessService(&tt.tc)
if diff := cmp.Diff(tt.expected, *svc); diff != "" {
Expand Down Expand Up @@ -717,7 +718,8 @@ func TestGetNewPumpConfigMap(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
cm, err := getNewPumpConfigMap(&tt.tc)
g.Expect(err).To(Succeed())
Expand Down
3 changes: 2 additions & 1 deletion pkg/manager/member/ticdc_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,8 @@ func TestGetNewTiCDCStatefulSet(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
sts, _ := getNewTiCDCStatefulSet(&tt.tc, nil)
tt.testSts(sts)
Expand Down
15 changes: 10 additions & 5 deletions pkg/manager/member/tidb_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,8 @@ func TestGetNewTiDBHeadlessServiceForTidbCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
svc := getNewTiDBHeadlessServiceForTidbCluster(&tt.tc)
if diff := cmp.Diff(tt.expected, *svc); diff != "" {
Expand Down Expand Up @@ -1267,7 +1268,8 @@ func TestGetNewTiDBSetForTidbCluster(t *testing.T) {
// TODO add more tests
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
sts, _ := getNewTiDBSetForTidbCluster(&tt.tc, tt.cm)
tt.testSts(sts)
Expand Down Expand Up @@ -1601,7 +1603,8 @@ func TestTiDBInitContainers(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
sts, _ := getNewTiDBSetForTidbCluster(&tt.tc, nil)
if diff := cmp.Diff(tt.expectedInit, sts.Spec.Template.Spec.InitContainers); diff != "" {
Expand Down Expand Up @@ -1931,7 +1934,8 @@ func TestGetNewTiDBService(t *testing.T) {
},
}

for _, tt := range testCases {
for i := range testCases {
tt := testCases[i]
t.Run(tt.name, func(t *testing.T) {
svc := getNewTiDBServiceOrNil(&tt.tc)
if tt.expected == nil {
Expand Down Expand Up @@ -2140,7 +2144,8 @@ func TestGetTiDBConfigMap(t *testing.T) {
},
}

for _, tt := range testCases {
for i := range testCases {
tt := testCases[i]
t.Run(tt.name, func(t *testing.T) {
cm, err := getTiDBConfigMap(&tt.tc)
g.Expect(err).To(Succeed())
Expand Down
6 changes: 4 additions & 2 deletions pkg/manager/member/tiflash_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,8 @@ func TestGetNewServiceForTidbCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
svc := getNewServiceForTidbCluster(&tt.tc, tt.svcConfig)
if diff := cmp.Diff(tt.expected, *svc); diff != "" {
Expand Down Expand Up @@ -1730,7 +1731,8 @@ func TestGetNewTiFlashSetForTidbCluster(t *testing.T) {
// TODO add more tests
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
sts, err := getNewStatefulSet(&tt.tc, nil)
if (err != nil) != tt.wantErr {
Expand Down
12 changes: 8 additions & 4 deletions pkg/manager/member/tikv_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,8 @@ func TestGetNewTiKVServiceForTidbCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
svc := getNewServiceForTidbCluster(&tt.tc, tt.svcConfig)
if diff := cmp.Diff(tt.expected, *svc); diff != "" {
Expand Down Expand Up @@ -2167,7 +2168,8 @@ func TestGetNewTiKVSetForTidbCluster(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
sts, err := getNewTiKVSetForTidbCluster(&tt.tc, nil)
if (err != nil) != tt.wantErr {
Expand Down Expand Up @@ -2506,7 +2508,8 @@ func TestTiKVInitContainers(t *testing.T) {
},
}

for _, tt := range tests {
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
sts, err := getNewTiKVSetForTidbCluster(&tt.tc, nil)
if (err != nil) != tt.wantErr {
Expand Down Expand Up @@ -2616,7 +2619,8 @@ func TestGetTiKVConfigMap(t *testing.T) {
},
}

for _, tt := range testCases {
for i := range testCases {
tt := &testCases[i]
t.Run(tt.name, func(t *testing.T) {
cm, err := getTikVConfigMap(&tt.tc)
g.Expect(err).To(Succeed())
Expand Down
Loading

0 comments on commit 8a6fdd9

Please sign in to comment.