added delayed status to better differentiate between queued (skipped) and queued
This commit is contained in:
parent
76152a3410
commit
041e7762f7
@ -112,6 +112,7 @@ const (
|
||||
StatusFailed Status = "failed"
|
||||
StatusBuild Status = "build"
|
||||
StatusQueued Status = "queued"
|
||||
StatusDelayed Status = "delayed"
|
||||
StatusBuilding Status = "building"
|
||||
StatusLatest Status = "latest"
|
||||
StatusSigning Status = "signing"
|
||||
@ -125,7 +126,7 @@ func (s Status) String() string {
|
||||
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
||||
func StatusValidator(s Status) error {
|
||||
switch s {
|
||||
case StatusSkipped, StatusFailed, StatusBuild, StatusQueued, StatusBuilding, StatusLatest, StatusSigning, StatusUnknown:
|
||||
case StatusSkipped, StatusFailed, StatusBuild, StatusQueued, StatusDelayed, StatusBuilding, StatusLatest, StatusSigning, StatusUnknown:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("dbpackage: invalid enum value for status field: %q", s)
|
||||
|
@ -13,7 +13,7 @@ var (
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "pkgbase", Type: field.TypeString},
|
||||
{Name: "packages", Type: field.TypeJSON, Nullable: true},
|
||||
{Name: "status", Type: field.TypeEnum, Nullable: true, Enums: []string{"skipped", "failed", "build", "queued", "building", "latest", "signing", "unknown"}, Default: "unknown"},
|
||||
{Name: "status", Type: field.TypeEnum, Nullable: true, Enums: []string{"skipped", "failed", "build", "queued", "delayed", "building", "latest", "signing", "unknown"}, Default: "unknown"},
|
||||
{Name: "skip_reason", Type: field.TypeString, Nullable: true},
|
||||
{Name: "repository", Type: field.TypeEnum, Enums: []string{"extra", "core", "community"}},
|
||||
{Name: "march", Type: field.TypeString},
|
||||
|
@ -15,7 +15,7 @@ func (DbPackage) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("pkgbase").NotEmpty().Immutable(),
|
||||
field.Strings("packages").Optional(),
|
||||
field.Enum("status").Values("skipped", "failed", "build", "queued", "building", "latest", "signing", "unknown").Default("unknown").Optional(),
|
||||
field.Enum("status").Values("skipped", "failed", "build", "queued", "delayed", "building", "latest", "signing", "unknown").Default("unknown").Optional(),
|
||||
field.String("skip_reason").Optional(),
|
||||
field.Enum("repository").Values("extra", "core", "community"),
|
||||
field.String("march").NotEmpty().Immutable(),
|
||||
|
4
main.go
4
main.go
@ -498,10 +498,6 @@ func (b *BuildManager) syncWorker(ctx context.Context) error {
|
||||
}
|
||||
|
||||
for _, pkg := range queue {
|
||||
if pkg.DbPackage.SkipReason != "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if pkg.Priority() > cutOff && cutOff >= conf.Build.SlowQueueThreshold {
|
||||
slowQueue = append(slowQueue, pkg)
|
||||
} else {
|
||||
|
@ -120,20 +120,20 @@ func (p *ProtoPackage) isEligible(ctx context.Context) (bool, error) {
|
||||
if !isLatest {
|
||||
if local != nil {
|
||||
log.Infof("Delayed %s: not all dependencies are up to date (local: %s==%s, sync: %s==%s)", p.Srcinfo.Pkgbase, local.Name(), local.Version(), local.Name(), syncVersion)
|
||||
p.DbPackage.Update().SetSkipReason(fmt.Sprintf("waiting for %s==%s", local.Name(), syncVersion)).ExecX(ctx)
|
||||
p.DbPackage.Update().SetStatus(dbpackage.StatusDelayed).SetSkipReason(fmt.Sprintf("waiting for %s==%s", local.Name(), syncVersion)).ExecX(ctx)
|
||||
|
||||
// Returning an error here causes the package to be purged.
|
||||
// Purge delayed packages in case delay is caused by inconsistencies in svn2git.
|
||||
// Worst case would be clients downloading a package update twice, once from their official mirror,
|
||||
// and then after build from ALHP. Best case we prevent a not buildable package from staying in the repos
|
||||
// in an outdated version.
|
||||
if time.Since(local.BuildDate()).Hours() >= 48 && p.DbPackage.RepoVersion != "" {
|
||||
return false, errors.New("overdue package waiting")
|
||||
}
|
||||
} else {
|
||||
log.Infof("Delayed %s: not all dependencies are up to date or resolvable", p.Srcinfo.Pkgbase)
|
||||
p.DbPackage.Update().SetSkipReason("waiting for mirror").ExecX(ctx)
|
||||
p.DbPackage.Update().SetStatus(dbpackage.StatusDelayed).SetSkipReason("waiting for mirror").ExecX(ctx)
|
||||
}
|
||||
|
||||
// Purge delayed packages in case delay is caused by inconsistencies in svn2git.
|
||||
// Worst case would be clients downloading a package update twice, once from their official mirror,
|
||||
// and then after build from ALHP. Best case we prevent a not buildable package from staying in the repos
|
||||
// in an outdated version.
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
2
utils.go
2
utils.go
@ -129,7 +129,7 @@ func statusId2string(s dbpackage.Status) string {
|
||||
return conf.Status.Class.Failed
|
||||
case dbpackage.StatusSigning:
|
||||
return conf.Status.Class.Signing
|
||||
case dbpackage.StatusBuilding:
|
||||
case dbpackage.StatusBuilding, dbpackage.StatusDelayed:
|
||||
return conf.Status.Class.Building
|
||||
default:
|
||||
return conf.Status.Class.Unknown
|
||||
|
Loading…
x
Reference in New Issue
Block a user