Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix version for legacy clients #3805

Merged
merged 4 commits into from
May 23, 2022
Merged

fix version for legacy clients #3805

merged 4 commits into from
May 23, 2022

Conversation

micbar
Copy link
Contributor

@micbar micbar commented May 16, 2022

Description

Bugfix: Fix version number in status page

We needed to undo the version number changes on the status page to keep compatibility for legacy clients. We added a new field productversion for the actual version of the product.

Related Issue

New Status values

https://localhost:9200/status.php and https://localhost:9200/status/

{
    "installed": true,
    "maintenance": false,
    "needsDbUpgrade": false,
    "version": "10.11.0.0",
    "versionstring": "10.11.0",
    "edition": "Community",
    "productname": "Infinite Scale",
    "product": "Infinite Scale",
    "productversion": "2.0.0-beta1+dev"
}

Capabilities

{
    "capabilities": {
        "core": {
            "pollinterval": 60,
            "webdav-root": "remote.php/webdav",
            "status": {
                "installed": true,
                "maintenance": false,
                "needsDbUpgrade": false,
                "version": "10.11.0.0",
                "versionstring": "10.11.0",
                "edition": "Community",
                "productname": "Infinite Scale",
                "product": "Infinite Scale",
                "productversion": "2.0.0-beta1+dev"
            },
            "support-url-signing": true
        },
        "checksums": {
            "supportedTypes": [
                "sha1",
                "md5",
                "adler32"
            ],
            "preferredUploadType": "SHA1"
        },
        "files": {
            "privateLinks": false,
            "bigfilechunking": false,
            "undelete": true,
            "versioning": true,
            "favorites": false,
            "blacklisted_files": [],
            "tus_support": {
                "version": "1.0.0",
                "resumable": "1.0.0",
                "extension": "creation,creation-with-upload",
                "max_chunk_size": 100000000,
                "http_method_override": ""
            },
            "archivers": [
                {
                    "enabled": true,
                    "version": "2.0.0",
                    "formats": [
                        "tar",
                        "zip"
                    ],
                    "archiver_url": "/archiver",
                    "max_num_files": "10000",
                    "max_size": "1073741824"
                }
            ],
            "app_providers": [
                {
                    "enabled": true,
                    "version": "1.0.0",
                    "apps_url": "/app/list",
                    "open_url": "/app/open",
                    "new_url": "/app/new"
                }
            ]
        },
        "dav": {
            "chunking": "",
            "trashbin": "1.0",
            "reports": [
                "search-files"
            ],
            "chunkingParallelUploadDisabled": false
        },
        "files_sharing": {
            "api_enabled": true,
            "resharing": false,
            "group_sharing": true,
            "auto_accept_share": true,
            "share_with_group_members_only": true,
            "share_with_membership_groups_only": true,
            "search_min_length": 3,
            "default_permissions": 22,
            "user_enumeration": {
                "enabled": true,
                "group_members_only": true
            },
            "federation": {
                "outgoing": true,
                "incoming": true
            },
            "public": {
                "enabled": true,
                "send_mail": true,
                "social_share": true,
                "upload": true,
                "multiple": true,
                "supports_upload_only": true,
                "password": {
                    "enforced_for": {
                        "read_only": false,
                        "read_write": false,
                        "upload_only": false
                    },
                    "enforced": false
                },
                "expire_date": {
                    "enabled": true
                },
                "can_edit": true
            },
            "user": {
                "send_mail": true,
                "profile_picture": false,
                "settings": [
                    {
                        "enabled": true,
                        "version": "1.0.0"
                    }
                ]
            }
        },
        "spaces": {
            "version": "0.0.1",
            "enabled": true,
            "projects": true,
            "share_jail": true
        }
    },
    "version": {
        "major": 10,
        "minor": 11,
        "micro": 0,
        "string": "10.11.0",
        "edition": "Community",
        "product": "Infinite Scale"
    }
}

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@micbar micbar requested review from kobergj and dragotin May 16, 2022 11:44
@micbar micbar marked this pull request as draft May 16, 2022 11:44
@ownclouders
Copy link
Contributor

ownclouders commented May 16, 2022

💥 Acceptance test Core-API-Tests-ocis-storage-1 failed. Further test are cancelled...

@phil-davis
Copy link
Contributor

@micbar can we merge #3807 ?

Then you will have core API tests that work like in reva,and the status.php test should pass for this.

@phil-davis
Copy link
Contributor

https://drone.owncloud.com/owncloud/ocis/11885/39/7

    And the major-minor-micro version data in the response should match the version string # CapabilitiesContext::checkVersionMajorMinorMicroResponse()
      CapabilitiesContext::checkVersionMajorMinorMicroResponse'major' data item does not match with major version in string '10.11.0'
      Failed asserting that two strings are identical.
      --- Expected
      +++ Actual
      @@ @@
      -'10'
      +'0'

IMO the string correctly now has "10.11.0" but the fields major-minor-micro have other values - it looks like "major" is set to 0.

@micbar micbar requested a review from phil-davis May 19, 2022 06:10
@micbar micbar marked this pull request as ready for review May 19, 2022 06:10
@dragotin
Copy link
Contributor

Looking at the example json doc on the top of this page, I am not completely happy tbh. Why is productversion still 0.0.0+dev? The agreement is that new clients only look on productversion, and it should contain the real version, for example for oCIS 2.0.0+dev or 2.0.1 once it is released.

If the productversion is not existing (oC10 Installations) or legacy clients use the version field as they did before. There we have the oC10 version as it always has been, or for oCIS a fixed version that is high enough (10.11.0.0) and never again changes in oCIS.

That is my understanding.

So my request for change here is only to always put a useful version into productversion.

Copy link
Contributor

@dragotin dragotin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment in Conversation

@phil-davis
Copy link
Contributor

With the current code here, I get:

$ curl -k -u admin:admin https://localhost:9200/status.php
{
    "installed": true,
    "maintenance": false,
    "needsDbUpgrade": false,
    "version": "10.11.0.0",
    "versionstring": "10.11.0",
    "edition": "Community",
    "productname": "Infinite Scale",
    "product": "Infinite Scale",
    "productversion": "0.0.0+0d876ce3e"
}

I too was thinking that we would immediately set productversion to a real value like "2.0.0-beta1"

@micbar
Copy link
Contributor Author

micbar commented May 19, 2022

@phil-davis @dragotin Seems that there is a big misunderstanding here. We create the real version only during the compiling of ocis.

  1. On a tag: 2.0.0-beta1
  2. On a go build on master 0.0.0+commitID
  3. On a dev build via go run or via the debugger 0.0.0+dev

2 and 3 have no real version because they are just checked out "somewhere in the wild" The commitID is sufficient for 2) because it really identifies the exact version. There is no point in adding a "invented" semver version.

@phil-davis
Copy link
Contributor

OK, I will let others discuss this. I am old-fashioned and used to oC10, which returns an "up to date" version value in core master when I query the status.php endpoint as a local developer. After a release like core 10.9.1, we update that version "constant" in core master to 10.9.2-alpha (the minimal patch bump that must at least happen as the next release), and update it again in a next release branch if it turns out that we need a minor version bump to 10.10.0. The master (and a local development branch that is up-to-date with master) displays the "current estimate" of what the next release version would be.

@dragotin
Copy link
Contributor

Hmm, all development builds "base" on a previous stable version. And that could/should be used IMHO. Otherwise we will have to implement a special handling of 0.0.0 again in the clients, which will be error prone again.

@micbar
Copy link
Contributor Author

micbar commented May 19, 2022

Hmm, all development builds "base" on a previous stable version. And that could/should be used IMHO. Otherwise we will have to implement a special handling of 0.0.0 again in the clients, which will be error prone again.

Ok, that would mean we need to maintain a version in the code which needs to be touched on every release, that makes me unhappy 😄

@micbar
Copy link
Contributor Author

micbar commented May 19, 2022

Hmm, all development builds "base" on a previous stable version. And that could/should be used IMHO. Otherwise we will have to implement a special handling of 0.0.0 again in the clients, which will be error prone again.

I think the clients should not do anything based on the productversion we should not introduce the only bad design for the new version. IMO the version should have no meaning for the clients.

@phil-davis
Copy link
Contributor

Hmm, all development builds "base" on a previous stable version. And that could/should be used IMHO. Otherwise we will have to implement a special handling of 0.0.0 again in the clients, which will be error prone again.

yes, if I am locally testing a development branch, I build and run my local oCIS, then start a client to manually check that it talks OK, then it would be good if productversion has something close to what a real future release will have.

@micbar
Copy link
Contributor Author

micbar commented May 19, 2022

Hmm, all development builds "base" on a previous stable version. And that could/should be used IMHO. Otherwise we will have to implement a special handling of 0.0.0 again in the clients, which will be error prone again.

yes, if I am locally testing a development branch, I build and run my local oCIS, then start a client to manually check that it talks OK, then it would be good if productversion has something close to what a real future release will have.

Hmm, that requires manually maintaining product versions in the code, not good IMO

@phil-davis
Copy link
Contributor

I think the clients should not do anything based on the productversion we should not introduce the only bad design for the new version. IMO the version should have no meaning for the clients.

True - clients should only use it as an opaque string for reporting convenience. They can show the string somewhere to the user if they want to inform the user about the product+productversion of the server that client is connected to. Or put it in log files entries so that support people can know exactly what server the client was connected to at the time.

Clients should never attempt to parse the string, and never attempt to "decide what to do" based on anything in the string.

@dragotin
Copy link
Contributor

Yes, it would be awesome if clients would not have to put semantics on the version from status.php. Unfortunately, that has turned out to be not realistic in the past. All the conditions we had in the Desktop Client based on the version were there for a reason: Because we changed the API, some API data interpretation and such. I do not think that this can not happen again in the future. Thus, we just need a parseable version of the server.

@butonic
Copy link
Member

butonic commented May 19, 2022

hm, how does go mod build versions for commit ids? it seems to pick the latest release, adds a minor and then the date and commit id: in go.mod github.com/cs3org/reva/v2 fc42c1a84d5a becomes github.com/cs3org/reva/v2 v2.3.2-0.20220518201235-fc42c1a84d5a when running go mod tidy.

how does it calculate the pseudo version number? https://stackoverflow.com/a/59440771 and https://www.golang.ir/ref/mod#versions

we can use git like so:

ocis (master ✗) $ git describe --tags
v2.0.0-beta1-170-g47b69049e

@micbar
Copy link
Contributor Author

micbar commented May 19, 2022

After a long discussion with @dragotin and @wkloucek I see the need to store the latest released version in the version.go.

I will update the PR in the evening.

@phil-davis
Copy link
Contributor

"This branch is 3 commits ahead, 72 commits behind master."

Has conflicts anyway, so needs a rebase.

@micbar micbar requested a review from dragotin May 23, 2022 09:07
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@micbar micbar requested a review from butonic May 23, 2022 13:25
@kulmann
Copy link
Contributor

kulmann commented May 23, 2022

Why is the productversion not available as ocs.data.version.productversion? 🤔

@micbar
Copy link
Contributor Author

micbar commented May 23, 2022

Why is the productversion not available as ocs.data.version.productversion? 🤔

You mean, if we have it i two places, better have it in 3 places?

@micbar
Copy link
Contributor Author

micbar commented May 23, 2022

I don't know what the difference between ocs.data.version and ocs.data.core.status is and how it its used by the clients.

@kulmann
Copy link
Contributor

kulmann commented May 23, 2022

Why is the productversion not available as ocs.data.version.productversion? 🤔

You mean, if we have it i two places, better have it in 3 places?

For consistency, yes. I can switch over to the information in capabilities.core.status. But this is a major pain anyway, why not at least keep it consistent to provide the same information in all possible places?

@kulmann
Copy link
Contributor

kulmann commented May 23, 2022

Made owncloud/web#7045 to use information from ocs.data.capabilities.core.status instead of ocs.data.version. Also using the new productversion field with that PR, having versionstring as a fallback.

@micbar
Copy link
Contributor Author

micbar commented May 23, 2022

ok so we can merge this and tackle a productversion in ocs.data.version later because it needs a reva pull request.

.make/go.mk Show resolved Hide resolved
ocis-pkg/version/version.go Show resolved Hide resolved
@micbar micbar requested review from dragotin and kulmann May 23, 2022 15:38
@micbar micbar merged commit 894923f into master May 23, 2022
@delete-merged-branch delete-merged-branch bot deleted the fix-version branch May 23, 2022 15:39
ownclouders pushed a commit that referenced this pull request May 23, 2022
Merge: f01d064 efd6619
Author: Michael Barz <mbarz@owncloud.com>
Date:   Mon May 23 17:39:36 2022 +0200

    Merge pull request #3805 from owncloud/fix-version

    fix version for legacy clients
@kulmann kulmann mentioned this pull request May 25, 2022
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

status.php version not useful.
6 participants