docker build . stamps the git tag or short commit, not dev (closes #154) #157

Merged
clawbot merged 3 commits from issue-154-version-from-git into next 2026-10-02 06:12:57 +02:00
3 changed files with 9 additions and 5 deletions
Showing only changes of commit 29b6a34d13 - Show all commits
+2 -1
View File
@@ -189,7 +189,8 @@ places, and reads `.gitignore` as its default ignore file — which is why
- the `VERSION` environment variable, or the `Dockerfile`'s `VERSION` build arg - the `VERSION` environment variable, or the `Dockerfile`'s `VERSION` build arg
(`--build-arg VERSION=...`), when one is given and not empty; (`--build-arg VERSION=...`), when one is given and not empty;
- otherwise, in a checkout with `.git`, `git describe --tags --always`: the tag - otherwise, in a checkout with `.git`, `git describe --tags --always`: the tag
on a tagged commit, otherwise the short commit; on a tagged commit; the tag, the commits since it and the short commit on a
later commit (`v1.2.3-4-gabc1234`); the short commit when no tag is reachable;
- otherwise, as in a source tarball, the version `package.json` declares. - otherwise, as in a source tarball, the version `package.json` declares.
The build fails if the checkout has `.git` and the version still comes out The build fails if the checkout has `.git` and the version still comes out
+3 -1
View File
@@ -7,7 +7,9 @@
# 1. $VERSION, if set and not empty: an explicit value, such as the # 1. $VERSION, if set and not empty: an explicit value, such as the
# Dockerfile's VERSION build arg. # Dockerfile's VERSION build arg.
# 2. If this checkout has .git, `git describe --tags --always`: the tag # 2. If this checkout has .git, `git describe --tags --always`: the tag
# on a tagged commit, otherwise the short commit. # on a tagged commit; the tag, the commits since it and the short
# commit on a later commit (v1.2.3-4-gabc1234); the short commit when
# no tag is reachable.
# 3. Otherwise, as in a source tarball, the version package.json declares. # 3. Otherwise, as in a source tarball, the version package.json declares.
# #
# A checkout with .git whose version still comes out empty, dev or unknown # A checkout with .git whose version still comes out empty, dev or unknown
+4 -3
View File
@@ -2,9 +2,10 @@
// `dist/package.json`, which is what `quak --version` reports from a build. // `dist/package.json`, which is what `quak --version` reports from a build.
// A `docker build .` of a clone is given no `VERSION` build arg, so the // A `docker build .` of a clone is given no `VERSION` build arg, so the
// version has to come from the `.git` in its context: the tag on a tagged // version has to come from the `.git` in its context: the tag on a tagged
// commit, otherwise the short commit. A checkout with `.git` that still yields // commit; the tag, the commits since it and the short commit on a later commit;
// no usable version must fail the build, not ship a version nobody can trace // the short commit when no tag is reachable. A checkout with `.git` that still
// back to its commit. // yields no usable version must fail the build, not ship a version nobody can
// trace back to its commit.
// //
// Each test copies the script into a fresh directory, which the script then // Each test copies the script into a fresh directory, which the script then
// treats as the checkout, and executes it there. // treats as the checkout, and executes it there.