Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!

CI/CD pipelines for Qlik Sense apps with automations and Github

100% helpful (1/1)
cancel
Showing results for 
Search instead for 
Did you mean: 
NikoNelissen-Qlik
Former Employee
Former Employee

CI/CD pipelines for Qlik Sense apps with automations and Github

Last Update:

Apr 26, 2023 5:15:27 AM

Updated By:

AfeefaTk

Created date:

Nov 18, 2021 4:43:49 AM

Attachments

Automations allow you to set up CI/CD pipelines for your Qlik Sense apps, using the Github connector. Below we showcase various components of a CI/CD pipeline, that can be combined and extended based on your own needs.

Commit Qlik Sense app to Github

You can commit a Qlik Sense app to Github to perform versioning - allowing you to rollback to a previous version if needed - or simply to have a backup of your apps.

The following automation commits the QVF file to Github which can be used to restore the app or to recreate it in a different space, tenant or environment:

qvf to github.png

We can also commit human readable files to Github that contain all the artefacts of the app (sheets, measures, load script etc.) to allow users to compare versions (doing a "diff") in Github. Here is an example where we loop over all sheets, for each sheet we loop over all objects and we add the json representation to a variable of type "String" (text):

objects to var.png

Note that we apply the formula "json" to each object, this will convert the actual object to a json text representation. We are also adding a line break and then we append this text to our variable. Here is the raw view that shows the formula:

objects to var raw.png

 

Finally we are using the variable to write to a text file on Github:

var to github.png

Note that we have to convert the text of the variable to base64 encoding using the base64 formula. The raw view of the above field mapping is: { base64encode: { $.ObjectString } }

In a similar manner we can commit the load script in a text file on Github:

load script to github.png

 

Same as before, we apply the base64 encode formula on the load script. Here is the raw view of the above field mapping: {base64encode: {$.GetLoadScript.qScript}}

See attached for a full template that commits a wide range of artefacts from a Qlik Sense app to Github.

Restore or (re)create a Qlik Sense App from Github

Here is an example that retrieves a QVF file from Github and uses that to create a Qlik Sense App in your tenant:

app restore.png

You can extend this automation to also update the load script if the imported Qlik Sense App. This is useful e.g. when people collaborated on the load script and merged their changes in Github:

restore-app-with-load-script.png

Run tests on a Qlik Sense App on new Pull Request (PR) in Github

A common CI/CD pipeline practice is to run tests when a new pull request (PR) is opened. Here is a simple example of an automation that is triggered when a new PR is created in Github:

tests on PR.png

 

Note that we added a Condition block to the automation. This is needed because Github will emit an event when the PR is opened, but also e.g. when it is closed:

condition for PR.png

The automation runs a few tests on a Qlik Sense App. In our example we perform following tests:

  • Reload the app and see if that succeeds
  • Get a measure value from the app and check if it has the correct value

Finally, the automation adds a comment to the PR with the test results, or it can set the PR to "Approved" using the Github block "Add Pull Request Review":

add comment to github.png

Tags (2)
Labels (1)
Comments
LDR
Creator II
Creator II

Hi @Danica-Cortez 

I'm guessing so maybe what I'm going to say is wrong. Maybe, there's a way to export the app without data. Could it be?

Regards

Danica-Cortez
Contributor II
Contributor II

hey @LDR thanks for responding, actually my error was not due to the size of the file in the end, but that the repository "doesn't exist". That is why the API call was returning a 404. The private repository belongs to an organization I am part of. It appears Qlik only allows you to access your personal repos. I posted a new question about it here.

LDR
Creator II
Creator II

Hi @Danica-Cortez 

I don't have had yet the chance to work with the SaaS solution but I think I can shortly so how to say it, I can't wait more for getting hands on Automation and Git.😅

Thanks for your feedback 

OdieW
Contributor III
Contributor III

I have been testing the export to github automation and its been working great. Recently another team member published an app and that worked great as well. Today another team member published and app and I got an error in the automation. It did commit the qvf to github but failed on getting the load script. I received 2 different errors as shown below:

 

Cannot encode a non-string value. This error was in the failed automation email as well as well as in the errors section of the automation.

Additionally when looking at the per block or chronologically sections I see an error like this:
code: -32601

parameter: GetScript

message: Method not found.

 

From my understanding base64 encoding shouldn't care what type of characters its encoding, its only cares about the characters when decoding the file, so I am not sure why its erroring on a non-string value and also not sure what/where in the load script that non string value is.

 

Version history
Last update:
‎2023-04-26 05:15 AM
Updated by: