added delayed status to better differentiate between queued (skipped) and queued
This commit is contained in:
@@ -112,6 +112,7 @@ const (
|
|||||||
StatusFailed Status = "failed"
|
StatusFailed Status = "failed"
|
||||||
StatusBuild Status = "build"
|
StatusBuild Status = "build"
|
||||||
StatusQueued Status = "queued"
|
StatusQueued Status = "queued"
|
||||||
|
StatusDelayed Status = "delayed"
|
||||||
StatusBuilding Status = "building"
|
StatusBuilding Status = "building"
|
||||||
StatusLatest Status = "latest"
|
StatusLatest Status = "latest"
|
||||||
StatusSigning Status = "signing"
|
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.
|
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
||||||
func StatusValidator(s Status) error {
|
func StatusValidator(s Status) error {
|
||||||
switch s {
|
switch s {
|
||||||
case StatusSkipped, StatusFailed, StatusBuild, StatusQueued, StatusBuilding, StatusLatest, StatusSigning, StatusUnknown:
|
case StatusSkipped, StatusFailed, StatusBuild, StatusQueued, StatusDelayed, StatusBuilding, StatusLatest, StatusSigning, StatusUnknown:
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("dbpackage: invalid enum value for status field: %q", s)
|
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: "id", Type: field.TypeInt, Increment: true},
|
||||||
{Name: "pkgbase", Type: field.TypeString},
|
{Name: "pkgbase", Type: field.TypeString},
|
||||||
{Name: "packages", Type: field.TypeJSON, Nullable: true},
|
{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: "skip_reason", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "repository", Type: field.TypeEnum, Enums: []string{"extra", "core", "community"}},
|
{Name: "repository", Type: field.TypeEnum, Enums: []string{"extra", "core", "community"}},
|
||||||
{Name: "march", Type: field.TypeString},
|
{Name: "march", Type: field.TypeString},
|
||||||
|
@@ -15,7 +15,7 @@ func (DbPackage) Fields() []ent.Field {
|
|||||||
return []ent.Field{
|
return []ent.Field{
|
||||||
field.String("pkgbase").NotEmpty().Immutable(),
|
field.String("pkgbase").NotEmpty().Immutable(),
|
||||||
field.Strings("packages").Optional(),
|
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.String("skip_reason").Optional(),
|
||||||
field.Enum("repository").Values("extra", "core", "community"),
|
field.Enum("repository").Values("extra", "core", "community"),
|
||||||
field.String("march").NotEmpty().Immutable(),
|
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 {
|
for _, pkg := range queue {
|
||||||
if pkg.DbPackage.SkipReason != "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if pkg.Priority() > cutOff && cutOff >= conf.Build.SlowQueueThreshold {
|
if pkg.Priority() > cutOff && cutOff >= conf.Build.SlowQueueThreshold {
|
||||||
slowQueue = append(slowQueue, pkg)
|
slowQueue = append(slowQueue, pkg)
|
||||||
} else {
|
} else {
|
||||||
|
@@ -120,20 +120,20 @@ func (p *ProtoPackage) isEligible(ctx context.Context) (bool, error) {
|
|||||||
if !isLatest {
|
if !isLatest {
|
||||||
if local != nil {
|
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)
|
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 != "" {
|
if time.Since(local.BuildDate()).Hours() >= 48 && p.DbPackage.RepoVersion != "" {
|
||||||
return false, errors.New("overdue package waiting")
|
return false, errors.New("overdue package waiting")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Infof("Delayed %s: not all dependencies are up to date or resolvable", p.Srcinfo.Pkgbase)
|
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
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
utils.go
2
utils.go
@@ -129,7 +129,7 @@ func statusId2string(s dbpackage.Status) string {
|
|||||||
return conf.Status.Class.Failed
|
return conf.Status.Class.Failed
|
||||||
case dbpackage.StatusSigning:
|
case dbpackage.StatusSigning:
|
||||||
return conf.Status.Class.Signing
|
return conf.Status.Class.Signing
|
||||||
case dbpackage.StatusBuilding:
|
case dbpackage.StatusBuilding, dbpackage.StatusDelayed:
|
||||||
return conf.Status.Class.Building
|
return conf.Status.Class.Building
|
||||||
default:
|
default:
|
||||||
return conf.Status.Class.Unknown
|
return conf.Status.Class.Unknown
|
||||||
|
Reference in New Issue
Block a user