Skip to content

Releases

v1.3 — build numbers keep naming commits that exist

Choose a tag to compare

@hpoul hpoul released this 19 Aug 13:32

Upgrade if you allocate build numbers from more than one machine. This
release closes the two issues v1.2 named as known, and seven more found
reviewing the fix — five of which failed silently.

Build numbers stopped naming commits that still exist

A build number recorded the commit's SHA as blob content, which keeps nothing
alive. Once the last branch containing that commit went away, git gc collected
it, and find-commit then succeeded while naming an object that is gone. Two
repositories using this tool were measured: 8 of 46 build numbers in one and 3
of 46 in the other pointed at commits reachable from no ref at all.

The allocation chain now takes the built commit as a second parent, so
reachability is a property of the ref rather than a job somebody has to
remember. Existing chains keep working; entries written before this release
cannot be repaired, because the objects they named are already gone.

Concurrent allocation

  • The push could not fail. One refspec constant served both fetch and push,
    and its + meant every push force-updated the remote — so the retry that
    exists for a lost race was unreachable code.
  • --force-with-lease was silently overridden by that same +. The two are
    contradictory and git does not say so.
  • The lease was observed from local refs, not from the remote it was pushed
    to, so it certified a value nothing had checked.
  • push fetched before pushing, force-updating and thereby destroying the
    very local state it had been asked to publish.
  • force-incr counted from the current commit's own note rather than from
    the shared counter. With HEAD on 1 and the counter on 3 it produced 2 — a
    number another commit already owned — and pushing it rolled the counter
    backwards, so the next allocation handed out 3 a second time.
  • force-incr recursed unboundedly, incrementing on every pass, so a remote
    that kept refusing burned a build number per attempt.
  • The retry returned the note it had just lost with, instead of refetching
    and reallocating.

Pushes are now atomic, leased against values read from the remote being pushed
to, bounded in attempts, and a run that gives up restores the refs it wrote.

And three that only showed on the failure paths

  • sync never published anything. It fetched and then pushed, and the fetch
    force-updated the local refs first — so the push was a no-op by construction.
    It pushes first now.
  • An unreachable remote read as an empty one, so a network failure looked
    like a repository with no allocations.
  • \t in a grep pattern is a tab on BSD and a literal t on GNU.

find-commit also no longer dies on a missing argument.

v1.2 — scoped notes refspec, and two silent corruptions

Choose a tag to compare

@hpoul hpoul released this 19 Aug 13:32
4f782d4

Three fixes, each reproduced against a throwaway origin.

Force-pushing every notes ref destroyed unrelated notes. The refspec covered
+refs/notes/*:refs/notes/*, so fetch and push both forced every notes ref
rather than only this tool's. A clone that had not re-fetched rolled
refs/notes/commits back to whatever it last saw — losing notes pushed by
someone else, silently and with a zero exit code. Now scoped to
refs/notes/buildnumbers, kept as a glob because a plain refspec is fatal while
the ref does not exist yet, which is every first run.

A failing push died on an unbound variable. test "$1" != "nofail" runs
under set -u, and _push is called with no argument from push, sync and
force. So instead of reporting the push failure, the script aborted with
$1: unbound variable.

A git warning could end up inside the build number. The note was read with
2>&1, folding stderr into the returned value — which callers pass straight to
--build-number and into store metadata.

Two known issues were left for v1.3: concurrent generate on two commits could
assign the same number, and force-incr recursed without bound when a push kept
failing.

Written after the fact, from the commits — this tag was published without
notes.

v1.1

Choose a tag to compare

@hpoul hpoul released this 05 Feb 09:54
  • fix generating (and reading) build-number log when not in root directory.

v1.0

Choose a tag to compare

@hpoul hpoul released this 06 Jul 10:03

Initial stable release.