Repository navigation
ci(release): publish the blockstor CLI binaries for linux, darwin and windows - #319
Conversation
The only documented way to get the operator CLI is go install, which needs a Go toolchain on the operator's machine and gives no checksums to verify against. Attach prebuilt binaries to each release instead. The CLI is pure Go with CGO off, so one ubuntu runner cross-compiles all six targets; no native runners are needed. The tag is stamped into the binary so `controller version` reports the release it came from. On a dry run the binaries stay a workflow artifact and nothing is uploaded to a release, matching how the image jobs behave. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The release now cross-compiles the blockstor CLI for Windows, and the CLI links pkg/drbd, whose device-node helper calls syscall.Mknod and reads syscall.Stat_t. Neither exists on Windows, so the windows targets failed to compile. The two calls move to a non-Windows file; the Windows build gets a stub that reports the operation as unsupported, since DRBD device nodes only ever exist on a Linux satellite. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
The release job looks right to me: pinned SHAs, contents: read on the build job, and nothing uploads on a dry run. The Lint job is red because of the new devnode_unix.go, see the two inline comments. Unit tests fail on the same two tests as main, which #318 fixes.
| const sIFBLK = syscall.S_IFBLK | ||
|
|
||
| func mknod(path string, mode uint32, dev uint64) error { | ||
| return syscall.Mknod(path, mode, int(dev)) //nolint:gosec // dev encodes major=147 + minor<=65535; int conversion never truncates |
There was a problem hiding this comment.
Lint fails here with wrapcheck: the syscall.Mknod error is returned unwrapped. return errors.WithStack(syscall.Mknod(path, mode, int(dev))) from cockroachdb/errors fixes it and still returns nil on success.
There was a problem hiding this comment.
Fixed in e46246e: the syscall.Mknod error now goes through errors.WithStack, so wrapcheck is happy and success still returns nil.
| return 0, false | ||
| } | ||
|
|
||
| return uint64(stat.Rdev), true //nolint:gosec,unconvert // Rdev type varies by OS and arch |
There was a problem hiding this comment.
nolintlint says gosec is unused in this directive, so Lint fails. //nolint:unconvert // Rdev type varies by OS and arch is enough.
There was a problem hiding this comment.
Same commit, e46246e: the directive is now //nolint:unconvert // Rdev type varies by OS and arch. The release cross-builds of ./cmd/blockstor for linux, darwin and windows still compile.
Lint failed on the Unix device-node helper: wrapcheck wants the syscall error wrapped like every other external error in the package, and nolintlint reports the gosec exemption on the Rdev conversion as unused on Linux, where only unconvert fires. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
LGTM. Both lint points are fixed: errors.WithStack around syscall.Mknod still returns nil on success, and the directive is down to unconvert. Lint, unit and integration are green on this head now that the main breakage is fixed.
Right now the only way to get the CLI is
go install, which needs a Go toolchain and gives you nothing to verify the binary against.Every release now gets prebuilt
blockstor-<os>-<arch>binaries for linux, darwin and windows on amd64 and arm64, plusSHA256SUMS. The CLI is pure Go with CGO off, so one runner builds all six. The tag is stamped in, soblockstor controller versionshows the release. Aworkflow_dispatchrun on a branch is still a dry run: binaries stay a workflow artifact and nothing is uploaded, same as for the images.The windows targets did not compile, because the device node helper in
pkg/drbdusessyscall.Mknodandsyscall.Stat_t. These calls are moved to a non-Windows file, and on Windows a stub returns an error. DRBD device nodes only exist on a Linux satellite anyway. Nothing changes on Linux.Testing
Dry run of the release workflow on this branch passed: all six binaries built and uploaded as an artifact, image jobs green. Locally: built for all six targets,
go vetwith GOOS=windows,pkg/drbdtests pass.