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

Skosmos version not showing in Docker install #1202

Closed
ArthurGenet opened this issue Sep 10, 2021 · 7 comments · Fixed by #1308
Closed

Skosmos version not showing in Docker install #1202

ArthurGenet opened this issue Sep 10, 2021 · 7 comments · Fixed by #1308
Assignees
Labels
Milestone

Comments

@ArthurGenet
Copy link

What steps will reproduce the problem?

  1. Run a Skosmos instance with the latest Docker install
  2. Go to "About"

What do you see?

Capture d’écran 2021-09-10 à 11 55 46

In the Dockerfile, it is written ARG SKOSMOS_VERSION=v.2.9

Is it the version used for the latest Docker install ?

@osma osma added the bug label Nov 4, 2021
@osma
Copy link
Member

osma commented Nov 4, 2021

Thanks for the report. The Skosmos version is currently extracted from Git version tags, but these are not available when running under Docker. There should be another way of determining the Skosmos version.

@kinow
Copy link
Collaborator

kinow commented Nov 5, 2021

Maybe we can include the version when building the image. Can't recall if there's an option to read the version from a static source, but if not it might require some little tweaking in the code.

@ArthurGenet
Copy link
Author

Ok thank you for your answers, it is not a big deal, I was just wondering why it wasn't showing.

@osma
Copy link
Member

osma commented Apr 21, 2022

Now the mechanism appears to be broken also without Docker: https://finto.fi/en/about

@osma
Copy link
Member

osma commented Apr 21, 2022

I think we need something like bumpversion for Python projects, i.e. some way of keeping track of the Skosmos version number in a file that's accessible from PHP code.

@kinow
Copy link
Collaborator

kinow commented Apr 21, 2022

I wonder if we could use composer.json perhaps? This diff in composer.json:

diff --git a/composer.json b/composer.json
index 1c3eafd8..ab866b5f 100644
--- a/composer.json
+++ b/composer.json
@@ -3,6 +3,7 @@
   "description": "Thesaurus and controlled vocabulary browser using SKOS and SPARQL",
   "type": "project",
   "license": "MIT",
+  "version": "v2.15-dev",
   "repositories": { 
     "lscache": {
       "type": "package",

Followed by composer install, then this change in the PHP code:

diff --git a/model/Model.php b/model/Model.php
index e6f58f3a..e7a08181 100644
--- a/model/Model.php
+++ b/model/Model.php
@@ -76,10 +76,7 @@ class Model
      */
     public function getVersion() : string
     {
-        $ver = null;
-        if (file_exists('.git')) {
-            $ver = rtrim(shell_exec('git describe --tags --always'));
-        }
+        $ver = \Composer\InstalledVersions::getRootPackage()['pretty_version'];
 
         if ($ver === null) {
             return "unknown";

Results in:

image

I found a few tools/libs123 to bump the composer.json version, or that could be done manually too.

Footnotes

  1. https://www.npmjs.com/package/@pxlwidgets/php-composer-version/v/1.1.1

  2. https://github.com/talevskiigor/composer-bump

  3. https://github.com/quazardous/php-bump-version

@osma
Copy link
Member

osma commented Apr 21, 2022

Great hints @kinow ! This looks like the correct and best way to do it.

https://www.npmjs.com/package/@pxlwidgets/php-composer-version/v/1.1.1

This tool seems to be Node.js based, maybe not ideal since it requires that developers have a working Node environment which so far hasn't been a requirement for Skosmos development.

https://github.com/talevskiigor/composer-bump

This is from 2016 so may be outdated and unmaintained?

https://github.com/quazardous/php-bump-version

This is also from 2016.

Anyway we can do this manually as well if there's no suitable tool. We can just include it in the Release Process documentation.

@MikkoAleksanteri MikkoAleksanteri assigned joelit and osma and unassigned joelit Apr 26, 2022
Repository owner moved this from Proposed items for this sprint to Issue/PR Closed in Finton Skosmos-sprintti 1/2022 Apr 27, 2022
@osma osma added this to the 2.15 milestone Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Issue/PR Closed
Development

Successfully merging a pull request may close this issue.

4 participants