From d5d6d7c3a441c778a01a4526d6de78af82f69c51 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Fri, 21 Jun 2024 17:12:09 +0530 Subject: [PATCH 1/7] add utility to increment semver version of design Signed-off-by: MUzairS15 --- cmd/syncmodutil/internal/modsync/sync.go | 10 +++- models/pattern/error.go | 12 ++++ models/pattern/pattern.go | 72 ++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 models/pattern/error.go create mode 100644 models/pattern/pattern.go diff --git a/cmd/syncmodutil/internal/modsync/sync.go b/cmd/syncmodutil/internal/modsync/sync.go index ca6cab35..62e950fb 100644 --- a/cmd/syncmodutil/internal/modsync/sync.go +++ b/cmd/syncmodutil/internal/modsync/sync.go @@ -132,10 +132,13 @@ func getReplacedVersionsFromString(s string) (p [][]Package) { data = strings.TrimSuffix(strings.TrimPrefix(data, "\n"), "\n") packages := strings.Split(data, "\n") for _, pkg := range packages { + fmt.Println("PKG ", pkg) pkg = strings.TrimSuffix(strings.TrimSuffix(strings.TrimPrefix(strings.TrimPrefix(pkg, "\t"), " "), " "), "\t") - p0 := getPackagesAndVersionsFromPackageVersions(pkg) - if len(p0) != 0 { - p = append(p, p0) + if pkg != "" { + p0 := getPackagesAndVersionsFromPackageVersions(pkg) + if len(p0) != 0 { + p = append(p, p0) + } } } } @@ -144,6 +147,7 @@ func getReplacedVersionsFromString(s string) (p [][]Package) { func getPackagesAndVersionsFromPackageVersions(pkg string) (p []Package) { s := strings.Split(pkg, "=>") if len(s) < 2 { + fmt.Println("pkg ", pkg) log.Fatal("invalid go mod") } pkg1, ver1 := getPackageAndVersionFromPackageVersion(s[0]) diff --git a/models/pattern/error.go b/models/pattern/error.go new file mode 100644 index 00000000..9077234b --- /dev/null +++ b/models/pattern/error.go @@ -0,0 +1,12 @@ +package pattern + +import "github.com/layer5io/meshkit/errors" + + +const ( + ErrInvalidVersionCode = "" +) + +func ErrInvalidVersion(err error) error { + return errors.New(ErrInvalidVersionCode, errors.Alert, []string{}, []string{err.Error()}, []string{}, []string{}) +} diff --git a/models/pattern/pattern.go b/models/pattern/pattern.go new file mode 100644 index 00000000..d0d3f11f --- /dev/null +++ b/models/pattern/pattern.go @@ -0,0 +1,72 @@ +package pattern + +import ( + "github.com/Masterminds/semver/v3" + "github.com/gofrs/uuid" + "github.com/layer5io/meshkit/utils" + "gopkg.in/yaml.v2" +) + +// Pattern is the golang representation of the Pattern +// config file model +type Pattern struct { + // Name is the human-readable, display-friendly descriptor of the pattern + Name string `yaml:"name,omitempty" json:"name,omitempty"` + Version string `yaml:"version,omitempty" json:"version,omitempty"` + //Vars will be used to configure the pattern when it is imported from other patterns. + Vars map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty"` + // PatternID is the moniker use to uniquely identify any given pattern + // Convention: SMP-###-v#.#.# + PatternID string `yaml:"patternID,omitempty" json:"patternID,omitempty"` + Services map[string]*Service `yaml:"services" json:"services"` +} + +// Service represents the services defined within the appfile +type Service struct { + // ID is the id of the service and is completely internal to + // Meshery Server and meshery providers + ID *uuid.UUID `yaml:"id,omitempty" json:"id,omitempty"` + // Name is the name of the service and is an optional parameter + // If given then this supercedes the name of the service inherited + // from the parent + Name string `yaml:"name,omitempty" json:"name,omitempty"` + Type string `yaml:"type,omitempty" json:"type,omitempty"` + APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"` + Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"` + Version string `yaml:"version,omitempty" json:"version,omitempty"` + Model string `yaml:"model,omitempty" json:"model,omitempty"` + IsAnnotation bool `yaml:"isAnnotation,omitempty" json:"isAnnotation,omitempty"` + Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"` + Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"` + // DependsOn correlates one or more objects as a required dependency of this service + // DependsOn is used to determine sequence of operations + DependsOn []string `yaml:"dependsOn,omitempty" json:"dependsOn,omitempty"` + + Settings map[string]interface{} `yaml:"settings,omitempty" json:"settings,omitempty"` + Traits map[string]interface{} `yaml:"traits,omitempty" json:"traits,omitempty"` +} + +func (p *Pattern) GetNextVersion() (string, error) { + version, err := semver.NewVersion(p.Version) + if err != nil { + return "", err + // return ErrInvalidVersion(err) // send meshkit error + } + + nextVersion := version.IncPatch().String() + return nextVersion, nil +} + +func (p *Pattern) AssignVersion() { + p.Version = semver.New(0, 0, 1, "", "").String() +} + +func GetPatternFormat(patternFile string) (*Pattern, error) { + pattern := Pattern{} + err := yaml.Unmarshal([]byte(patternFile), &pattern) + if err != nil { + err = utils.ErrDecodeYaml(err) + return nil, err + } + return &pattern, nil +} From a7df1f5b8af6bf025716fabc4c635393f5cd25c1 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Fri, 21 Jun 2024 17:59:53 +0530 Subject: [PATCH 2/7] update package name Signed-off-by: MUzairS15 --- models/{pattern => patterns}/error.go | 2 +- models/{pattern => patterns}/pattern.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename models/{pattern => patterns}/error.go (93%) rename models/{pattern => patterns}/pattern.go (99%) diff --git a/models/pattern/error.go b/models/patterns/error.go similarity index 93% rename from models/pattern/error.go rename to models/patterns/error.go index 9077234b..de7d3f24 100644 --- a/models/pattern/error.go +++ b/models/patterns/error.go @@ -1,4 +1,4 @@ -package pattern +package patterns import "github.com/layer5io/meshkit/errors" diff --git a/models/pattern/pattern.go b/models/patterns/pattern.go similarity index 99% rename from models/pattern/pattern.go rename to models/patterns/pattern.go index d0d3f11f..51782f15 100644 --- a/models/pattern/pattern.go +++ b/models/patterns/pattern.go @@ -1,4 +1,4 @@ -package pattern +package patterns import ( "github.com/Masterminds/semver/v3" From 58355e462de10f62c8e181e6ed169f140039f150 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Fri, 21 Jun 2024 18:09:57 +0530 Subject: [PATCH 3/7] remove uneeded changes Signed-off-by: MUzairS15 --- cmd/syncmodutil/internal/modsync/sync.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/syncmodutil/internal/modsync/sync.go b/cmd/syncmodutil/internal/modsync/sync.go index 62e950fb..ca6cab35 100644 --- a/cmd/syncmodutil/internal/modsync/sync.go +++ b/cmd/syncmodutil/internal/modsync/sync.go @@ -132,13 +132,10 @@ func getReplacedVersionsFromString(s string) (p [][]Package) { data = strings.TrimSuffix(strings.TrimPrefix(data, "\n"), "\n") packages := strings.Split(data, "\n") for _, pkg := range packages { - fmt.Println("PKG ", pkg) pkg = strings.TrimSuffix(strings.TrimSuffix(strings.TrimPrefix(strings.TrimPrefix(pkg, "\t"), " "), " "), "\t") - if pkg != "" { - p0 := getPackagesAndVersionsFromPackageVersions(pkg) - if len(p0) != 0 { - p = append(p, p0) - } + p0 := getPackagesAndVersionsFromPackageVersions(pkg) + if len(p0) != 0 { + p = append(p, p0) } } } @@ -147,7 +144,6 @@ func getReplacedVersionsFromString(s string) (p [][]Package) { func getPackagesAndVersionsFromPackageVersions(pkg string) (p []Package) { s := strings.Split(pkg, "=>") if len(s) < 2 { - fmt.Println("pkg ", pkg) log.Fatal("invalid go mod") } pkg1, ver1 := getPackageAndVersionFromPackageVersion(s[0]) From b3eba2a5d46981fcfb701e85860b0faedd4d78b1 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Sat, 22 Jun 2024 19:25:21 +0530 Subject: [PATCH 4/7] refer constructs from schemas repo Signed-off-by: MUzairS15 --- go.mod | 10 ++++---- go.sum | 12 ++++++---- models/patterns/pattern.go | 49 ++++---------------------------------- 3 files changed, 19 insertions(+), 52 deletions(-) diff --git a/go.mod b/go.mod index 607a551c..5bfb0e4c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/layer5io/meshkit -go 1.21 +go 1.21.10 replace ( github.com/Sirupsen/logrus => github.com/sirupsen/logrus v1.9.3 @@ -14,15 +14,17 @@ replace ( require ( cuelang.org/go v0.6.0 + github.com/Masterminds/semver/v3 v3.2.1 github.com/fluxcd/pkg/oci v0.34.0 github.com/fluxcd/pkg/tar v0.4.0 github.com/go-git/go-git/v5 v5.11.0 github.com/go-logr/logr v1.3.0 github.com/gofrs/uuid v4.4.0+incompatible github.com/google/go-containerregistry v0.17.0 - github.com/google/uuid v1.4.0 + github.com/google/uuid v1.5.0 github.com/kubernetes/kompose v1.31.1 github.com/layer5io/meshery-operator v0.7.0 + github.com/meshery/schemas v0.7.5 github.com/nats-io/nats.go v1.31.0 github.com/open-policy-agent/opa v0.57.1 github.com/opencontainers/image-spec v1.1.0-rc6 @@ -60,7 +62,6 @@ require ( github.com/BurntSushi/toml v1.3.2 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Masterminds/squirrel v1.5.4 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect @@ -168,7 +169,7 @@ require ( github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/mattn/go-sqlite3 v1.14.17 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect @@ -191,6 +192,7 @@ require ( github.com/nats-io/nkeys v0.4.6 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/novln/docker-parser v1.0.0 // indirect + github.com/oapi-codegen/runtime v1.1.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/runc v1.1.12 // indirect github.com/openshift/api v0.0.0-20200803131051-87466835fcc0 // indirect diff --git a/go.sum b/go.sum index 799d3d66..a073db56 100644 --- a/go.sum +++ b/go.sum @@ -432,8 +432,8 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaU github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -595,8 +595,8 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= @@ -607,6 +607,8 @@ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvls github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/meshery/kompose v1.0.1 h1:lg8B/pkLh6762jeFsQATD8UJZZwXZf/aviC3/dzw78A= github.com/meshery/kompose v1.0.1/go.mod h1:TWhWTEMbJBUzENf4JTEtBmZRFm/r8n0nS6v4/nSD2vA= +github.com/meshery/schemas v0.7.5 h1:4eBQt8xbrukIFueahj5l5bfDynTa1TskCdoccKgKSeM= +github.com/meshery/schemas v0.7.5/go.mod h1:kD9FSkFCccGz/j2OJNabef82sOM+IMZI9OZcAxOzhjE= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= @@ -672,6 +674,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/novln/docker-parser v1.0.0 h1:PjEBd9QnKixcWczNGyEdfUrP6GR0YUilAqG7Wksg3uc= github.com/novln/docker-parser v1.0.0/go.mod h1:oCeM32fsoUwkwByB5wVjsrsVQySzPWkl3JdlTn1txpE= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= +github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/models/patterns/pattern.go b/models/patterns/pattern.go index 51782f15..db9f9274 100644 --- a/models/patterns/pattern.go +++ b/models/patterns/pattern.go @@ -2,51 +2,12 @@ package patterns import ( "github.com/Masterminds/semver/v3" - "github.com/gofrs/uuid" "github.com/layer5io/meshkit/utils" + "github.com/meshery/schemas/models/patterns" "gopkg.in/yaml.v2" ) -// Pattern is the golang representation of the Pattern -// config file model -type Pattern struct { - // Name is the human-readable, display-friendly descriptor of the pattern - Name string `yaml:"name,omitempty" json:"name,omitempty"` - Version string `yaml:"version,omitempty" json:"version,omitempty"` - //Vars will be used to configure the pattern when it is imported from other patterns. - Vars map[string]interface{} `yaml:"vars,omitempty" json:"vars,omitempty"` - // PatternID is the moniker use to uniquely identify any given pattern - // Convention: SMP-###-v#.#.# - PatternID string `yaml:"patternID,omitempty" json:"patternID,omitempty"` - Services map[string]*Service `yaml:"services" json:"services"` -} - -// Service represents the services defined within the appfile -type Service struct { - // ID is the id of the service and is completely internal to - // Meshery Server and meshery providers - ID *uuid.UUID `yaml:"id,omitempty" json:"id,omitempty"` - // Name is the name of the service and is an optional parameter - // If given then this supercedes the name of the service inherited - // from the parent - Name string `yaml:"name,omitempty" json:"name,omitempty"` - Type string `yaml:"type,omitempty" json:"type,omitempty"` - APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"` - Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"` - Version string `yaml:"version,omitempty" json:"version,omitempty"` - Model string `yaml:"model,omitempty" json:"model,omitempty"` - IsAnnotation bool `yaml:"isAnnotation,omitempty" json:"isAnnotation,omitempty"` - Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"` - Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"` - // DependsOn correlates one or more objects as a required dependency of this service - // DependsOn is used to determine sequence of operations - DependsOn []string `yaml:"dependsOn,omitempty" json:"dependsOn,omitempty"` - - Settings map[string]interface{} `yaml:"settings,omitempty" json:"settings,omitempty"` - Traits map[string]interface{} `yaml:"traits,omitempty" json:"traits,omitempty"` -} - -func (p *Pattern) GetNextVersion() (string, error) { +func GetNextVersion(p *patterns.PatternFile) (string, error) { version, err := semver.NewVersion(p.Version) if err != nil { return "", err @@ -57,12 +18,12 @@ func (p *Pattern) GetNextVersion() (string, error) { return nextVersion, nil } -func (p *Pattern) AssignVersion() { +func AssignVersion(p *patterns.PatternFile) { p.Version = semver.New(0, 0, 1, "", "").String() } -func GetPatternFormat(patternFile string) (*Pattern, error) { - pattern := Pattern{} +func GetPatternFormat(patternFile string) (*patterns.PatternFile, error) { + pattern := patterns.PatternFile{} err := yaml.Unmarshal([]byte(patternFile), &pattern) if err != nil { err = utils.ErrDecodeYaml(err) From 3e61627163a8652b19d5ff5c23edec97aed80ae3 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Sat, 22 Jun 2024 20:02:20 +0530 Subject: [PATCH 5/7] handle case for exisiting patterns Signed-off-by: MUzairS15 --- models/patterns/pattern.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/models/patterns/pattern.go b/models/patterns/pattern.go index db9f9274..e3f5a5bc 100644 --- a/models/patterns/pattern.go +++ b/models/patterns/pattern.go @@ -8,6 +8,12 @@ import ( ) func GetNextVersion(p *patterns.PatternFile) (string, error) { + // Existing patterns do not have version hence when trying to assign next version for such patterns, it will fail the validation. + // Hence, if version is not present, start versioning for those afresh. + if p.Version == "" { + AssignVersion(p) + return p.Version, nil + } version, err := semver.NewVersion(p.Version) if err != nil { return "", err From c6cdad87e13c9cb8ce639b316193184465de42c5 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Sat, 22 Jun 2024 20:57:30 +0530 Subject: [PATCH 6/7] bump schemas version to 0.7.6 Signed-off-by: MUzairS15 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5bfb0e4c..d0f0aaf5 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/google/uuid v1.5.0 github.com/kubernetes/kompose v1.31.1 github.com/layer5io/meshery-operator v0.7.0 - github.com/meshery/schemas v0.7.5 + github.com/meshery/schemas v0.7.6 github.com/nats-io/nats.go v1.31.0 github.com/open-policy-agent/opa v0.57.1 github.com/opencontainers/image-spec v1.1.0-rc6 diff --git a/go.sum b/go.sum index a073db56..d432fed6 100644 --- a/go.sum +++ b/go.sum @@ -607,8 +607,8 @@ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvls github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/meshery/kompose v1.0.1 h1:lg8B/pkLh6762jeFsQATD8UJZZwXZf/aviC3/dzw78A= github.com/meshery/kompose v1.0.1/go.mod h1:TWhWTEMbJBUzENf4JTEtBmZRFm/r8n0nS6v4/nSD2vA= -github.com/meshery/schemas v0.7.5 h1:4eBQt8xbrukIFueahj5l5bfDynTa1TskCdoccKgKSeM= -github.com/meshery/schemas v0.7.5/go.mod h1:kD9FSkFCccGz/j2OJNabef82sOM+IMZI9OZcAxOzhjE= +github.com/meshery/schemas v0.7.6 h1:BOV5+LN0hjNWNqpFhuczaHpzerZQihjMv3uM5bx1ReE= +github.com/meshery/schemas v0.7.6/go.mod h1:ZsfoE5HvlqJvUvBlqS2rHoNQoDJ+eYuly5w5m+qIQSM= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= From e183bc33988050d65f234cd14eff4fcecdc0490c Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Sat, 22 Jun 2024 21:02:14 +0530 Subject: [PATCH 7/7] add probable cause and suggested remediation Signed-off-by: MUzairS15 --- models/patterns/error.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/patterns/error.go b/models/patterns/error.go index de7d3f24..ad37aad6 100644 --- a/models/patterns/error.go +++ b/models/patterns/error.go @@ -2,11 +2,10 @@ package patterns import "github.com/layer5io/meshkit/errors" - const ( ErrInvalidVersionCode = "" ) func ErrInvalidVersion(err error) error { - return errors.New(ErrInvalidVersionCode, errors.Alert, []string{}, []string{err.Error()}, []string{}, []string{}) + return errors.New(ErrInvalidVersionCode, errors.Alert, []string{"invalid/incompatible semver version"}, []string{err.Error()}, []string{"version history for the content has been tampered outside meshery"}, []string{"rolllback to one of the previous version"}) }