Skip to content

Commit 7338674

Browse files
committed
Update Go version from 1.22.5 to 1.23.0
Updates Go version across all Dockerfiles and CI workflows to align with upstream commit 874388b. This update was missed in previous CVE-related PRs. Updated files: - Dockerfile (2 occurrences) - hack/build-image/Dockerfile - .github/workflows/pr-ci-check.yml - .github/workflows/push.yml - .github/workflows/e2e-test-kind.yaml (2 occurrences) - .github/workflows/crds-verify-kind.yaml - Tiltfile Signed-off-by: Tiger Kaovilai <tkaovilai@redhat.com>
1 parent 13093b2 commit 7338674

8 files changed

Lines changed: 76 additions & 9 deletions

File tree

.github/workflows/crds-verify-kind.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Go
1515
uses: actions/setup-go@v5
1616
with:
17-
go-version: '1.22.5'
17+
go-version: '1.23.0'
1818
id: go
1919
# Look for a CLI that's made for this PR
2020
- name: Fetch built CLI

.github/workflows/e2e-test-kind.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Go
1515
uses: actions/setup-go@v5
1616
with:
17-
go-version: '1.22.5'
17+
go-version: '1.23.0'
1818
id: go
1919
# Look for a CLI that's made for this PR
2020
- name: Fetch built CLI
@@ -82,7 +82,7 @@ jobs:
8282
- name: Set up Go
8383
uses: actions/setup-go@v5
8484
with:
85-
go-version: '1.22.5'
85+
go-version: '1.23.0'
8686
id: go
8787
- name: Check out the code
8888
uses: actions/checkout@v4

.github/workflows/pr-ci-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Set up Go
1111
uses: actions/setup-go@v5
1212
with:
13-
go-version: '1.22.5'
13+
go-version: '1.23.0'
1414
id: go
1515
- name: Check out the code
1616
uses: actions/checkout@v4

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: '1.22.5'
21+
go-version: '1.23.0'
2222
id: go
2323

2424
- uses: actions/checkout@v4

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Velero binary build section
16-
FROM --platform=$BUILDPLATFORM golang:1.22.5-bookworm as velero-builder
16+
FROM --platform=$BUILDPLATFORM golang:1.23.0-bookworm as velero-builder
1717

1818
ARG GOPROXY
1919
ARG BIN
@@ -47,7 +47,7 @@ RUN mkdir -p /output/usr/bin && \
4747
go clean -modcache -cache
4848

4949
# Restic binary build section
50-
FROM --platform=$BUILDPLATFORM golang:1.22.5-bookworm as restic-builder
50+
FROM --platform=$BUILDPLATFORM golang:1.23.0-bookworm as restic-builder
5151

5252
ARG BIN
5353
ARG TARGETOS

PR-434-description.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Fix: Call WaitGroup.Done() once only when PVB changes to final status + Update Go to 1.23.0
2+
3+
## Summary
4+
5+
This PR includes two important updates:
6+
7+
1. **PVB WaitGroup Fix**: Adapts upstream fix [vmware-tanzu/velero#8940](https://github.com/vmware-tanzu/velero/pull/8940) (commit 2eb97fa8b187f9ed0aeb49f216565eddf93a0b08) to prevent calling `WaitGroup.Done()` multiple times for the same PodVolumeBackup, which causes "negative WaitGroup counter" panic errors.
8+
9+
2. **Go Version Update**: Updates Go version from 1.22.5 to 1.23.0 across all Dockerfiles and CI workflows, aligning with upstream commit [874388bd3e34bbcfe955f624b8e3579d959132fc](https://github.com/vmware-tanzu/velero/commit/874388bd3e34bbcfe955f624b8e3579d959132fc). This update was missed in previous CVE-related PRs.
10+
11+
## Problem
12+
When the event handler receives multiple update events for a PodVolumeBackup that's already in a final status (Completed or Failed), it could call `WaitGroup.Done()` multiple times, leading to a panic.
13+
14+
## Implementation Differences from Upstream
15+
16+
### Upstream Version (Velero main branch)
17+
- Uses a `pvbIndexer` field (`cache.Indexer`) in the `backupper` struct
18+
- Tracks PVB states through the indexer infrastructure
19+
- Checks if PVB already exists in final status before calling `Done()`
20+
21+
### Our Version (OADP 1.4)
22+
- **Does not have the `pvbIndexer` infrastructure** that exists upstream
23+
- Implements a simpler solution using `sync.Map` to track processed PVBs
24+
- Adds a new field `processedPVBs sync.Map` to the `backupper` struct
25+
- Uses `LoadOrStore` to atomically check and mark PVBs as processed
26+
27+
## Why Direct Cherry-pick Wasn't Possible
28+
The upstream commit relies on the `pvbIndexer` infrastructure that was introduced in later versions of Velero but is not present in the OADP 1.4 branch. A direct cherry-pick would fail due to:
29+
1. Missing `pvbIndexer` field in the `backupper` struct
30+
2. Missing indexer initialization code
31+
3. Different architectural approach to tracking PVB states
32+
33+
## Adapted Solution
34+
```go
35+
// Added to backupper struct:
36+
processedPVBs sync.Map // tracks PVBs that have already been processed
37+
38+
// In the event handler:
39+
pvbKey := pvb.Namespace + "/" + pvb.Name
40+
if _, alreadyProcessed := b.processedPVBs.LoadOrStore(pvbKey, true); !alreadyProcessed {
41+
b.result = append(b.result, pvb)
42+
b.wg.Done()
43+
}
44+
```
45+
46+
This achieves the same goal as upstream - preventing multiple `Done()` calls for the same PVB - but using a simpler approach suitable for OADP 1.4's codebase.
47+
48+
## Testing
49+
- All existing tests pass
50+
- The fix prevents the panic while maintaining the same functional behavior
51+
- Tested with `go test ./pkg/podvolume/... -v -count=1`
52+
53+
## Files Updated for Go 1.23.0
54+
55+
- `Dockerfile` (2 occurrences)
56+
- `hack/build-image/Dockerfile`
57+
- `.github/workflows/pr-ci-check.yml`
58+
- `.github/workflows/push.yml`
59+
- `.github/workflows/e2e-test-kind.yaml` (2 occurrences)
60+
- `.github/workflows/crds-verify-kind.yaml`
61+
- `Tiltfile`
62+
63+
## Related Issues
64+
65+
- Fixes the "negative WaitGroup counter" panic in PodVolumeBackup processing
66+
- Based on upstream PR: https://github.com/vmware-tanzu/velero/pull/8940
67+
- Go update based on upstream commit: https://github.com/vmware-tanzu/velero/commit/874388bd3e34bbcfe955f624b8e3579d959132fc

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ git_sha = str(local("git rev-parse HEAD", quiet = True, echo_off = True)).strip(
5252

5353
tilt_helper_dockerfile_header = """
5454
# Tilt image
55-
FROM golang:1.22.5 as tilt-helper
55+
FROM golang:1.23.0 as tilt-helper
5656
5757
# Support live reloading with Tilt
5858
RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/restart.sh && \

hack/build-image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM --platform=$TARGETPLATFORM golang:1.22.5-bookworm
15+
FROM --platform=$TARGETPLATFORM golang:1.23.0-bookworm
1616

1717
ARG GOPROXY
1818

0 commit comments

Comments
 (0)