From 3643c1fc412bf7c7e28952cb1b58f5f3c4770545 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 22:55:41 -0400 Subject: [PATCH 01/13] workflow --- .github/workflows/all.yml | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/all.yml diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml new file mode 100644 index 00000000..f5c2660e --- /dev/null +++ b/.github/workflows/all.yml @@ -0,0 +1,44 @@ +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + basics: + strategy: + fail-fast: false + matrix: + os: + - runsOn: macos-latest + mongodb_distro: mongodb-macos-arm64 + + go_version: + + # This is hard-coded by design in order to catch inadvertent changes + # to the minimum-required Go version to build migration-verifier. + - 1.19 + + runs-on: ${matrix.os.runsOn} + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Fetch Go ${{ matrix.go_version }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go_version }} + + - name: Build + run: go build main/migration_verifier.go + + - name: Lint + run: python3 ./evergreen/go_lint.py + + - name: Test + run: go test -v ./... + env: + MONGODB_DISTRO: ${matrix.os.mongodb_distro} From 69db543e0b0a273c7f9909c3695ad4e11911bfab Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 22:56:39 -0400 Subject: [PATCH 02/13] fix yaml --- .github/workflows/all.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index f5c2660e..33133628 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -40,5 +40,5 @@ jobs: - name: Test run: go test -v ./... - env: - MONGODB_DISTRO: ${matrix.os.mongodb_distro} + env: + MONGODB_DISTRO: ${matrix.os.mongodb_distro} From a0432ad823d076bf5a91fdde7f4d4f5cc9035910 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 22:57:07 -0400 Subject: [PATCH 03/13] no indent --- .github/workflows/all.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 33133628..7cf408bf 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -40,5 +40,5 @@ jobs: - name: Test run: go test -v ./... - env: - MONGODB_DISTRO: ${matrix.os.mongodb_distro} + env: + MONGODB_DISTRO: ${matrix.os.mongodb_distro} From 2de3fb0e1631f9d6e1e80dcd95bc05147d865f80 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:00:26 -0400 Subject: [PATCH 04/13] try linux --- .github/workflows/all.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 7cf408bf..968a4db9 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -12,8 +12,11 @@ jobs: fail-fast: false matrix: os: - - runsOn: macos-latest - mongodb_distro: mongodb-macos-arm64 + #- runsOn: macos-latest + # mongodb_distro: mongodb-macos-arm64 + + - runsOn: ubuntu-latest + mongodb_distro: mongodb-linux-x86_64-ubuntu2404 go_version: From 360ace2db95b9cefcd5eaa0670010b0211330c8b Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:01:18 -0400 Subject: [PATCH 05/13] helps if you use the right syntax dunnit --- .github/workflows/all.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 968a4db9..8b2d4140 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -12,8 +12,8 @@ jobs: fail-fast: false matrix: os: - #- runsOn: macos-latest - # mongodb_distro: mongodb-macos-arm64 + - runsOn: macos-latest + mongodb_distro: mongodb-macos-arm64 - runsOn: ubuntu-latest mongodb_distro: mongodb-linux-x86_64-ubuntu2404 @@ -24,7 +24,7 @@ jobs: # to the minimum-required Go version to build migration-verifier. - 1.19 - runs-on: ${matrix.os.runsOn} + runs-on: ${{matrix.os.runsOn}} steps: - name: Check out repository @@ -44,4 +44,4 @@ jobs: - name: Test run: go test -v ./... env: - MONGODB_DISTRO: ${matrix.os.mongodb_distro} + MONGODB_DISTRO: ${{matrix.os.mongodb_distro}} From 06e619ec6c8172d23cbf9a93d095e4f56a96a9a5 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:03:35 -0400 Subject: [PATCH 06/13] fix lint --- internal/verifier/pprof.go | 3 ++- main/migration_verifier.go | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/verifier/pprof.go b/internal/verifier/pprof.go index 1ffc3371..01d737b1 100644 --- a/internal/verifier/pprof.go +++ b/internal/verifier/pprof.go @@ -32,12 +32,13 @@ func (verifier *Verifier) MaybeStartPeriodicHeapProfileCollection(ctx context.Co func collectHeapUsage() { heapFileName := fmt.Sprintf("heap-%s.out", time.Now().UTC().Format("20060102T150405Z")) heapFile, err := os.Create(heapFileName) - defer heapFile.Close() if err != nil { panic(err) } + defer heapFile.Close() + err = pprof.Lookup("heap").WriteTo(heapFile, 0) if err != nil { panic(err) diff --git a/main/migration_verifier.go b/main/migration_verifier.go index 4289eb5d..cb5a6320 100644 --- a/main/migration_verifier.go +++ b/main/migration_verifier.go @@ -212,7 +212,11 @@ func handleArgs(ctx context.Context, cCtx *cli.Context) (*verifier.Verifier, err v.SetNumWorkers(cCtx.Int(numWorkers)) v.SetGenerationPauseDelayMillis(time.Duration(cCtx.Int64(generationPauseDelay))) v.SetWorkerSleepDelayMillis(time.Duration(cCtx.Int64(workerSleepDelay))) - v.SetPprofInterval(cCtx.String(pprofInterval)) + + err = v.SetPprofInterval(cCtx.String(pprofInterval)) + if err != nil { + return nil, err + } partitionSizeMB := cCtx.Uint64(partitionSizeMB) if partitionSizeMB != 0 { @@ -226,9 +230,6 @@ func handleArgs(ctx context.Context, cCtx *cli.Context) (*verifier.Verifier, err v.SetStartClean(cCtx.Bool(startClean)) logPath := cCtx.String(logPath) v.SetLogger(logPath) - if err != nil { - return nil, err - } if cCtx.Bool(verifyAll) { if len(cCtx.StringSlice(srcNamespace)) > 0 || len(cCtx.StringSlice(dstNamespace)) > 0 { return nil, errors.Errorf("Setting both verifyAll and explicit namespaces is not supported") From ff8a93babb9e1716b6228a0f629475b7f351c1a1 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:09:37 -0400 Subject: [PATCH 07/13] ubuntu 18 instead --- .github/workflows/all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 8b2d4140..74c77fa3 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -16,7 +16,7 @@ jobs: mongodb_distro: mongodb-macos-arm64 - runsOn: ubuntu-latest - mongodb_distro: mongodb-linux-x86_64-ubuntu2404 + mongodb_distro: mongodb-linux-x86_64-ubuntu1804 go_version: From d93c76cb305cf22dc3dec256d753f3ab88386ce5 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:13:09 -0400 Subject: [PATCH 08/13] lint in separate action --- .github/workflows/all.yml | 3 --- .github/workflows/lint.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 74c77fa3..ffa2d6e1 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -38,9 +38,6 @@ jobs: - name: Build run: go build main/migration_verifier.go - - name: Lint - run: python3 ./evergreen/go_lint.py - - name: Test run: go test -v ./... env: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..e283ab97 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: golangci-lint +on: + push: + branches: + - main + - master + pull_request: + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 From 9421cccb32e24c9665d50a20b62e3a41d16445e4 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:15:04 -0400 Subject: [PATCH 09/13] rename --- .github/workflows/{lint.yml => golangci-lint.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{lint.yml => golangci-lint.yml} (100%) diff --git a/.github/workflows/lint.yml b/.github/workflows/golangci-lint.yml similarity index 100% rename from .github/workflows/lint.yml rename to .github/workflows/golangci-lint.yml From 74c6706924061437666ab01dc4a5afb462a9046b Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:15:19 -0400 Subject: [PATCH 10/13] Revert "rename" This reverts commit 9421cccb32e24c9665d50a20b62e3a41d16445e4. --- .github/workflows/{golangci-lint.yml => lint.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{golangci-lint.yml => lint.yml} (100%) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/lint.yml similarity index 100% rename from .github/workflows/golangci-lint.yml rename to .github/workflows/lint.yml From 490d61d1092250433f47234d592d7f564f8963a8 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:15:43 -0400 Subject: [PATCH 11/13] run all the time --- .github/workflows/lint.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e283ab97..2e178708 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,9 +1,9 @@ -name: golangci-lint on: push: branches: - - main - - master + - '*' + tags-ignore: + - '*' pull_request: permissions: From 6a01fff744ea60b6ec794536e0e3aae2fcaf4a69 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:17:13 -0400 Subject: [PATCH 12/13] 1.19 required --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 5f8c6bbe..9c2f62b0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/10gen/migration-verifier -go 1.18 +go 1.19 require ( github.com/deckarep/golang-set/v2 v2.3.0 From d9ce7ff2522e8c79d84520a3022c3d160b24e42c Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Tue, 29 Oct 2024 23:18:50 -0400 Subject: [PATCH 13/13] test stable --- .github/workflows/all.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index ffa2d6e1..acc83985 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -23,6 +23,7 @@ jobs: # This is hard-coded by design in order to catch inadvertent changes # to the minimum-required Go version to build migration-verifier. - 1.19 + - stable runs-on: ${{matrix.os.runsOn}}