How to use Gitlab gitattribute feature to ident the commit of a model version

Started by Jose-Carlos, March 23, 2018, 16:15:06 PM

Previous topic - Next topic

Jose-Carlos

Hi,
I'm using Gitlab to store my models with collaboration plugin.
I have an automatic publication on server side which retreive the model files and generate HTML, DOCX and PDF files, and publish it to a web server.
I would like to create a model property to display the commit number of extracted version used to publish the model.

There is a feature in Gitlab which allows it: https://git-scm.com/docs/gitattributes.

Option to set on this file is "ident".
Keyword to use on Archi properties is $Id$.

The file to store ident option must be located on $GIT_DIR/info/attributes or .gitattributes (I suppose current working directory during publish task).

In an Archi context, could you tell me where is the location equivalent to $GIT_DIR or the working directory during publish task?

Thanks for your help.

Jean-Baptiste Sarrodie

Hi,

DOCX and PDF are generated through jasperreport and so during the report generation the working directory should be the folder that contains the report template ("Archi/plugins/com.archimatetool.jasperreports..../reports/Customizable Report" if you use the builtin report). If not this should the folder where Archi is installed.

For HTML, it depends: if you speak about the HTML produced by jasperreport then it is the same. If you speak about the "real" HTML report (File>Report>HTML) then it should be the folder where Archi is installed.

I have never tested though so you might check by yourself ;-)

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Jose-Carlos

Hi Jean-Baptiste,

thanks for your feedback. In fact, the ident action occurs during the git check-in.

To be able to use ident feature from Gitlab, I have created the file .gitattributes in <local repository folder>/<model_name>.
In this way, during git check-in and check-out, the extracted version is populated with the commit id.

But this solution implies that I manually add the file on each <model_name> folder.

A solution could be to have a plugin able to set in preferences menu the location of .gitattribues file and include it during the first publish task. Perhaps a good starting point for me to initiate my first plugin... :-)

I tried many other locations to put .gitattributes or attributes files, but without success.

stephane31

Hello @Jose-Carlos
I would like to export html report from gitlab after every commit in a web server.
How do you convert from gitlab file (in graphico format)  to html ? Do you use archimate cli ?

Thanks for your help.
Dernière vidéo : "Comment partager sa vision de l'entreprise et du SI ?" -  https://bit.ly/3KfxFQp
Découvrez mon Initiation en français  sur le core Archimate en vidéo sur mon blog - https://bit.ly/3MslEbY

Jose-Carlos

Hi Stephane,
to publish reports, the user connects to the web server and choose the project and commit# to publish (choices are retreived from gitlab using APIs).
Then, he provides additional information such as destination domain (directory in fact), version number, if he want to erase existing version or not.

Once informations are provided, the script retreives from gitlab server the zip file corresponding to the commit (retreived from the url http://<gitlab.domain>/<group>/<subgroup>/<commit id>/repository/archive.zip).

This zip contains the archimate model structure and is unzipped on a working area.

An Archi instance is installed on the server and is used to generate target reports with ACLI feature. The working area is used for parameter --modelrepository.loadModel.

ACLI allows you to generate jasper based reports or HTML webpages structure.

Initially, the web server was running on CentOS 6 on Azure, but I add troubles to use ACLI on this Platform (pb related to graphic drivers/X server...). I had to replatform to Windows 2012 and it work fine now.

Hope it'll help you.