diff --git a/client.go b/client.go index 1cfad2a..fea9978 100644 --- a/client.go +++ b/client.go @@ -118,8 +118,6 @@ type UserAgentInfo struct { CommitSHA string // ScaleSetID is the ID of the scale set ScaleSetID int - // HasProxy is true if the controller is running behind a proxy - HasProxy bool // Subsystem is the subsystem such as listener, controller, etc. // Each system may pick its own subsystem name. Subsystem string @@ -131,12 +129,7 @@ func (u UserAgentInfo) String() string { scaleSetID = strconv.Itoa(u.ScaleSetID) } - proxy := "Proxy/disabled" - if u.HasProxy { - proxy = "Proxy/enabled" - } - - return fmt.Sprintf("%s/%s (%s; %s) ScaleSetID/%s (%s)", u.System, u.Version, u.CommitSHA, u.Subsystem, scaleSetID, proxy) + return fmt.Sprintf("%s/%s (%s; %s) ScaleSetID/%s", u.System, u.Version, u.CommitSHA, u.Subsystem, scaleSetID) } func WithLogger(logger slog.Logger) Option { @@ -193,8 +186,10 @@ func NewClient(githubConfigURL string, creds *ActionsAuth, options ...Option) (* ac.userAgent.Store( UserAgentInfo{ - Version: "N/A", - CommitSHA: "N/A", + System: "scaleset-client", + Version: "NA", + CommitSHA: "NA", + Subsystem: "NA", ScaleSetID: 0, }.String()) diff --git a/client_test.go b/client_test.go index 7064f6d..d91f692 100644 --- a/client_test.go +++ b/client_test.go @@ -1669,14 +1669,13 @@ func TestUserAgentInfoString(t *testing.T) { Version: "0.1.0", CommitSHA: "1234567890abcdef", ScaleSetID: 10, - HasProxy: true, Subsystem: "test", } userAgent := userAgentInfo.String() expectedProduct := "actions-runner-controller/0.1.0 (1234567890abcdef; test)" assert.Contains(t, userAgent, expectedProduct) - expectedScaleSet := "ScaleSetID/10 (Proxy/enabled)" + expectedScaleSet := "ScaleSetID/10" assert.Contains(t, userAgent, expectedScaleSet) } diff --git a/examples/dockerscaleset/main.go b/examples/dockerscaleset/main.go index 30550f9..35495f1 100644 --- a/examples/dockerscaleset/main.go +++ b/examples/dockerscaleset/main.go @@ -91,6 +91,15 @@ func run(ctx context.Context, c Config) error { return fmt.Errorf("failed to create runner scale set: %w", err) } + // Set the user agent for the scaleset client now that we have the scale set ID + scalesetClient.SetUserAgent(scaleset.UserAgentInfo{ + System: "dockerscaleset", + Version: "0.1.0", + CommitSHA: "unknown", + ScaleSetID: scaleSet.ID, + Subsystem: scaleSet.Name, + }) + defer func() { logger.Info( "Deleting runner scale set",