rename builds -> bots
This commit is contained in:
@@ -104,7 +104,7 @@ func TransferLogs(ctx context.Context, filename string) (func(), error) {
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
if _, err := storage.Builds.Save(filename, f, -1); err != nil {
|
||||
if _, err := storage.Bots.Save(filename, f, -1); err != nil {
|
||||
return nil, fmt.Errorf("storage save %q: %w", filename, err)
|
||||
}
|
||||
return remove, nil
|
||||
@@ -119,7 +119,7 @@ func openLogs(ctx context.Context, inStorage bool, filename string) (io.ReadSeek
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
f, err := storage.Builds.Open(filename)
|
||||
f, err := storage.Bots.Open(filename)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("storage open %q: %w", filename, err)
|
||||
}
|
||||
|
||||
@@ -807,7 +807,7 @@ func Contexter(ctx context.Context) func(next http.Handler) http.Handler {
|
||||
ctx.Data["UnitIssuesGlobalDisabled"] = unit.TypeIssues.UnitGlobalDisabled()
|
||||
ctx.Data["UnitPullsGlobalDisabled"] = unit.TypePullRequests.UnitGlobalDisabled()
|
||||
ctx.Data["UnitProjectsGlobalDisabled"] = unit.TypeProjects.UnitGlobalDisabled()
|
||||
ctx.Data["UnitBuildsGlobalDisabled"] = unit.TypeBuilds.UnitGlobalDisabled()
|
||||
ctx.Data["UnitBotsGlobalDisabled"] = unit.TypeBots.UnitGlobalDisabled()
|
||||
|
||||
ctx.Data["locale"] = locale
|
||||
ctx.Data["AllLangs"] = translation.AllLangs()
|
||||
|
||||
@@ -1043,7 +1043,7 @@ func UnitTypes() func(ctx *Context) {
|
||||
ctx.Data["UnitTypeExternalTracker"] = unit_model.TypeExternalTracker
|
||||
ctx.Data["UnitTypeProjects"] = unit_model.TypeProjects
|
||||
ctx.Data["UnitTypePackages"] = unit_model.TypePackages
|
||||
ctx.Data["UnitTypeBuilds"] = unit_model.TypeBuilds
|
||||
ctx.Data["UnitTypeBots"] = unit_model.TypeBots
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ func NewNotifier() base.Notifier {
|
||||
}
|
||||
|
||||
func notify(repo *repo_model.Repository, doer *user_model.User, ref string, evt webhook.HookEventType, payload api.Payloader) error {
|
||||
if unit.TypeBuilds.UnitGlobalDisabled() {
|
||||
if unit.TypeBots.UnitGlobalDisabled() {
|
||||
return nil
|
||||
}
|
||||
if err := repo.LoadUnits(db.DefaultContext); err != nil {
|
||||
return fmt.Errorf("repo.LoadUnits: %w", err)
|
||||
} else if !repo.UnitEnabled(unit.TypeBuilds) {
|
||||
} else if !repo.UnitEnabled(unit.TypeBots) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func newBuilds() {
|
||||
func newBots() {
|
||||
sec := Cfg.Section("bots")
|
||||
if err := sec.MapTo(&Bots); err != nil {
|
||||
log.Fatal("Failed to map Builds settings: %v", err)
|
||||
log.Fatal("Failed to map Bots settings: %v", err)
|
||||
}
|
||||
|
||||
Bots.Storage = getStorage("bots_log", "", nil)
|
||||
|
||||
@@ -1079,7 +1079,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
|
||||
|
||||
newPackages()
|
||||
|
||||
newBuilds()
|
||||
newBots()
|
||||
|
||||
if err = Cfg.Section("ui").MapTo(&UI); err != nil {
|
||||
log.Fatal("Failed to map UI settings: %v", err)
|
||||
|
||||
@@ -127,8 +127,8 @@ var (
|
||||
// Packages represents packages storage
|
||||
Packages ObjectStorage
|
||||
|
||||
// Builds represents builds storage
|
||||
Builds ObjectStorage
|
||||
// Bots represents bots storage
|
||||
Bots ObjectStorage
|
||||
)
|
||||
|
||||
// Init init the stoarge
|
||||
@@ -200,6 +200,6 @@ func initPackages() (err error) {
|
||||
|
||||
func initBots() (err error) {
|
||||
log.Info("Initialising Bots storage with type: %s", setting.Bots.Storage.Type)
|
||||
Builds, err = NewStorage(setting.Bots.Storage.Type, &setting.Bots.Storage)
|
||||
Bots, err = NewStorage(setting.Bots.Storage.Type, &setting.Bots.Storage)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user