Update reva and use ocis-pkg version string in capabilities

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)
This commit is contained in:
Benedikt Kulmann
2022-01-04 12:35:35 +01:00
committed by Michael Barz
parent bae3834861
commit 4ce35acf01
3 changed files with 22 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
Enhancement: Product field in OCS version
We've added a new field to the OCS Version, which is supposed to announce the product name. The web ui as a client will make use of it to make the backend product and version available (e.g. for easier bug reports).
https://github.com/owncloud/ocis/pull/2918

View File

@@ -4,11 +4,17 @@ import (
"path"
"strconv"
"github.com/Masterminds/semver"
"github.com/owncloud/ocis/v2/extensions/frontend/pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
)
// FrontendConfigFromStruct will adapt an oCIS config struct into a reva mapstructure to start a reva service.
func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
parsedVersion, err := semver.NewVersion(version.String)
if err != nil {
parsedVersion, _ = semver.NewVersion("0.0.0")
}
archivers := []map[string]interface{}{
{
"enabled": true,
@@ -138,10 +144,10 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
"installed": true,
"maintenance": false,
"needsDbUpgrade": false,
"version": "10.0.11.5",
"versionstring": "10.0.11",
"edition": "community",
"productname": "reva",
"version": version.String + ".0",
"versionstring": version.String,
"edition": "Community",
"productname": "oCIS",
"hostname": "",
},
"support_url_signing": true,
@@ -210,11 +216,12 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
},
},
"version": map[string]interface{}{
"edition": "reva",
"major": 10,
"minor": 0,
"micro": 11,
"string": "10.0.11",
"product": "oCIS",
"edition": "Community",
"major": parsedVersion.Major(),
"minor": parsedVersion.Minor(),
"micro": parsedVersion.Patch(),
"string": version.String,
},
},
},

2
go.mod
View File

@@ -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/blevesearch/bleve/v2 v2.3.2
github.com/blevesearch/bleve_index_api v1.0.1
@@ -89,7 +90,6 @@ require (
github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e // indirect
github.com/BurntSushi/toml v1.1.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