docker build . stamps the git tag or short commit, not dev (closes #154)
script/build writes the version script/version prints into dist/package.json, which quak --version reports: the VERSION environment variable or build arg when one is given, otherwise git describe --tags --always, otherwise package.json's version. A checkout with .git whose version comes out empty, dev or unknown fails the build. .dockerignore no longer leaves out .git, and ARG VERSION has no default, so a plain docker build . of a clone stamps its commit. script/docker and script/cibuild still pass the host's version. make build-bin bundles the built dist/, so the single binary reports the same version. Model: opus-5-5
This commit is contained in:
@@ -9,8 +9,10 @@
|
||||
// Excluding too much: Prettier 3 reads `.gitignore` as a default ignore file,
|
||||
// so dropping it from the context silently changes which files the lint
|
||||
// phase's prettier check looks at compared to `make fmt-check` on the host.
|
||||
// And without `.git`, a `docker build .` given no `VERSION` build arg cannot
|
||||
// derive the version (`script/version`) and stamps `package.json`'s instead.
|
||||
//
|
||||
// Neither shows up as a build failure, so they are asserted here.
|
||||
// None of these shows up as a build failure, so they are asserted here.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@@ -47,6 +49,11 @@ describe(".dockerignore", () => {
|
||||
expect(dockerignore).not.toContain(".gitignore");
|
||||
});
|
||||
|
||||
it("leaves .git in the build context for the version", () => {
|
||||
expect(dockerignore).not.toContain(".git");
|
||||
expect(dockerignore).not.toContain(".git/");
|
||||
});
|
||||
|
||||
// BuildKit lets a `Dockerfile.dockerignore` shadow the root one; such a
|
||||
// file would silently give the build a different, unreviewed context —
|
||||
// and eslint's flat config does not ignore dot-directories, so a stray
|
||||
|
||||
Reference in New Issue
Block a user