diff --git a/go.mod b/go.mod index c86414f146..46fd341572 100644 --- a/go.mod +++ b/go.mod @@ -307,8 +307,8 @@ require ( replace ( github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13 - github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250502103233-29d5c52295e4 - github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250502103233-29d5c52295e4 + github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516100713-b51cbe6d1a99 + github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516100713-b51cbe6d1a99 github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127 github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5 k8s.io/api => k8s.io/api v0.29.7 diff --git a/go.sum b/go.sum index 167f1a16c0..4811bc12ab 100644 --- a/go.sum +++ b/go.sum @@ -829,10 +829,10 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpSN5Rp/8mfQORh8SmU= github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA= -github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250502103233-29d5c52295e4 h1:FZ3z1sbg2qyconeuDSJKsku56gTKtKsEeodagDIpQq8= -github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250502103233-29d5c52295e4/go.mod h1:FfaLDXN1ZXxyRpnskBqVIYkpkWDCzBmDgIO9xqLnxdQ= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250502103233-29d5c52295e4 h1:Y66AO2dPjzFC+AbEkaHP3jGV15x9X4ALfDVZ1SNs/e4= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250502103233-29d5c52295e4/go.mod h1:zkNShlkcHxsmnL0gKNbs0uyRL8lZonGKr5Km63uTLI0= +github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516100713-b51cbe6d1a99 h1:e45n1RXybYSzu3o7Z25avnTBae4kK50nauxa5I0oEsU= +github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516100713-b51cbe6d1a99/go.mod h1:FfaLDXN1ZXxyRpnskBqVIYkpkWDCzBmDgIO9xqLnxdQ= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516100713-b51cbe6d1a99 h1:MEfo6Cc9XakQTOcaDPxaVEC/tIUoqlFP1UniJ79iJ3M= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516100713-b51cbe6d1a99/go.mod h1:zkNShlkcHxsmnL0gKNbs0uyRL8lZonGKr5Km63uTLI0= github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU= github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y= github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e h1:U6UdYbW8a7xn5IzFPd8cywjVVPfutGJCudjePAfL/Hs= diff --git a/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go b/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go index 3bdec67be5..bc5dbeba10 100644 --- a/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go +++ b/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go @@ -85,31 +85,31 @@ func ExecutePGQueryProcessor(cfg bean.PgQueryMonitoringConfig, event bean.PgQuer } else { status = SUCCESS } - PgQueryDuration.WithLabelValues(status, cfg.ServiceName, event.FuncName, getErrorType(pgError).String()).Observe(queryDuration.Seconds()) + PgQueryDuration.WithLabelValues(status, cfg.ServiceName, getErrorType(pgError).String()).Observe(queryDuration.Seconds()) } // Log pg query if enabled logThresholdQueries := cfg.LogSlowQuery && queryDuration.Milliseconds() > cfg.QueryDurationThreshold logNetworkFailure := queryError && cfg.LogAllFailureQueries && isNetworkError(pgError) if logNetworkFailure { - log.Println(fmt.Sprintf("%s - query time", PgNetworkErrorLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query, "pgError", pgError) + log.Println(fmt.Sprintf("%s - query time", PgNetworkErrorLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query, "pgError", pgError) } logFailureQuery := queryError && cfg.LogAllFailureQueries && !isNetworkError(pgError) if logFailureQuery { - log.Println(fmt.Sprintf("%s - query time", PgQueryFailLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query, "pgError", pgError) + log.Println(fmt.Sprintf("%s - query time", PgQueryFailLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query, "pgError", pgError) } if logThresholdQueries { - log.Println(fmt.Sprintf("%s - query time", PgQuerySlowLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query) + log.Println(fmt.Sprintf("%s - query time", PgQuerySlowLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query) } if cfg.LogAllQuery { - log.Println("query time", "duration", queryDuration.Seconds(), "query", event.Query) + log.Println("query time", "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query) } } var PgQueryDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "pg_query_duration_seconds", Help: "Duration of PG queries", -}, []string{"status", "serviceName", "functionName", "errorType"}) +}, []string{"status", "serviceName", "errorType"}) func getErrorType(err error) ErrorType { if err == nil { diff --git a/vendor/github.com/devtron-labs/common-lib/utils/k8s/commonBean/bean.go b/vendor/github.com/devtron-labs/common-lib/utils/k8s/commonBean/bean.go index 621b39edfb..77dbb59d1b 100644 --- a/vendor/github.com/devtron-labs/common-lib/utils/k8s/commonBean/bean.go +++ b/vendor/github.com/devtron-labs/common-lib/utils/k8s/commonBean/bean.go @@ -24,6 +24,7 @@ import ( ) const ( + ConfigMapKind = "ConfigMap" SecretKind = "Secret" ServiceKind = "Service" ServiceAccountKind = "ServiceAccount" @@ -300,8 +301,8 @@ type PodMetadata struct { EphemeralContainers []*EphemeralContainerData `json:"ephemeralContainers"` } -// use value field as generic type // InfoItem contains arbitrary, human readable information about an application +// use value field as generic type type InfoItem struct { // Name is a human readable title for this piece of information. Name string `json:"name,omitempty"` diff --git a/vendor/github.com/devtron-labs/common-lib/workflow/bean.go b/vendor/github.com/devtron-labs/common-lib/workflow/bean.go index 3147762955..7f31dcfd45 100644 --- a/vendor/github.com/devtron-labs/common-lib/workflow/bean.go +++ b/vendor/github.com/devtron-labs/common-lib/workflow/bean.go @@ -1,7 +1,6 @@ package workflow import ( - "encoding/base64" "encoding/json" "fmt" "os" @@ -168,8 +167,8 @@ type VariableObject struct { ReferenceVariableName string `json:"referenceVariableName"` ReferenceVariableStepIndex int `json:"referenceVariableStepIndex"` VariableStepIndexInPlugin int `json:"variableStepIndexInPlugin"` - FileContent string `json:"fileContent"` // FileContent is the base64 encoded content of the file - TypedValue interface{} `json:"-"` // TypedValue is the formatted value of the variable after type conversion + FileReferencePath string `json:"fileReferencePath"` // FileContent is the base64 encoded content of the file + TypedValue interface{} `json:"-"` // TypedValue is the formatted value of the variable after type conversion } // TypeCheck converts the VariableObject.Value to the VariableObject.Format type @@ -188,19 +187,25 @@ func (v *VariableObject) TypeCheck() error { return nil } -// SetFileContent decodes the base64 encoded file content and writes it to the file at filePath +// SetFileContent sets the content of the file referenced by the VariableObject.FileReferencePath field. func (v *VariableObject) SetFileContent(filePath string) error { if v.Format != FormatTypeFile { return nil } + if len(v.FileReferencePath) == 0 { + // for plugins we may receive the filePath as "", + // even thought VariableObject.Value is there; + // for this case don't mount the file. + return nil + } file, fileErr := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.ModePerm) if fileErr != nil { return fileErr } defer file.Close() - fileBytes, fileErr := base64.StdEncoding.DecodeString(v.FileContent) - if fileErr != nil { - return fileErr + fileBytes, err := os.ReadFile(v.FileReferencePath) + if err != nil { + return err } _, wErr := file.Write(fileBytes) if wErr != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 8e203f751b..8b0ecc509d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -472,7 +472,7 @@ github.com/davecgh/go-spew/spew # github.com/deckarep/golang-set v1.8.0 ## explicit; go 1.17 github.com/deckarep/golang-set -# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250502103233-29d5c52295e4 +# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516100713-b51cbe6d1a99 ## explicit; go 1.21 github.com/devtron-labs/authenticator/apiToken github.com/devtron-labs/authenticator/client @@ -480,7 +480,7 @@ github.com/devtron-labs/authenticator/jwt github.com/devtron-labs/authenticator/middleware github.com/devtron-labs/authenticator/oidc github.com/devtron-labs/authenticator/password -# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250502103233-29d5c52295e4 +# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516100713-b51cbe6d1a99 ## explicit; go 1.21 github.com/devtron-labs/common-lib/async github.com/devtron-labs/common-lib/blob-storage @@ -2352,8 +2352,8 @@ xorm.io/xorm/log xorm.io/xorm/names xorm.io/xorm/schemas xorm.io/xorm/tags -# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250502103233-29d5c52295e4 -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250502103233-29d5c52295e4 +# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516100713-b51cbe6d1a99 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516100713-b51cbe6d1a99 # github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127 # github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5 # k8s.io/api => k8s.io/api v0.29.7