Projet

Général

Profil

Anomalie #5214

La page « À propos » contient -dirty après la version

Ajouté par Christian P. Momon il y a environ 3 ans. Mis à jour il y a environ 3 ans.

Statut:
Fermé
Priorité:
Normale
Assigné à:
Début:
13/02/2021
Echéance:
% réalisé:

0%

Temps estimé:

Description

Actuellement, dans la page https://mobilizon.chapril.org/about/instance, on peut lire :

Version de Mobilizon    chapril-1.0.6-dirty

Demande : ne plus avoir la mention « dirty ».

Historique

#1

Mis à jour par Christian P. Momon il y a environ 3 ans

  • Tracker changé de Demande à Anomalie

L'affichage dans la page vient du fichier https://forge.april.org/Chapril/mobilizon.chapril.org-mobilizon/src/branch/chapril/js/src/views/About/AboutInstance.vue

<tr>
          <td>{{ $t("Mobilizon version") }}</td>
          <td>{{ config.version }}</td>
</tr>

La configuration est faite via une requête au backend :

# Version originale :
curl -X POST --header 'Content-Type: application/json' -d '{"operationName":"About","variables":{},"query":"query About {\n  config {\n    name\n    description\n    longDescription\n    contact\n    languages\n    registrationsOpen\n    registrationsAllowlist\n    anonymous {\n      participation {\n        allowed\n        __typename\n      }\n      __typename\n    }\n    version\n    federating\n    __typename\n  }\n}\n"}' https://mobilizon.chapril.org/api
echo "" 

# Version courte :
curl -X POST --header 'Content-Type: application/json' -d '{"operationName":"About","variables":{},"query":"query About {\n  config {\n version\n  }\n}\n"}' https://mobilizon.chapril.org/api
echo "" 

Valeur retournée par le serveur :

{"data":{"config":{"version":"chapril-1.0.6-dirty"}}}

Côté serveur, le code est dans https://forge.april.org/Chapril/mobilizon.chapril.org-mobilizon/src/branch/chapril/lib/service/git_status.ex :

defmodule Mobilizon.Service.GitStatus do
  @moduledoc """ 
  See https://github.com/CrowdHailer/git_status/
  """ 
  require Logger

  @commit (case System.cmd("git", ["describe", "--tags", "--dirty"]) do
             {hash, 0} ->
               String.trim(hash)

             _ ->
               # Fallback on Mix version
               Logger.warn("Could not read git commit hash, using Mix version code instead.")
               Mix.Project.config()[:version]
           end)

  @doc """ 
  The git commit hash read at compile time, if present
  """ 
  @spec commit :: String.t()
  def commit, do: @commit
end

Donc la commande exécutée par le code backend semble être :

git describe --tags --dirty

Extrait du man git-describe :

       --dirty[=<mark>], --broken[=<mark>]
           Describe the state of the working tree. When the working tree matches HEAD, the output is the same as "git describe HEAD". If the working tree has local modification "-dirty" is appended to it. If a
           repository is corrupt and Git cannot determine if there is local modification, Git will error out, unless ‘--broken’ is given, which appends the suffix "-broken" instead.

Donc il faut un dépôt propre pour faire disparaître.

Tykayn a rendu propre le dépôt et pourtant la mention dirty est toujours présente…

#2

Mis à jour par Christian P. Momon il y a environ 3 ans

Dans le code côté serveur, on voit « See https://github.com/CrowdHailer/git_status/ ».
Cette page contient :

GitStatus records information on the git status of a project at compile time. […]
The status information is read at compile time because using releases will mean that the source code, and therefore git directory, is not present at runtime.

Conclusion : l'information est calculée à la compilation. Donc pour faire disparaître la mention « dirty », il faut 1) rendre propre le dépôt git, 2) compiler.

#3

Mis à jour par Christian P. Momon il y a environ 3 ans

  • Assigné à mis à Baptiste Lemoine
#4

Mis à jour par Christian P. Momon il y a environ 3 ans

Demandes :
  • mettre propre le dépôt Git : FAIT
  • recompiler ;
  • ajouter dans la doc une étape pour s'assurer un dépôt propre avant compilation afin de ne pas se retrouver avec une mention « dirty ».
#5

Mis à jour par Baptiste Lemoine il y a environ 3 ans

  • Statut changé de Nouveau à Résolu

j'avais posé la question à Tcit et fait les commandes qu'il m'a passé avec l'utilisateur mobilizon, relancé le service, et c'est bon
https://mobilizon.chapril.org/about/instance

les commandes:

MIX_ENV=prod mix clean && MIX_ENV=prod mix compile

#6

Mis à jour par Christian P. Momon il y a environ 3 ans

  • Statut changé de Résolu à Fermé
#7

Mis à jour par Christian P. Momon il y a environ 3 ans

  • Version cible changé de Backlog à Sprint 2021 février

Formats disponibles : Atom PDF