diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index a19a08fca..c4aec4a2d 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: go-version: - - 1.21.x + - 1.22.x platform: - ubuntu-latest - macos-latest @@ -25,7 +25,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Compile run: make compile-only diff --git a/.github/workflows/e2e-dp-eu.yml b/.github/workflows/e2e-dp-eu.yml index 729a455e2..f645ad41b 100644 --- a/.github/workflows/e2e-dp-eu.yml +++ b/.github/workflows/e2e-dp-eu.yml @@ -75,7 +75,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH diff --git a/.github/workflows/e2e-dp-us.yml b/.github/workflows/e2e-dp-us.yml index 762c32498..42242dc1e 100644 --- a/.github/workflows/e2e-dp-us.yml +++ b/.github/workflows/e2e-dp-us.yml @@ -75,7 +75,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH diff --git a/.github/workflows/e2e-eu.yml b/.github/workflows/e2e-eu.yml index b053c19d2..eb9fa4e50 100644 --- a/.github/workflows/e2e-eu.yml +++ b/.github/workflows/e2e-eu.yml @@ -73,7 +73,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7a8aad199..d18b71539 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -73,7 +73,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2db4b32dd..087dfe156 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index e60188e3c..615bdd00f 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -17,7 +17,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f33a6c7a1..d15d07a70 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH @@ -54,7 +54,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" @@ -85,7 +85,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" diff --git a/go.mod b/go.mod index 22de6545e..f32234f0c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/newrelic/newrelic-cli -go 1.21 +go 1.22 + +toolchain go1.22.9 require ( github.com/AlecAivazis/survey/v2 v2.3.7 @@ -16,7 +18,7 @@ require ( github.com/jedib0t/go-pretty/v6 v6.4.4 github.com/joshdk/go-junit v0.0.0-20210226021600-6145f504ca0d github.com/mitchellh/go-homedir v1.1.0 - github.com/newrelic/newrelic-client-go/v2 v2.48.2 + github.com/newrelic/newrelic-client-go/v2 v2.51.4-0.20241111153946-a221c9e3bd63 github.com/pkg/errors v0.9.1 github.com/shirou/gopsutil/v3 v3.23.9 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index 1bc18b7e8..ec40c0b41 100644 --- a/go.sum +++ b/go.sum @@ -99,8 +99,10 @@ github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGg github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/newrelic-forks/task/v3 v3.11.0 h1:8Gwo33tMTqQkWlekCChbCZqf0nrXI85UqVeIgXk73L0= github.com/newrelic-forks/task/v3 v3.11.0/go.mod h1:rzfFpA7kl0CsL44ZQd2F2Hic5xOb2m03N6Y2lUjdNo4= -github.com/newrelic/newrelic-client-go/v2 v2.48.2 h1:Pd8/ADdidF/dISMCy9B2UHvcD11lnj4Use6j++OOEf4= -github.com/newrelic/newrelic-client-go/v2 v2.48.2/go.mod h1:pDFY24/6iIMEbPIdowTRrRn9YYwkXc3j+B+XpTb4oF4= +github.com/newrelic/newrelic-client-go/v2 v2.51.3 h1:Bu/cUs6nfMjQMPBcxxHt4Xm30tKDT7ttYy/XRDsWP6Y= +github.com/newrelic/newrelic-client-go/v2 v2.51.3/go.mod h1:+RRjI3nDGWT3kLm9Oi3QxpBm70uu8q1upEHBVWCZFpo= +github.com/newrelic/newrelic-client-go/v2 v2.51.4-0.20241111153946-a221c9e3bd63 h1:r2s0IZ9RuyIopiMZAkx5FgXttYzE3Rv6L34RVxwpgKg= +github.com/newrelic/newrelic-client-go/v2 v2.51.4-0.20241111153946-a221c9e3bd63/go.mod h1:+RRjI3nDGWT3kLm9Oi3QxpBm70uu8q1upEHBVWCZFpo= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/internal/install/execution/install_status.go b/internal/install/execution/install_status.go index 37f2a9ff1..eb0ffe69d 100644 --- a/internal/install/execution/install_status.go +++ b/internal/install/execution/install_status.go @@ -86,9 +86,10 @@ var RecipeStatusTypes = struct { } type StatusError struct { - Message string `json:"message"` - Details string `json:"details"` - TaskPath []string `json:"taskPath"` + Message string `json:"message"` + Details string `json:"details"` + TaskPath []string `json:"taskPath"` + OptimizedMessage string `json:"optimizedMessage"` } var StatusIconMap = map[RecipeStatusType]string{ @@ -379,8 +380,9 @@ func (s *InstallStatus) withRecipeEvent(e RecipeStatusEvent, rs RecipeStatusType s.withSuccessLinkConfig(e.Recipe.SuccessLinkConfig) statusError := StatusError{ - Message: e.Msg, - TaskPath: e.TaskPath, + Message: e.Msg, + TaskPath: e.TaskPath, + OptimizedMessage: e.OptimizedMessage, } s.Error = statusError diff --git a/internal/install/execution/install_status_test.go b/internal/install/execution/install_status_test.go index bc81b6cb7..e2a661d96 100644 --- a/internal/install/execution/install_status_test.go +++ b/internal/install/execution/install_status_test.go @@ -37,8 +37,9 @@ func TestStatusWithRecipeEvent_ErrorMessages(t *testing.T) { s := NewInstallStatus(types.InstallerContext{}, []StatusSubscriber{}, slg) r := types.OpenInstallationRecipe{Name: "testRecipe"} e := RecipeStatusEvent{ - Recipe: r, - Msg: "thing failed for a reason", + Recipe: r, + Msg: "thing failed for a reason", + OptimizedMessage: "clean error message", } s.Timestamp = 0 @@ -50,6 +51,7 @@ func TestStatusWithRecipeEvent_ErrorMessages(t *testing.T) { require.NotEmpty(t, s.Timestamp) require.Equal(t, s.Statuses[0].Error, s.Error) require.Equal(t, e.Msg, s.Error.Message) + require.Equal(t, e.OptimizedMessage, s.Error.OptimizedMessage) } func TestExecutionStatusWithRecipeEvent_RecipeExists(t *testing.T) { diff --git a/internal/install/execution/installevents_reporter.go b/internal/install/execution/installevents_reporter.go index 45dbd8e25..4921d9feb 100644 --- a/internal/install/execution/installevents_reporter.go +++ b/internal/install/execution/installevents_reporter.go @@ -103,8 +103,9 @@ func (r InstallEventsReporter) createMultipleRecipeInstallEvents(status *Install CliVersion: status.CLIVersion, Complete: status.Complete, Error: installevents.InstallationStatusErrorInput{ - Details: ss.Error.Details, - Message: ss.Error.Message, + Details: ss.Error.Details, + Message: ss.Error.Message, + OptimizedMessage: ss.Error.OptimizedMessage, }, Status: installevents.InstallationRecipeStatusType(ss.Status), Name: ss.Name, @@ -161,8 +162,9 @@ func buildInstallStatus(state installevents.InstallationInstallStateType, status CliVersion: status.CLIVersion, DeployedBy: status.DeployedBy, Error: installevents.InstallationStatusErrorInput{ - Details: status.Error.Details, - Message: status.Error.Message, + Details: status.Error.Details, + Message: status.Error.Message, + OptimizedMessage: status.Error.OptimizedMessage, }, HostName: status.DiscoveryManifest.Hostname, KernelArch: status.DiscoveryManifest.KernelArch, @@ -192,8 +194,9 @@ func buildRecipeStatus(status *InstallStatus, event *RecipeStatusEvent, statusTy CliVersion: status.CLIVersion, Complete: status.Complete, Error: installevents.InstallationStatusErrorInput{ - Details: status.Error.Details, - Message: status.Error.Message, + Details: status.Error.Details, + Message: status.Error.Message, + OptimizedMessage: status.Error.OptimizedMessage, }, HostName: status.DiscoveryManifest.Hostname, KernelArch: status.DiscoveryManifest.KernelArch, diff --git a/internal/install/execution/status_subscriber.go b/internal/install/execution/status_subscriber.go index 5b3668ecf..60d157448 100644 --- a/internal/install/execution/status_subscriber.go +++ b/internal/install/execution/status_subscriber.go @@ -29,6 +29,7 @@ type RecipeStatusEvent struct { EntityGUID string ValidationDurationMs int64 Metadata map[string]string + OptimizedMessage string } func NewRecipeStatusEvent(recipe *types.OpenInstallationRecipe) RecipeStatusEvent { diff --git a/internal/install/recipe_installer.go b/internal/install/recipe_installer.go index 49644b21d..dd351b4ec 100644 --- a/internal/install/recipe_installer.go +++ b/internal/install/recipe_installer.go @@ -594,9 +594,10 @@ func (i *RecipeInstall) executeAndValidate(ctx context.Context, m *types.Discove if e, ok := err.(*types.UnsupportedOperatingSystemError); ok { i.status.RecipeUnsupported(execution.RecipeStatusEvent{ - Recipe: *r, - Msg: e.Error(), - Metadata: i.recipeExecutor.GetOutput().Metadata(), + Recipe: *r, + Msg: e.Error(), + Metadata: i.recipeExecutor.GetOutput().Metadata(), + OptimizedMessage: e.Error(), }) return "", err @@ -610,9 +611,10 @@ func (i *RecipeInstall) executeAndValidate(ctx context.Context, m *types.Discove i.askToReRunInDebugMode() se := execution.RecipeStatusEvent{ - Recipe: *r, - Msg: msg, - Metadata: i.recipeExecutor.GetOutput().Metadata(), + Recipe: *r, + Msg: msg, + Metadata: i.recipeExecutor.GetOutput().Metadata(), + OptimizedMessage: err.Error(), } if e, ok := err.(types.GoTaskError); ok { @@ -666,6 +668,7 @@ func (i *RecipeInstall) executeAndValidate(ctx context.Context, m *types.Discove Msg: validationErr.Error(), ValidationDurationMs: validationDurationMs, Metadata: i.recipeExecutor.GetOutput().Metadata(), + OptimizedMessage: err.Error(), }) return "", validationErr @@ -785,7 +788,7 @@ func (i *RecipeInstall) validateRecipeViaAllMethods(ctx context.Context, r *type return "", fmt.Errorf("no validation was successful. most recent validation error: %w", err) } case <-timeoutCtx.Done(): - return "", fmt.Errorf("timed out waiting for validation to succeed") + return "", fmt.Errorf("installation validation timed out after %v. please retry the process\n", validationTimeout) } } } diff --git a/tools/go.mod b/tools/go.mod index e4df32b9a..c8ae2aeb4 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,6 +1,8 @@ module github.com/newrelic/newrelic-cli/tools -go 1.21 +go 1.22 + +toolchain go1.22.9 require ( github.com/caarlos0/svu v1.9.0