This blog post describes the advantages that the DevOps concepts of source control and continuous deployment offer for Tableau workbook development and provides a solution for continuously deploying Tableau workbooks from Github repositories to Tableau Server/Online. Find the code for the continuous deployment solution on the Aimpoint Digital Github.
Source control is the process of tracking revisions to code during development. By keeping track of information like:
- When the revision took place
- Who made the revision
- What changes were made to the code
A comprehensive lineage of the development lifecycle is maintained so that the project can be fully audited. Source control systems like git keep a running history of all code revisions, enabling a roll-back to any previous code version if necessary. A source control system enforces documentation at each stage of development and removes the responsibility from the developer for storing and managing several iterations of their code.
Source Control in Tableau
Tableau does include some native features for source control. Both Tableau Server and Tableau Online ship with a Revision History feature enabled by default. For Tableau Server, up to 25 revisions of workbooks and data sources can be stored, while a maximum of 10 revisions are on the Tableau Online platform. The Publisher Name and Publisher Date of each revision are also tracked.
While the Revision History feature is a big step towards full source control that no doubt will improve upon in future releases, there are currently some drawbacks:
- It is not possible to add a title or description to revisions. Without a title or description, the developer has no insight into the changes made to the workbook on each revision. The developer must rely on memory or a manually written log to document the workbook’s state at each revision.
- If a workbook/data source is deleted from Tableau Server/Online, the revision history is also deleted and non-retrievable, even if the deleted workbook is re-published. The only way a deleted workbook can be retrieved is to restore the entire Tableau Server from a backup taken when the workbook still existed (note that this option is not available for Tableau Online).
- The limit of 25/10 revisions may be conservative for some projects. In some organizations, Tableau Server administrators may set the limit below 25 to preserve storage space.
Extending Source Control for Tableau With Git
Using git as a source control system has several benefits for tracking the lineage of Tableau workbooks:
- Revisions are titled, dated, and have a description where changes to the workbook can be documented. Developers can easily audit their revisions and understand the state of the workbook at each stage.
- An unlimited number of revisions can be stored, with the ability to revert to any prior revision. This could be beneficial for large projects with many feature updates and revisions.
- Revisions are protected if the workbook is deleted from the Tableau production environment. There is now a separation between the git repository and the Tableau platform, meaning that if a workbook is deleted from Tableau Server/Online, the workbook and revisions persist in the git repository until they are deleted.
In software development, continuous deployment is a release strategy whereby production-ready code is subjected to automated testing and upon passing, is automatically released to the production environment.
In Tableau, the underlying XML code of workbooks is generated by the Tableau application, so the automated testing phase of continuous deployment is less applicable – we can be sure that the code will “run” to generate the workbook. More relevantly, continuous deployment addresses the separation between the production-ready code (e.g., the latest revision of our Tableau workbook on Github) and the production environment (Tableau Server/Online) by deploying automatically from Github to Tableau Server/Online.
Continuously Deploying Tableau Workbooks With Github Actions
Github Actions is a service that enables automation of the development workflow.
In summary, Github Actions allows you to spin up a virtual machine to perform operations on your repository and its contents. Actions are event-driven, meaning that they are triggered by events in the repository, like publishing updates to a piece of code. Github provides free-tier users with 2000 minutes of Github Action compute time per month for private repositories and an unlimited supply for public repositories.
Github Actions can be used to continuously deploy Tableau workbooks from Github to Tableau Server/Online. An example of a continuous deployment workflow is illustrated below.
The production version of the workbook resides in the master branch of the repository. The Tableau developer creates a development branch to add changes to the workbook, such as adding dashboards, calculated fields, and filters, without directly affecting the production version of the workbook. When the developer is happy with the changes, they can merge their development branch back to the master branch to insert their newly developed features into the production workbook.
Once their changes have been reviewed and accepted, a Github Action is triggered, automatically deploying the workbook to Tableau Server/Online. Using this workflow, Tableau Server/Online will always reflect the latest version of the production-ready Tableau workbook. Of course, if the team is later unhappy with the changes, it is possible to revert to the previous version of the production workbook quickly.
We have shared code and documentation on the Aimpoint Digital Github for a Github Action template that could be used in such a workflow, allowing Tableau workbooks to be deployed to Tableau Server/Online directly from Github.
The Action uses Tableau’s tabcmd command-line interface to publish workbooks from the repository to the Server/Online platform if merged to the Master branch. Login credentials and server addresses are used securely with the Github secrets manager and are not exposed in the code. This template can, of course, be extended to exploit more of the functionality that tabcmd has to offer, such as managing Tableau projects, users, and data extracts.
Aimpoint Digital is a Proven Tableau Partner
Aimpoint Digital partners closely with Tableau and our clients to implement visual analytics and visualization design best practices while utilizing DevOps techniques like CI/CD for robust and reliable analytics. Our cross-functional team of Data Engineering, Data Analytics, and Data Science experts can enable end-to-end success for your data projects.
Contact us through the form below to discuss how we can help you deploy these techniques!