fix(build): stamp installtype.buildType on every dev-build command
task build already stamped archied, archie-gateway and archie-agent with installtype.buildType=binary, but archie-state-store, archie-ui and archie-messaging were built unstamped. A binary built by task build is then permanently un-updatable: releaseupdate.Service.Install refuses on installtype.Unknown. Add the same stamp to the three missing go build commands and pin the contract with a root-level deployment test that fails when any go build line under the build task's cmds targets ./cmd/<name> without the stamp, naming the offending command.
This commit is contained in:
1 parent
979afee85f
commit
6b31fd1964
2 files changed
+34
-3
No files matched your search
+3
-3
@@ -453,9 +453,9 @@ tasks:
|
||||
cmds:
|
||||
- go build -ldflags "-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion={{.GATEWAY_VERSION}} -X github.com/samcharles93/archie-core/internal/app/archied.runtimeVersion={{.RUNTIME_VERSION}} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archied ./cmd/archied
|
||||
- go build -ldflags "-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion={{.GATEWAY_VERSION}} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archie-gateway ./cmd/archie-gateway
|
||||
- go build -o {{.BIN_DIR}}/archie-state-store ./cmd/archie-state-store
|
||||
- go build -o {{.BIN_DIR}}/archie-ui ./cmd/archie-ui
|
||||
- go build -o {{.BIN_DIR}}/archie-messaging ./cmd/archie-messaging
|
||||
- go build -ldflags "-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archie-state-store ./cmd/archie-state-store
|
||||
- go build -ldflags "-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archie-ui ./cmd/archie-ui
|
||||
- go build -ldflags "-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archie-messaging ./cmd/archie-messaging
|
||||
- go build -ldflags "-X github.com/samcharles93/archie-core/internal/app/agentworker.version={{.RUNTIME_VERSION}} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archie-agent ./cmd/archie-agent
|
||||
|
||||
test:
|
||||
|
||||
@@ -141,6 +141,37 @@ func TestBuildTaskSourcesTrackEmbeddedAssets(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildTaskStampsInstallTypeOnEveryCommand(t *testing.T) {
|
||||
taskfile := readDeploymentFile(t, "Taskfile.yml")
|
||||
start := strings.Index(taskfile, "\n build:\n")
|
||||
end := strings.Index(taskfile, "\n test:\n")
|
||||
if start < 0 || end < start {
|
||||
t.Fatal("Taskfile has no bounded build task")
|
||||
}
|
||||
build := taskfile[start:end]
|
||||
cmdsAt := strings.Index(build, "\n cmds:\n")
|
||||
if cmdsAt < 0 {
|
||||
t.Fatal("build task has no cmds block")
|
||||
}
|
||||
cmds := build[cmdsAt:]
|
||||
|
||||
buildLine := regexp.MustCompile(`^ - go build .*\./cmd/([a-z0-9-]+)`)
|
||||
found := 0
|
||||
for line := range strings.SplitSeq(cmds, "\n") {
|
||||
m := buildLine.FindStringSubmatch(line)
|
||||
if m == nil {
|
||||
continue
|
||||
}
|
||||
found++
|
||||
if !strings.Contains(line, "internal/installtype.buildType=") {
|
||||
t.Errorf("build task does not stamp installtype.buildType on %s: %s", m[1], strings.TrimSpace(line))
|
||||
}
|
||||
}
|
||||
if found == 0 {
|
||||
t.Fatal("build task has no go build commands under ./cmd/: this guard would assert nothing")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFormattersExcludeInterpretedSecretEngines(t *testing.T) {
|
||||
config := readDeploymentFile(t, ".golangci.yml")
|
||||
if !strings.Contains(config, `^examples/secret-engines/(age|sops|vault)\.go$`) {
|
||||
|
||||
Reference in new issue
Block a user