Skip to content

Commit

Permalink
use binary as fallback deploy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
captncraig committed Nov 15, 2023
1 parent 3b83779 commit 315c1bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/useragent/useragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func getRunMode() string {

func getDeployMode() string {
op := os.Getenv(deployModeEnv)
// only return known modes
// only return known modes. Use "binary" as a default catch-all.
switch op {
case "operator", "helm", "docker", "deb", "rpm", "brew":
return op
}
return ""
return "binary"
}
8 changes: 4 additions & 4 deletions internal/useragent/useragent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ func TestUserAgent(t *testing.T) {
{
Name: "basic",
Mode: "",
Expected: "GrafanaAgent/v1.2.3 (static; linux)",
Expected: "GrafanaAgent/v1.2.3 (static; linux; binary)",
GOOS: "linux",
},
{
Name: "flow",
Mode: "flow",
Expected: "GrafanaAgent/v1.2.3 (flow; windows)",
Expected: "GrafanaAgent/v1.2.3 (flow; windows; binary)",
GOOS: "windows",
},
{
Name: "static",
Mode: "static",
Expected: "GrafanaAgent/v1.2.3 (static; darwin)",
Expected: "GrafanaAgent/v1.2.3 (static; darwin; binary)",
GOOS: "darwin",
},
{
Name: "unknown",
Mode: "blahlahblah",
// unknown mode, should not happen. But we will substitute 'unknown' to avoid allowing arbitrary cardinality.
Expected: "GrafanaAgent/v1.2.3 (unknown; freebsd)",
Expected: "GrafanaAgent/v1.2.3 (unknown; freebsd; binary)",
GOOS: "freebsd",
},
{
Expand Down

0 comments on commit 315c1bf

Please sign in to comment.