Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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:
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):
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:
Finally we are using the variable to write to a text file on Github:
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:
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.
Here is an example that retrieves a QVF file from Github and uses that to create a Qlik Sense App in your tenant:
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:
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:
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:
The automation runs a few tests on a Qlik Sense App. In our example we perform following tests:
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":
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
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.
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
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.