Skip to content

Commit

Permalink
[TUF] Add flag for TUF autoupdater rollout (#1524)
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany authored Dec 21, 2023
1 parent b41dde2 commit d3aa979
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ee/agent/flags/flag_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,15 @@ func (fc *FlagController) UpdateDirectory() string {
).get(fc.getControlServerValue(keys.UpdateDirectory))
}

func (fc *FlagController) SetUseTUFAutoupdater(enabled bool) error {
return fc.setControlServerValue(keys.UseTUFAutoupdater, boolToBytes(enabled))
}
func (fc *FlagController) UseTUFAutoupdater() bool {
return NewBoolFlagValue(
WithDefaultBool(false),
).get(fc.getControlServerValue(keys.UseTUFAutoupdater))
}

func (fc *FlagController) SetExportTraces(enabled bool) error {
return fc.setControlServerValue(keys.ExportTraces, boolToBytes(enabled))
}
Expand Down
1 change: 1 addition & 0 deletions ee/agent/flags/keys/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
MirrorServerURL FlagKey = "mirror_url"
AutoupdateInterval FlagKey = "autoupdate_interval"
UpdateChannel FlagKey = "update_channel"
UseTUFAutoupdater FlagKey = "use_tuf_autoupdater"
NotaryPrefix FlagKey = "notary_prefix"
AutoupdateInitialDelay FlagKey = "autoupdater_initial_delay"
UpdateDirectory FlagKey = "update_directory"
Expand Down
7 changes: 7 additions & 0 deletions ee/agent/knapsack/knapsack.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ func (k *knapsack) UpdateDirectory() string {
return k.flags.UpdateDirectory()
}

func (k *knapsack) SetUseTUFAutoupdater(enabled bool) error {
return k.flags.SetUseTUFAutoupdater(enabled)
}
func (k *knapsack) UseTUFAutoupdater() bool {
return k.flags.UseTUFAutoupdater()
}

func (k *knapsack) SetExportTraces(enabled bool) error {
return k.flags.SetExportTraces(enabled)
}
Expand Down
4 changes: 4 additions & 0 deletions ee/agent/types/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ type Flags interface {
SetUpdateDirectory(directory string) error
UpdateDirectory() string

// UseTUFAutoupdater controls whether launcher uses the new TUF autoupdater instead of the legacy autoupdater
SetUseTUFAutoupdater(enabled bool) error
UseTUFAutoupdater() bool

// ExportTraces enables exporting our traces
SetExportTraces(enabled bool) error
SetExportTracesOverride(value bool, duration time.Duration)
Expand Down
28 changes: 28 additions & 0 deletions ee/agent/types/mocks/flags.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions ee/agent/types/mocks/knapsack.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d3aa979

Please sign in to comment.