feat: add template activity_bump property (#11734)

Allows template admins to configure the activity bump duration. Defaults to 1h.
This commit is contained in:
Dean Sheather
2024-02-13 07:00:35 +00:00
committed by GitHub
parent fead57f304
commit e1e352d8c1
34 changed files with 354 additions and 90 deletions
+1
View File
@@ -88,6 +88,7 @@ var auditableResourcesTypes = map[any]map[string]Action{
"time_til_dormant_autodelete": ActionTrack,
"require_active_version": ActionTrack,
"deprecated": ActionTrack,
"activity_bump": ActionTrack,
},
&database.TemplateVersion{}: {
"id": ActionTrack,
+3
View File
@@ -75,6 +75,7 @@ func (*EnterpriseTemplateScheduleStore) Get(ctx context.Context, db database.Sto
UserAutostartEnabled: tpl.AllowUserAutostart,
UserAutostopEnabled: tpl.AllowUserAutostop,
DefaultTTL: time.Duration(tpl.DefaultTTL),
ActivityBump: time.Duration(tpl.ActivityBump),
MaxTTL: time.Duration(tpl.MaxTTL),
UseMaxTTL: tpl.UseMaxTtl,
AutostopRequirement: agpl.TemplateAutostopRequirement{
@@ -103,6 +104,7 @@ func (s *EnterpriseTemplateScheduleStore) Set(ctx context.Context, db database.S
}
if int64(opts.DefaultTTL) == tpl.DefaultTTL &&
int64(opts.ActivityBump) == tpl.ActivityBump &&
opts.UseMaxTTL != tpl.UseMaxTtl &&
int64(opts.MaxTTL) == tpl.MaxTTL &&
int16(opts.AutostopRequirement.DaysOfWeek) == tpl.AutostopRequirementDaysOfWeek &&
@@ -138,6 +140,7 @@ func (s *EnterpriseTemplateScheduleStore) Set(ctx context.Context, db database.S
AllowUserAutostart: opts.UserAutostartEnabled,
AllowUserAutostop: opts.UserAutostopEnabled,
DefaultTTL: int64(opts.DefaultTTL),
ActivityBump: int64(opts.ActivityBump),
UseMaxTtl: opts.UseMaxTTL,
MaxTTL: int64(opts.MaxTTL),
AutostopRequirementDaysOfWeek: int16(opts.AutostopRequirement.DaysOfWeek),