diff --git a/cliv2/cmd/cliv2/main.go b/cliv2/cmd/cliv2/main.go index 4cd83c5b5d..45c35a9df7 100644 --- a/cliv2/cmd/cliv2/main.go +++ b/cliv2/cmd/cliv2/main.go @@ -30,6 +30,8 @@ import ( "github.com/snyk/cli/cliv2/internal/cliv2" "github.com/snyk/cli/cliv2/internal/constants" + "github.com/snyk/go-application-framework/pkg/local_workflows/network_utils" + localworkflows "github.com/snyk/go-application-framework/pkg/local_workflows" "github.com/snyk/go-application-framework/pkg/local_workflows/content_type" "github.com/snyk/go-application-framework/pkg/local_workflows/json_schemas" @@ -78,6 +80,7 @@ const ( func main() { errorCode := MainWithErrorCode() + globalLogger.Printf("Exiting with %d", errorCode) os.Exit(errorCode) } @@ -495,10 +498,12 @@ func MainWithErrorCode() int { ua := networking.UserAgent(networking.UaWithConfig(globalConfiguration), networking.UaWithRuntimeInfo(rInfo), networking.UaWithOS(internalOS)) networkAccess := globalEngine.GetNetworkAccess() networkAccess.AddHeaderField("x-snyk-cli-version", cliv2.GetFullVersion()) + networkAccess.AddHeaderField("snyk-interaction-id", instrumentation.AssembleUrnFromUUID(interactionId)) networkAccess.AddHeaderField( "User-Agent", ua.String(), ) + network_utils.AddSnykRequestId(networkAccess) if debugEnabled { writeLogHeader(globalConfiguration, networkAccess) @@ -543,7 +548,7 @@ func MainWithErrorCode() int { displayError(err, globalEngine.GetUserInterface(), globalConfiguration) exitCode := cliv2.DeriveExitCode(err) - globalLogger.Printf("Exiting with %d (cause: %v)", exitCode, err) + globalLogger.Printf("Deriving Exit Code %d (cause: %v)", exitCode, err) targetId, targetIdError := instrumentation.GetTargetId(globalConfiguration.GetString(configuration.INPUT_DIRECTORY), instrumentation.AutoDetectedTargetId, instrumentation.WithConfiguredRepository(globalConfiguration)) if targetIdError != nil { diff --git a/cliv2/go.mod b/cliv2/go.mod index c01fe0a8a7..ab7199b371 100644 --- a/cliv2/go.mod +++ b/cliv2/go.mod @@ -17,7 +17,7 @@ require ( github.com/snyk/cli-extension-sbom v0.0.0-20240812130014-3f4e892f15ec github.com/snyk/container-cli v0.0.0-20240322120441-6d9b9482f9b1 github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb - github.com/snyk/go-application-framework v0.0.0-20240815125542-258df4f6c9a8 + github.com/snyk/go-application-framework v0.0.0-20240816082313-d6797668c3be github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65 github.com/snyk/snyk-iac-capture v0.6.5 github.com/snyk/snyk-ls v0.0.0-20240814110458-759bec2da65d diff --git a/cliv2/go.sum b/cliv2/go.sum index 4eb06ec831..10df96b493 100644 --- a/cliv2/go.sum +++ b/cliv2/go.sum @@ -744,8 +744,8 @@ github.com/snyk/container-cli v0.0.0-20240322120441-6d9b9482f9b1 h1:9RKY9NdX5DrJ github.com/snyk/container-cli v0.0.0-20240322120441-6d9b9482f9b1/go.mod h1:38w+dcAQp9eG3P5t2eNS9eG0reut10AeJjLv5lJ5lpM= github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb h1:w9tJhpTFxWqAhLeraGsMExDjGK9x5Dwj1NRFwb+t+QE= github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb/go.mod h1:Ytttq7Pw4vOCu9NtRQaOeDU2dhBYUyNBe6kX4+nIIQ4= -github.com/snyk/go-application-framework v0.0.0-20240815125542-258df4f6c9a8 h1:zZhMSaa0j2UpjjutSkXcmB5bm2QNk3v/NQWOtGoCfNY= -github.com/snyk/go-application-framework v0.0.0-20240815125542-258df4f6c9a8/go.mod h1:zgYTVG71nX7zTb3ELeRlnwE/uKQxeOyQmAHtg6bC4uU= +github.com/snyk/go-application-framework v0.0.0-20240816082313-d6797668c3be h1:iEcoKC6UeEyLwvu5o2mwCGX1ExQrN+lIbb/r5UGFYdo= +github.com/snyk/go-application-framework v0.0.0-20240816082313-d6797668c3be/go.mod h1:zgYTVG71nX7zTb3ELeRlnwE/uKQxeOyQmAHtg6bC4uU= github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65 h1:CEQuYv0Go6MEyRCD3YjLYM2u3Oxkx8GpCpFBd4rUTUk= github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65/go.mod h1:88KbbvGYlmLgee4OcQ19yr0bNpXpOr2kciOthaSzCAg= github.com/snyk/policy-engine v0.30.11 h1:wUy5LMar2vccMbNM62MSBRdjAQAhAbIm7aNXXO+g2tk=