Skip to content

Commit

Permalink
Update reva and use ocis-pkg version string in capabilities
Browse files Browse the repository at this point in the history
Needed to use github.com/Masterminds/semver/v3 instead of v1 to be able
to extract major, minor and patch version from a version string.
Falling back to 0.0.0 in any error case (e.g. if the version.String is a
hash)
  • Loading branch information
kulmann authored and wkloucek committed Feb 21, 2022
1 parent 69fcee0 commit d1d01d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.17
require (
github.com/CiscoM31/godata v1.0.5
github.com/GeertJohan/yubigo v0.0.0-20190917122436-175bc097e60e
github.com/Masterminds/semver v1.5.0
github.com/ReneKroon/ttlcache/v2 v2.11.0
github.com/asim/go-micro/plugins/client/grpc/v4 v4.0.0-20220118152736-9e0be6c85d75
github.com/asim/go-micro/plugins/logger/zerolog/v4 v4.0.0-20220118152736-9e0be6c85d75
Expand Down Expand Up @@ -83,7 +84,6 @@ require (
github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e // indirect
github.com/BurntSushi/toml v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20211112122917-428f8eabeeb3 // indirect
Expand Down
15 changes: 11 additions & 4 deletions storage/pkg/command/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import (
"strconv"
"strings"

"github.com/Masterminds/semver"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/oklog/run"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/conversions"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/server/debug"
"github.com/owncloud/ocis/storage/pkg/tracing"
Expand Down Expand Up @@ -140,6 +142,11 @@ func Frontend(cfg *config.Config) *cli.Command {

// frontendConfigFromStruct will adapt an oCIS config struct into a reva mapstructure to start a reva service.
func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[string]interface{}) map[string]interface{} {
parsedVersion, err := semver.NewVersion(version.String)
if err != nil {
parsedVersion, _ = semver.NewVersion("0.0.0")
}

return map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.Users.MaxCPUs,
Expand Down Expand Up @@ -300,10 +307,10 @@ func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[s
"version": map[string]interface{}{
"product": "oCIS",
"edition": "Community",
"major": 1,
"minor": 16,
"micro": 0,
"string": "1.16.0",
"major": parsedVersion.Major(),
"minor": parsedVersion.Minor(),
"micro": parsedVersion.Patch(),
"string": version.String,
},
},
},
Expand Down

0 comments on commit d1d01d0

Please sign in to comment.