Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Upgrade go to 1.18 #4496

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions .github/workflows/chaos.yaml
Original file line number Diff line number Diff line change
@@ -10,19 +10,12 @@ jobs:

pull:
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16.4
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: "set up golang"
uses: actions/setup-go@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
path: go/src/github.com/${{ github.repository }}

go-version-file: 'go.mod'
- name: Creating kind cluster
run: |
SKIP_BUILD=y SKIP_IMAGE_BUILD=y SKIP_DOWN=y SKIP_TEST=y KUBE_WORKERS=0 ./hack/e2e.sh
@@ -38,7 +31,6 @@ jobs:
echo "info: create pingcap namespace for chaos configurations"
kubectl create ns pingcap
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}

- name: Run chaos mesh
uses: chaos-mesh/chaos-mesh-actions@master
env:
@@ -48,7 +40,6 @@ jobs:
run: |
SKIP_UP=y ./hack/e2e.sh -- --ginkgo.focus='Restarter'
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}

- name: Set up tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
14 changes: 5 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -23,21 +23,17 @@ jobs:
- test
- e2e-examples
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16.4
id: go

# the GITHUB_SHA env is not the real commit hash but is the pre-merge commit ID for `pull_request` event,
# see https://github.saobby.my.eu.orgmunity/t/github-sha-isnt-the-value-expected/17903/2
# so we checkout the repo with `fetch-depth: 2` and let `codecov/codecov-action` to retrieve the real commit hash.
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: go/src/github.com/${{ github.repository }}
fetch-depth: 2

- name: "set up golang"
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: ${{ matrix.job }}
run: |
# workaround for https://github.com/actions/setup-go/issues/14
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
run:
timeout: 10m
go: '1.17'
july2993 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
go: '1.17'
# golangci don't support some linter in go 1.18, so now run in go1.17
# When we want to use the feature of go 1.18, we can change it.
go: '1.17'


linters:
enable:
2 changes: 1 addition & 1 deletion ci/e2e_eks.groovy
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion ci/e2e_gke.groovy
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion ci/e2e_kind.groovy
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 4 additions & 10 deletions ci/pull_e2e_kind.groovy
Original file line number Diff line number Diff line change
@@ -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.
@@ -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
@@ -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",
@@ -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
12 changes: 3 additions & 9 deletions ci/pull_e2e_release.groovy
Original file line number Diff line number Diff line change
@@ -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.
@@ -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
@@ -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",
2 changes: 1 addition & 1 deletion ci/vm.groovy
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion cmd/backup-manager/app/util/generic.go
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ func (bo *GenericOptions) GetTikvGCLifeTime(ctx context.Context, db *sql.DB) (st
}

func (bo *GenericOptions) SetTikvGCLifeTime(ctx context.Context, db *sql.DB, gcTime string) error {
sql := fmt.Sprintf("update %s set variable_value = ? where variable_name = ?", constants.TidbMetaTable)
sql := fmt.Sprintf("update %s set variable_value = ? where variable_name = ?", constants.TidbMetaTable) // nolint: gosec
_, err := db.ExecContext(ctx, sql, gcTime, constants.TikvGCVariable)
if err != nil {
return fmt.Errorf("set cluster %s %s failed, sql: %s, err: %v", bo, constants.TikvGCVariable, sql, err)
12 changes: 6 additions & 6 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
@@ -9285,7 +9285,7 @@ int
<td>
<code>buffer-flush-interval</code></br>
<em>
time.Duration
invalid type
</em>
</td>
<td>
@@ -9381,7 +9381,7 @@ int
<td>
<code>sampling-refresh-interval</code></br>
<em>
time.Duration
invalid type
</em>
</td>
<td>
@@ -12487,7 +12487,7 @@ int
<td>
<code>batchSendDeadline</code></br>
<em>
time.Duration
invalid type
</em>
</td>
<td>
@@ -12509,7 +12509,7 @@ int
<td>
<code>minBackoff</code></br>
<em>
time.Duration
invalid type
</em>
</td>
<td>
@@ -12520,7 +12520,7 @@ time.Duration
<td>
<code>maxBackoff</code></br>
<em>
time.Duration
invalid type
</em>
</td>
<td>
@@ -17531,7 +17531,7 @@ Optional: Defaults to 200</p>
<td>
<code>max-batch-wait-time</code></br>
<em>
time.Duration
invalid type
</em>
</td>
<td>
Loading