Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Blocker: no. This is not a defect. The team adds it on top of the blocker stack, because the server-monitoring work uses these commands each day.
Defect
- The repository has no single entry point for developer commands.
- To build, a developer runs
go buildand must add the version-ldflagsmanually. Onlybuild.shhas these flags. build.shalways builds all release platforms. It has no other tasks.- The checks are separate commands:
go vet,go test -race,golangci-lintandgovulncheck. The documentation does not list them. - CI does not run the checks, because the team skipped enhancement(ci): add checks for pull requests and replace the archived release actions #7. Thus each developer must remember all checks before each merge.
- A
golangci-lintbinary from a package manager can use an older Go version than the module. Test: Homebrewgolangci-lint2.12.2 (built with Go 1.26) on this module after bug: Build with a supported Go version and make static binaries #6. Result:the Go language version (go1.26) used to build golangci-lint is lower than the targeted Go version (1.27.1). - The migration-agent repository uses
make build,make test,make lintandmake release. This repository uses different commands for the same tasks.
Cost
- Developers type long commands. A developer can build a binary without the version by mistake.
- A developer can merge a change without a check, because no single command runs all checks.
- A lint tool from a package manager can stop when the Go version of the module changes.
- Developers who work on the two repositories must learn two sets of commands.
Benefit of the fix
- One command does each task:
make build,make test,make lint,make vuln,make checkandmake release. make checkis the local gate before each merge. Each developer runs the same checks.- The Makefile sets the versions of
golangci-lintandgovulncheckand builds them with the Go version of the module. Thus the tools always agree with the module. - The commands agree with the migration-agent repository.
Fix
- Add a
Makefilewith these targets:build: buildbin/flyfor the local platform. Stamp the version, the commit and the date from git.test:go test ./... -race -count=1.lint:golangci-lint run, with a fixed version, throughgo run.vuln:govulncheck ./..., with a fixed version, throughgo run.fmt:gofmt -w ..check: agofmtcheck,go vet,lint,testandvuln.release: staticlinux/amd64andlinux/arm64binaries, their archives andchecksums.txtinbuild/.VERSIONreplaces the version from git.clean: removebin/andbuild/.
- Change
build.shto a small wrapper that runsmake release. The release workflow callsbuild.sh, and the team skipped enhancement(ci): add checks for pull requests and replace the archived release actions #7. - Document the targets in the README.
Caution
CAUTION: DO NOT CHANGE THE NAMES OR THE CONTENTS OF THE RELEASE ASSETS. IF YOU CHANGE THEM, THE INSTALLED CLIS CANNOT RUN fly update.
make releasemust make the same archives asbuild.sh:fly-linux-<arch>.tar.gz, with the binaryfly-linux-<arch>in it.
Differences from migration-agent
- The main package is at the repository root, not in
./cmd/agent. - The version goes to
internal/version.Version,CommitHashandBuildDate, not tomain.version. releasebuilds two architectures and makes.tar.gzarchives, because the updater (bug(self-update): correct the version comparison, the HTTP errors and the binary replacement #8) andinstall.shneed them. There is noPROVIDERvariable.- The repository has no integration tests. Thus there is no
test-integrationtarget. lintandvulnuse fixed tool versions throughgo run(refer to the Go version item above).checksums.txtprepares enhancement: Examine release downloads with checksums #9. The release workflow does not upload it yet.- The Makefile must operate with GNU Make 3.81, the version on macOS.
Completion checks
-
make buildmakesbin/fly, andbin/fly versionshows the git version. -
make checkpasses on the full stack. -
make releasemakes the same archive names and contents asbuild.shbefore this change. - The static-binary checks from bug: Build with a supported Go version and make static binaries #6 pass for
make release. -
make release VERSION=v9.9.9stampsv9.9.9. -
./build.shstill makes the release archives.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
build: add a Makefile for the build, test, lint and release commands (#…
[-]Add a Makefile for the build, test, lint and release commands[/-][+]enhancement: Add a Makefile for the build, test, lint and release commands[/+]