You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "DoDiODev (via GitHub)" <gi...@apache.org> on 2026/09/28 12:14:09 UTC

[PR] build(backend): pin mockery in one place and resolve it via go run [devlake]

DoDiODev opened a new pull request, #9180:
URL: https://github.com/apache/devlake/pull/9180

   ### Summary
   
   `backend/Dockerfile` still installs mockery **v3.7.2**, while everything else is on **v3.7.4**: `backend/Makefile` (`go-dep`), `backend/Dockerfile.local` and `backend/scripts/install-mockery.sh`, which the `unit-test` and `golangci-lint` workflows use. Which mockery generates the mocks therefore depends on the build path. `make mock` also runs whatever `mockery` is first on the `PATH`, e.g. the mockery v2 shipped in `mericodev/lake-builder:latest`, which cannot read the v3 YAML configuration.
   
   ### Changes
   
   - **`backend/Dockerfile`:** mockery `v3.7.2` → `v3.7.4`.
   - **`backend/Makefile`:**
     ```make
     MOCKERY_VERSION ?= v3.7.4
     MOCKERY ?= GOOS= GOARCH= CGO_ENABLED=0 go run github.com/vektra/mockery/v3@$(MOCKERY_VERSION)
     ```
     `make mock` calls `$(MOCKERY)`, `make go-dep` installs `@$(MOCKERY_VERSION)`. The pinned version is used no matter what is on the `PATH`, and `go run` reuses the module/build cache, so there is little overhead after the first run.
     `GOOS`/`GOARCH` are cleared and cgo is disabled because `backend/Dockerfile` runs `make all` with the *target* `GOARCH`/`CC` exported. Without that, `go run` would build mockery for the target platform and fail with `exec format error` in the arm64/amd64 cross build.
     `MOCKERY=mockery make mock` keeps the previous behaviour.
   
   No Go source, `go.mod`, `go.sum` or workflow change.
   
   ### Verification
   
   | Check | Result |
   |---|---|
   | `make mock` with no `mockery` on `PATH` | ✅ 67 mocks, all `version=v3.7.4` |
   | `GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc CGO_ENABLED=1 make mock` (cross, arm64 host) | ✅ — without the `GOOS=/GOARCH=` prefix: `exec format error` |
   | `GOARCH=arm64 make mock` | ✅ |
   | `docker buildx build --platform linux/amd64 --target build` of `backend/Dockerfile` on an arm64 host (cross build, `make all`) | ✅ |
   | `go vet ./helpers/unithelper/`, `go test ./core/migration/ ./helpers/pluginhelper/api/` | ✅ |
   
   Unmodified upstream workflows in the fork (same `mericodev/lake-builder:latest`): NOTICE-year-check, lint-commit-message, check-grafana-dashboards, golangci-lint (runs `make mock`), migration-script-lint, yaml-lint — all green.
   
   Note for reviewers: the `paths` filters of `unit-test` and `test-e2e` only match the root `Makefile`, so neither workflow runs for this PR. To cover them I ran both in the fork with an additional throwaway commit touching a `.sh` file; both are green, and the [unit-test run](https://github.com/DoDiODev/devlake/actions/runs/36419153900) shows `make mock` resolving mockery v3.7.4 via `go run`.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] build(backend): pin mockery in one place and resolve it via go run [devlake]

Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh merged PR #9180:
URL: https://github.com/apache/devlake/pull/9180


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org