5 Replies Latest reply: Sep 28, 2014 8:21 AM by Vadim Tsushko RSS

    Version control

    Vegar Lie Arntsen

      Hi all QDF managers

      I've done some attempts handling the qlikview development in svn. Checking in my whole folder structure (omiting qvd, qvw etc) into svn has been great for tracking our development. I prefere not to use the qlikview-client version handling function, because my qlikview development contains more than just the prj-folder. I like to track changes in my includes and other subfolders as well. It is also good to keep all folders in SVN when a new developer is checking out a project.

       

      However when it comes to environment with structured Test Acc Prod there is an issue. Checking in the whole qdf will not work when connection strings and other sourcepaths  differ. For these environments it feels like it is not a good idea to put the QDF into version control. Compare to my screenshot from the QDF deployment guide document.

      Resources needed in DTAP promotion process.PNG.png

      Do anyone of you have exerience of a good set up with QDF combined with version control that keeps all your development in svn, but in a efficient way keeps Test, Acc and Prod specific data locally on each machine?

       

      Best regards

      vegar.lie.arntsen

      egbs consulting ab

      http://bi-effekten.se

        • Re: Version control
          Joachim Boivie

          One way to go could be to split the projects, having the QDF structure in one project and the QVW in others?

          • Re: Version control
            Vadim Tsushko

            I would like to know good recipe for that scenario too. We too keep our QDF projects in CVS (git).

            My current approach is to group all environment specific variables in one file and to include that file in .gitignore

            So that one file we have to edit and maintain separately for each site.

            Not good solution but I have no better one.

                • Re: Version control
                  Vadim Tsushko

                  Yes that are excellent posts

                  • Re: Re: Version control
                    Vadim Tsushko

                    Hi Vegar.

                    For that specific problem we currently switching to new solution

                    :

                    We introduce universal variable `vU.Environment` in our projects. If you have test, acceptance and production sites, that variable would have value 'Test', 'Acc' or 'Prod' on that sites.

                    Then whe use that variable in any situation where we should have separate settings for sites.

                    For example: if you have separate db connections at your sites you can create three files instead one connection file:

                    Instead of Oracle_Connection.qvs we may have Oracle_Connection_Test.qvs, Oracle_Connecion_Acc.qvs and Oracle_Connection_Prod.qvs

                    Then we can include it as $(must_include=(vG.ConStringPath)\Oracle_Connection_$(vU.Environment).qvs)  and each site has it's own db connection.

                    Or we can use simple conditional code execution with `If` statement and so on.

                     

                    Next question - how to manage that variable itself?

                     

                    We curently have bunch of scripts that we executing just after cloning some project from repository.

                    So we added new script `0.Administration\6.Script\Vbs\create_environment_variable.vbs` to that initialization phase:

                     

                    Const ForReading = 1
                    Set objFSO = CreateObject("Scripting.FileSystemObject")
                    rootPath = objFSO.GetParentFolderName(objFSO.GetParentFolderName(objFSO.GetParentFolderName(objFSO.GetParentFolderName(Wscript.ScriptFullName))))
                    
                    
                    Set objNet = CreateObject("WScript.Network")
                    strCompName = objNet.ComputerName
                    
                    
                    envVar = "Prod"
                    if strCompName = "OUR_TEST_MACHINE" then
                      envVar = "Test"
                    end if
                    if strCompName = "OUR_ACCEPTANCE_MACHINE" then
                      envVar = "Acc"
                    end if
                    
                    
                    
                    
                    Dim file
                    path = rootPath & "\0.Administration\3.Include\1.BaseVariable\generated_environment_descriptor.qvs"
                    set file = objFSO.CreateTextFile(path)
                    file.Write "LET vU.Environment = '" & envVar & "';"
                    file.close
                    WScript.echo "Created file: " & path
                    
                    
                    

                     

                    That script is called from the batch file project_init.bat located in the project root directory

                    cd 0.Administration\6.Script\Vbs
                    cscript create_environment_variable.vbs
                    cscript create_sublime_project.vbs
                    cscript create_etl_qv_apps.vbs
                    cscript create_default_include.vbs
                    cd ..\..\..
                    
                    
                    

                     

                    To set that variable we added one line in each QDF 1.Init.qvs file right below line

                    `exit script when '$(vG.BasePath)' = '';`  see snippet:

                     

                    // ADD envrironment descriptor variable
                    $(must_include=$(vG.BasePath)..\0.Administration\3.Include\1.BaseVariable\generated_environment_descriptor.qvs);
                    
                    
                    


                    Variable set so early in QDF bootstrap flow specifically to allow use correct value in If() functions in CustomVariables.csv files.

                     

                    And obviously we added new file to `.gitignore` file, so `.gitignore` at project root now looks like:

                     

                    *.qvw
                    *.qvd
                    !2.qvd/
                    *.qvw.log
                    ~*.*
                    *.zip
                    *.7z
                    *.tmp
                    *.mdb
                    *.ldb
                    *.qvw.meta
                    *.qvw.shared
                    generated_environment_descriptor.qvs