Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d97c09c49 | ||
|
|
9c4b2c5e56 | ||
|
|
0261881feb |
@@ -150,6 +150,11 @@ const (
|
||||
// WaitsFor: a fetch found the module's lock naming a package version the registry does not hold yet; the builder
|
||||
// writes the key queued with Waits (novox/hq ADR 0500 clause 6), and it is built once the package is published.
|
||||
WaitsFor = "waits for: "
|
||||
// Retake: a failure that passes by itself (a name lookup that timed out, a refused connection): the builder takes
|
||||
// the key again after a backoff, at most MaxRetakes times (issue 1748). A build module opens every such failure with it.
|
||||
Retake = "retakeable: "
|
||||
// MaxRetakes is how many times the builder takes a key again by itself for a retakeable failure.
|
||||
MaxRetakes = 3
|
||||
)
|
||||
|
||||
// FailedUntilChanged says whether a failed key's error is one that is not built again until the module's fingerprint
|
||||
@@ -159,6 +164,12 @@ func FailedUntilChanged(err string) bool {
|
||||
return strings.HasPrefix(err, NotPinned) || strings.HasPrefix(err, VersionTaken) || strings.HasPrefix(err, RefusedKind)
|
||||
}
|
||||
|
||||
// Retakeable says whether a failed key's error opens with Retake: the builder takes it again by itself after a backoff,
|
||||
// until BuilderBuild.Retakes reaches MaxRetakes. An error that is FailedUntilChanged, or opens with no prefix, is not.
|
||||
func Retakeable(err string) bool {
|
||||
return strings.HasPrefix(err, Retake) && !FailedUntilChanged(err)
|
||||
}
|
||||
|
||||
// ToolchainUsed is what a build used for one language (ADR 0405 clauses 2 and 7): the installed toolchain's version and
|
||||
// the build module's recipe version.
|
||||
type ToolchainUsed struct {
|
||||
@@ -180,6 +191,10 @@ type BuilderBuild struct {
|
||||
Artifacts []BuiltArtifact `json:"artifacts,omitempty"`
|
||||
Toolchains map[string]ToolchainUsed `json:"toolchains,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
// Retakes is how many times the builder took this key again by itself after a retakeable failure (Retake); it is kept
|
||||
// on the key, so a builder that starts again reads it and the count survives a restart (issue 1748). A reader that
|
||||
// does not know the field reads 0.
|
||||
Retakes int `json:"retakes,omitempty"`
|
||||
// Waits is, on a queued key only, the package version `<name>@<version>` the module's lock names and the registry
|
||||
// does not yet hold: the key is not claimed until that package's trunk key is done and published (novox/hq ADR 0500
|
||||
// clause 6). A reader that does not know the field reads the key as queued.
|
||||
|
||||
@@ -86,11 +86,38 @@ func TestOnlyAPushFailureIsBuiltAgainBeforeTheFingerprintChanges(t *testing.T) {
|
||||
{VersionTaken + "@novox/mesh-sdk@0.1.15 holds another file", false},
|
||||
{RefusedKind + "a package in go", false},
|
||||
{"go test: 2 failed", true},
|
||||
{Retake + "lookup git.novox.be: i/o timeout", true},
|
||||
} {
|
||||
if got := FailedUntilChanged(c.err); got == c.again {
|
||||
t.Errorf("FailedUntilChanged(%q) = %v", c.err, got)
|
||||
}
|
||||
}
|
||||
// A retakeable error opens with Retake and is not one that waits for the fingerprint; the count is on the key's value (issue 1748).
|
||||
for _, c := range []struct {
|
||||
err string
|
||||
want bool
|
||||
}{
|
||||
{Retake + "lookup git.novox.be: i/o timeout", true},
|
||||
{NotPinned + "x", false},
|
||||
{Retake[:4] + " not the prefix", false},
|
||||
{"go test: 2 failed", false},
|
||||
{"", false},
|
||||
{VersionTaken + Retake, false},
|
||||
} {
|
||||
if got := Retakeable(c.err); got != c.want {
|
||||
t.Errorf("Retakeable(%q) = %v", c.err, got)
|
||||
}
|
||||
}
|
||||
data, err := EncodeBuilderBuild(BuilderBuild{State: BuildFailed, Error: Retake + "x", Retakes: 2})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if back, err := DecodeBuilderBuild(data); err != nil || back.Retakes != 2 {
|
||||
t.Fatalf("decoded %+v, %v", back, err)
|
||||
}
|
||||
if Retake != "retakeable: " || MaxRetakes != 3 {
|
||||
t.Fatal("the retake prefix or its bound changed")
|
||||
}
|
||||
if NotStored != "not stored: " || NotPinned != "not pinned: " || VersionTaken != "version taken: " || RefusedKind != "refused kind: " {
|
||||
t.Fatal("a prefix changed its words")
|
||||
}
|
||||
|
||||
@@ -175,6 +175,9 @@ type BuildLogEntry struct {
|
||||
// sorted and each once, as the build module answered them (BuildAnswer.Imports; novox/hq ADR 0593 §2): the indexer
|
||||
// keeps them on the module (KeptInputs2.Imports) when the build's fingerprint is the module's.
|
||||
Imports []string `json:"imports,omitempty"`
|
||||
// Retakes is, at a build's end, how many times the builder took the key again by itself after a retakeable failure
|
||||
// (BuilderBuild.Retakes; issue 1748): builder_builds_since reads it.
|
||||
Retakes int `json:"retakes,omitempty"`
|
||||
}
|
||||
|
||||
// BuildsSince is the answer of BuildsSinceTool: every ended build since a time, oldest first, and whether the log held
|
||||
|
||||
Reference in New Issue
Block a user