Skip to content

Commit c2cda23

Browse files
authored
CI: Add govulncheck / Bump main Go version (#7934)
1 parent 55104e1 commit c2cda23

File tree

8 files changed

+119
-105
lines changed

8 files changed

+119
-105
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,36 @@ jobs:
3535
build:
3636
runs-on: ubuntu-latest
3737
steps:
38-
- uses: actions/checkout@v4
38+
- uses: actions/checkout@v5
3939
- uses: actions/setup-go@v5
4040
with:
41-
go-version: 1.24.4
41+
go-version: 1.25.5
4242
- name: go-build
4343
run: go build "./..."
4444

4545
addlicense:
4646
name: addlicense
4747
runs-on: ubuntu-latest
4848
steps:
49-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v5
5050
- uses: actions/setup-go@v5
5151
with:
52-
go-version: 1.24.4
52+
go-version: 1.25.5
5353
- run: go install github.com/google/addlicense@latest
5454
- run: addlicense -check -f licenses/addlicense.tmpl .
5555

5656
golangci:
5757
name: lint
5858
runs-on: ubuntu-latest
5959
steps:
60-
- uses: actions/checkout@v4
60+
- uses: actions/checkout@v5
6161
- uses: actions/setup-go@v5
6262
with:
63-
go-version: 1.24.4
63+
go-version: 1.25.5
6464
- name: golangci-lint
65-
uses: golangci/golangci-lint-action@v7
65+
uses: golangci/golangci-lint-action@v9
6666
with:
67-
version: v2.0.2
67+
version: v2.7
6868
args: --config=.golangci-strict.yml
6969

7070
test:
@@ -84,10 +84,10 @@ jobs:
8484
MallocNanoZone: 0
8585
name: test (${{ matrix.name }})
8686
steps:
87-
- uses: actions/checkout@v4
87+
- uses: actions/checkout@v5
8888
- uses: actions/setup-go@v5
8989
with:
90-
go-version: 1.24.4
90+
go-version: 1.25.5
9191
- name: Build
9292
run: go build -v "./..."
9393
- name: Run Tests
@@ -104,10 +104,10 @@ jobs:
104104
env:
105105
GOPRIVATE: github.com/couchbaselabs
106106
steps:
107-
- uses: actions/checkout@v4
107+
- uses: actions/checkout@v5
108108
- uses: actions/setup-go@v5
109109
with:
110-
go-version: 1.24.4
110+
go-version: 1.25.5
111111
- name: Run Tests
112112
run: go test -tags cb_sg_devmode -race -shuffle=on -timeout=30m -count=1 -json -v "./..." | tee test.json | jq -s -jr 'sort_by(.Package,.Time) | .[].Output | select (. != null )'
113113
shell: bash
@@ -123,10 +123,10 @@ jobs:
123123
GOPRIVATE: github.com/couchbaselabs
124124
SG_TEST_USE_DEFAULT_COLLECTION: true
125125
steps:
126-
- uses: actions/checkout@v4
126+
- uses: actions/checkout@v5
127127
- uses: actions/setup-go@v5
128128
with:
129-
go-version: 1.24.4
129+
go-version: 1.25.5
130130
- name: Run Tests
131131
run: go test -tags cb_sg_devmode -shuffle=on -timeout=30m -count=1 -json -v "./..." | tee test.json | jq -s -jr 'sort_by(.Package,.Time) | .[].Output | select (. != null )'
132132
shell: bash
@@ -139,14 +139,14 @@ jobs:
139139
python-format:
140140
runs-on: ubuntu-latest
141141
steps:
142-
- uses: actions/checkout@v4
142+
- uses: actions/checkout@v5
143143
- uses: astral-sh/ruff-action@v3
144144
with:
145145
args: 'format --check'
146146
python-lint:
147147
runs-on: ubuntu-latest
148148
steps:
149-
- uses: actions/checkout@v4
149+
- uses: actions/checkout@v5
150150
- uses: astral-sh/ruff-action@v3
151151
test-sgcollect:
152152
runs-on: ${{ matrix.os }}
@@ -155,7 +155,7 @@ jobs:
155155
matrix:
156156
os: [macos-latest, windows-latest, ubuntu-latest]
157157
steps:
158-
- uses: actions/checkout@v4
158+
- uses: actions/checkout@v5
159159
- uses: astral-sh/setup-uv@v6
160160
- name: Run test
161161
run: |
@@ -171,10 +171,10 @@ jobs:
171171
matrix:
172172
os: [macos-latest, windows-latest, ubuntu-latest]
173173
steps:
174-
- uses: actions/checkout@v4
174+
- uses: actions/checkout@v5
175175
- uses: actions/setup-go@v5
176176
with:
177-
go-version: 1.24.4
177+
go-version: 1.25.5
178178
- name: Build
179179
run: go build -v "./tools/stats-definition-exporter"
180180
- name: Run Tests
@@ -184,9 +184,18 @@ jobs:
184184
runs-on: ubuntu-latest
185185
name: build cache perf tool
186186
steps:
187-
- uses: actions/checkout@v4
187+
- uses: actions/checkout@v5
188188
- uses: actions/setup-go@v5
189189
with:
190-
go-version: 1.24.4
190+
go-version: 1.25.5
191191
- name: Build
192192
run: go build "./tools/cache_perf_tool"
193+
govulncheck:
194+
runs-on: ubuntu-latest
195+
name: Run govulncheck
196+
steps:
197+
- id: govulncheck
198+
uses: golang/govulncheck-action@v1
199+
with:
200+
go-version-input: 1.25.5
201+
go-package: ./...

.github/workflows/manifestvalidation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
manifest_validation:
4040
runs-on: ubuntu-latest
4141
steps:
42-
- uses: actions/checkout@v4
42+
- uses: actions/checkout@v5
4343
- name: Ensure manifest product-config properties are sorted
4444
id: validate
4545
run: |

.github/workflows/openapi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
runs-on: ubuntu-latest
4747
name: OpenAPI Validation
4848
steps:
49-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v5
5050
- uses: r7kamura/redocly-problem-matchers@v1
5151
- uses: mhiew/redoc-lint-github-action@v4
5252
with:
@@ -58,7 +58,7 @@ jobs:
5858
name: 'yamllint'
5959
runs-on: ubuntu-latest
6060
steps:
61-
- uses: actions/checkout@v4
61+
- uses: actions/checkout@v5
6262
- uses: karancode/yamllint-github-action@master
6363
with:
6464
yamllint_file_or_dir: 'docs/api'

.github/workflows/service.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
runs-on: ubuntu-latest
4444
name: Verify service script installation.
4545
steps:
46-
- uses: actions/checkout@v4
46+
- uses: actions/checkout@v5
4747
# build sync gateway since the executable is needed for service installation
4848
- uses: actions/setup-go@v5
4949
with:

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pipeline {
1515
}
1616

1717
tools {
18-
go '1.24.4'
18+
go '1.25.5'
1919
}
2020

2121
stages {

db/active_replicator_common.go

Lines changed: 82 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -243,99 +243,104 @@ func (arc *activeReplicatorCommon) reset() error {
243243
// reconnect asynchronously calls replicatorConnectFn until successful, or times out trying. Retry loop can be stopped by cancelling ctx
244244
func (arc *activeReplicatorCommon) reconnect() {
245245
arc.reconnectActive.Set(true)
246-
go func() {
247-
base.DebugfCtx(arc.ctx, base.KeyReplicate, "starting reconnector")
248-
defer func() {
249-
arc.reconnectActive.Set(false)
250-
}()
251-
252-
initialReconnectInterval := defaultInitialReconnectInterval
253-
if arc.config.InitialReconnectInterval != 0 {
254-
initialReconnectInterval = arc.config.InitialReconnectInterval
255-
}
256-
maxReconnectInterval := defaultMaxReconnectInterval
257-
if arc.config.MaxReconnectInterval != 0 {
258-
maxReconnectInterval = arc.config.MaxReconnectInterval
259-
}
246+
go arc.synchronousReconnect()
247+
}
260248

261-
// ctx causes the retry loop to stop if cancelled
262-
ctx := arc.ctx
249+
// TODO: CBG-4882 - reconnect() and Start() race on reading/writing ctx
250+
//
251+
//go:norace
252+
func (arc *activeReplicatorCommon) synchronousReconnect() {
253+
base.DebugfCtx(arc.ctx, base.KeyReplicate, "starting reconnector")
254+
defer func() {
255+
arc.reconnectActive.Set(false)
256+
}()
263257

264-
// if a reconnect timeout is set, we'll wrap the existing so both can stop the retry loop
265-
var deadlineCancel context.CancelFunc
266-
if arc.config.TotalReconnectTimeout != 0 {
267-
ctx, deadlineCancel = context.WithDeadline(ctx, time.Now().Add(arc.config.TotalReconnectTimeout))
268-
}
258+
initialReconnectInterval := defaultInitialReconnectInterval
259+
if arc.config.InitialReconnectInterval != 0 {
260+
initialReconnectInterval = arc.config.InitialReconnectInterval
261+
}
262+
maxReconnectInterval := defaultMaxReconnectInterval
263+
if arc.config.MaxReconnectInterval != 0 {
264+
maxReconnectInterval = arc.config.MaxReconnectInterval
265+
}
269266

270-
sleeperFunc := base.SleeperFuncCtx(
271-
base.CreateIndefiniteMaxDoublingSleeperFunc(
272-
int(initialReconnectInterval.Milliseconds()),
273-
int(maxReconnectInterval.Milliseconds())),
274-
ctx)
267+
// ctx causes the retry loop to stop if cancelled
268+
ctx := arc.ctx
275269

276-
retryFunc := func() (shouldRetry bool, err error, _ any) {
277-
// check before and after acquiring lock to make sure to exit early if ActiveReplicatorCommon.Stop() was called.
278-
if ctx.Err() != nil {
279-
return false, ctx.Err(), nil
280-
}
270+
// if a reconnect timeout is set, we'll wrap the existing so both can stop the retry loop
271+
var deadlineCancel context.CancelFunc
272+
if arc.config.TotalReconnectTimeout != 0 {
273+
ctx, deadlineCancel = context.WithDeadline(ctx, time.Now().Add(arc.config.TotalReconnectTimeout))
274+
}
281275

282-
arc.lock.Lock()
283-
defer arc.lock.Unlock()
276+
sleeperFunc := base.SleeperFuncCtx(
277+
base.CreateIndefiniteMaxDoublingSleeperFunc(
278+
int(initialReconnectInterval.Milliseconds()),
279+
int(maxReconnectInterval.Milliseconds())),
280+
ctx)
284281

285-
if ctx.Err() != nil {
286-
return false, ctx.Err(), nil
287-
}
282+
retryFunc := func() (shouldRetry bool, err error, _ any) {
283+
// check before and after acquiring lock to make sure to exit early if ActiveReplicatorCommon.Stop() was called.
284+
if ctx.Err() != nil {
285+
return false, ctx.Err(), nil
286+
}
288287

289-
base.DebugfCtx(arc.ctx, base.KeyReplicate, "Attempting to reconnect replicator %s", arc.config.ID)
288+
arc.lock.Lock()
289+
defer arc.lock.Unlock()
290290

291-
// preserve lastError from the previous connect attempt
292-
arc.setState(ReplicationStateReconnecting)
291+
if ctx.Err() != nil {
292+
return false, ctx.Err(), nil
293+
}
293294

294-
// disconnect no-ops if nothing is active, but will close any checkpointer processes, blip contexts, etc, if active.
295-
base.TracefCtx(arc.ctx, base.KeyReplicate, "calling disconnect from reconnect")
296-
err = arc._disconnect()
297-
if err != nil {
298-
base.InfofCtx(arc.ctx, base.KeyReplicate, "error stopping replicator on reconnect: %v", err)
299-
}
295+
base.DebugfCtx(arc.ctx, base.KeyReplicate, "Attempting to reconnect replicator %s", arc.config.ID)
300296

301-
// set lastError, but don't set an error state inside the reconnect loop
302-
err = arc.replicatorConnectFn()
303-
arc.setLastError(err)
304-
arc._publishStatus()
297+
// preserve lastError from the previous connect attempt
298+
arc.setState(ReplicationStateReconnecting)
305299

306-
if err != nil {
307-
base.InfofCtx(arc.ctx, base.KeyReplicate, "error starting replicator %s on reconnect: %v", arc.config.ID, err)
308-
} else {
309-
base.DebugfCtx(arc.ctx, base.KeyReplicate, "replicator %s successfully reconnected", arc.config.ID)
310-
}
311-
return err != nil, err, nil
300+
// disconnect no-ops if nothing is active, but will close any checkpointer processes, blip contexts, etc, if active.
301+
base.TracefCtx(arc.ctx, base.KeyReplicate, "calling disconnect from reconnect")
302+
err = arc._disconnect()
303+
if err != nil {
304+
base.InfofCtx(arc.ctx, base.KeyReplicate, "error stopping replicator on reconnect: %v", err)
312305
}
313306

314-
retryErr, _ := base.RetryLoop(ctx, "replicator reconnect", retryFunc, sleeperFunc)
315-
// release timer associated with context deadline
316-
if deadlineCancel != nil {
317-
deadlineCancel()
318-
}
319-
// Exit early if no error
320-
if retryErr == nil {
321-
return
322-
}
307+
// set lastError, but don't set an error state inside the reconnect loop
308+
err = arc.replicatorConnectFn()
309+
arc.setLastError(err)
310+
arc._publishStatus()
323311

324-
// replicator was stopped - appropriate state has already been set
325-
if errors.Is(ctx.Err(), context.Canceled) {
326-
base.DebugfCtx(ctx, base.KeyReplicate, "exiting reconnect loop: %v", retryErr)
327-
return
312+
if err != nil {
313+
base.InfofCtx(arc.ctx, base.KeyReplicate, "error starting replicator %s on reconnect: %v", arc.config.ID, err)
314+
} else {
315+
base.DebugfCtx(arc.ctx, base.KeyReplicate, "replicator %s successfully reconnected", arc.config.ID)
328316
}
317+
return err != nil, err, nil
318+
}
329319

330-
base.WarnfCtx(ctx, "aborting reconnect loop: %v", retryErr)
331-
arc.replicationStats.NumReconnectsAborted.Add(1)
332-
arc.lock.Lock()
333-
defer arc.lock.Unlock()
334-
// use setState to preserve last error from retry loop set by setLastError
335-
arc.setState(ReplicationStateError)
336-
arc._publishStatus()
337-
arc._stop()
338-
}()
320+
retryErr, _ := base.RetryLoop(ctx, "replicator reconnect", retryFunc, sleeperFunc)
321+
// release timer associated with context deadline
322+
if deadlineCancel != nil {
323+
deadlineCancel()
324+
}
325+
// Exit early if no error
326+
if retryErr == nil {
327+
return
328+
}
329+
330+
// replicator was stopped - appropriate state has already been set
331+
if errors.Is(ctx.Err(), context.Canceled) {
332+
base.DebugfCtx(ctx, base.KeyReplicate, "exiting reconnect loop: %v", retryErr)
333+
return
334+
}
335+
336+
base.WarnfCtx(ctx, "aborting reconnect loop: %v", retryErr)
337+
arc.replicationStats.NumReconnectsAborted.Add(1)
338+
arc.lock.Lock()
339+
defer arc.lock.Unlock()
340+
// use setState to preserve last error from retry loop set by setLastError
341+
arc.setState(ReplicationStateError)
342+
arc._publishStatus()
343+
arc._stop()
339344
}
340345

341346
// disconnect will disconnect and stop the replicator, but not set the state - such that it will be reassigned and started again.

go.mod

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

3-
go 1.24.3
3+
go 1.25.5
44

55
require (
66
dario.cat/mergo v1.0.0

manifest/product-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@
827827
"trigger_blackduck": true
828828
},
829829
"manifest/default.xml": {
830-
"go_version": "1.24.4",
830+
"go_version": "1.25.5",
831831
"interval": 30,
832832
"production": true,
833833
"release": "4.1.0",

0 commit comments

Comments
 (0)