Announcement
· Apr 21, 2021

Git for InterSystems IRIS - Native Git workflow for the IRIS platform

Hi Developers, I am glad to announce Git for InterSystems IRIS, my first submission to OpenExchange and part of the current Developer Tools Contest.

Git for InterSystems IRIS is a source control package that aims to facilitate a native integration of the Git workflow with the InterSystems IRIS platform. It is designed to work as a transparent link between InterSystems IRIS and a Git-enabled code directory that, once setup, requires no user interaction. A detailed description can be found on GitHub.

  

 

I am looking forward to learn what you think about this approach. Does it make sense? Would this help you with establishing a Git-based deployment pipeline? Are there any issues that may have been overlooked?

A ready-to-run docker demo is available on OpenExchange. The application is in a usable proof-of-concept state, with some features still to be implemented. I am happy to receive any feedback from you.

Discussion (10)3
Log in or sign up to continue

Hi Ben, the project started as a fork of Caché Tortoize Git, which was a good starting point, and initially I intended to change only a few things. As development went on, however, most of the code has been rewritten and I think only 10-20% is left from the original code. There were just too many differences in the basic concepts, including the Globals structure, handling of namespaces and projects, and interaction with Git (hooks -> REST) and Studio (none).

Hello Marcus,

Thank you for sharing.

I'm building a dockerised DEV environnement.

The main issue I am encountering at this moment is the modification from the portal of Business Process or Transform for exemple. I have to export manually my new processes. If I forget it, I just lose it ...

I try to install and configure GIT directly on my image.

The aim is to link my local repo to the container. I don't want GIT at all. This way, I will have a automatical export.

But, it is quite difficult to use in command line.

I always have to perform an INIT when I start my container.

I tried to perform an init from my DockerFile (do ##class(SourceControl.Git.Utils).UserAction("","%SourceMenu,Init")) but it does not work.

Do you have a clean way to install and configure GIT from a DockerFile ?

Thanks

Regards,

Matthieu.

My iris start in my DockerFile :

RUN iris start IRIS \

    && iris session IRIS -U %SYS < /tmp/iris.script \

    && iris stop IRIS quietly

my iris.script :

    //On installe ZPM

    set $namespace="%SYS", name="DefaultSSL" do:'##class(Security.SSLConfigs).Exists(name) ##class(Security.SSLConfigs).Create(name) set url="https://pm.community.intersystems.com/packages/zpm/latest/installer" Do ##class(%Net.URLParser).Parse(url,.comp) set ht = ##class(%Net.HttpRequest).%New(), ht.Server = comp("host"), ht.Port = 443, ht.Https=1, ht.SSLConfiguration=name, st=ht.Get(comp("path")) quit:'st $System.Status.GetErrorText(st) set xml=##class(%File).TempFilename("xml"), tFile = ##class(%Stream.FileBinary).%New(), tFile.Filename = xml do tFile.CopyFromAndSave(ht.HttpResponse.Data) do ht.%Close(), $system.OBJ.Load(xml,"ck") do ##class(%File).Delete(xml)

   

    do ##class(%SYSTEM.Process).CurrentDirectory("/opt/irisapp")

    //On charge les installer et les deployer

    do $SYSTEM.OBJ.Load("InstallerLibrary.cls", "ck")

    //On installe les namespaces

    set sc = ##class(App.InstallerLibrary).setup()

   

    // Je ne sais pas pourquoi mais je dois redéfinir le dossier de travail

    do ##class(%SYSTEM.Process).CurrentDirectory("/opt/irisapp")

    //On importe les default settings + le plugin GIT (SURTOUT LAISSER LES PASSAGES A LA LIGNE)

    zn "LIBRARY"

    zpm "install git-source-control"

    d ##class(SourceControl.Git.API).Configure()

/irisdev/app/LIBRARY/

   

    // Pour éviter de devoir modifier le mdp SuperUser.

    zn "%SYS"

    w ##class(Security.Users).UnExpireUserPasswords("*")

     // Pour faire fonctionner le plugin Git, il faut que le path défini existe, par défaut il est à chaine vide et cela fait planter le plugin. En l'enlevant cela fonctionne

    k ^SYS("SourceControl","Git","%gitBinPath")

   

    zn "LIBRARY"

    do ##class(SourceControl.Git.Utils).UserAction("","%SourceMenu,Init")

    halt

Hi Matthieu,

so you want to use Git for IRIS for an automated export of classes and set it up from the iris.script, which will be invoked in the Dockerfile.

From the code you have pasted, it seems like you use a different Git Source Control implementation (zpm "install git-source-control“). The implementation discussed in this thread would be installed with

zpm "install git-for-iris“

There, you can use the API functions in SourceControl.Git.Utils in the iris.script:

do ##class(SourceControl.Git.Utils).AddDefaultSettings()
do ##class(SourceControl.Git.Utils).AddPackageToSourceControl(„<My.Package.Name>“, „<MyNamespace>“)
do ##class(SourceControl.Git.Utils).SetSourceControlStatus(1)

A default package is added to source control via module.xml for demo purposes, as well as the /csp/user/sc web application for callbacks from git, both of which you may want to remove.

As a final step, you will have to activate the source control class in IRIS. The manual process is described here https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=AS..., you might look into the corresponding CSP page to find out how to do it programatically.

Hope this helps.

Currently there is a select few of us in the group that use Git and Local Repos for VS code, but I want to make this more wide spread for our team as most use the Editors off of the Management Portal to do their coding. 

Does anyone have steps they have used in the past to move towards Server Side Source Control from creating the Repos on your Server, getting the IRIS Code into the new Repo you created on your server, and pushing it to github?

Git for IRIS has been updated to v0.3. It now provides source control for lookup tables and supports deletion of classes. Also, improvements were made to provision default settings, and Git hooks are now disabled by default to avoid unwanted side-effects (writing hooks to the .git directory, setting a random password for the technical user).

A complete guide for deploying Git for IRIS to an existing IRIS instance has been added to README.md along with detailed descriptions of settings, Globals and behaviour.