Managing Resources With Code

Managing Resources With Code

The build process

Here is a high-level description of what actually happens during the build process:

  • Create resources. For models that you check in that do not currently exist, the model is created from scratch from your configuration file and from the database. This means that the base table and all the columns must still exist in the database for the build to succeed.
  • Update resources. If a column is changed, it will be updated in all dependent items (regardless of whether the dependent items were also checked in) - so things like name changes should be correctly reflected.
  • Clean up resources. If any columns or models are deleted, all dependent items that relied on that column or model will also be deleted.
  • Smoke test. Once the model is built, a single aggregate analytical query will be run against the database to make sure that data aggregation can still be run against the model.

If there is an error while deploying a Data Model, the build process will revert to the previous version of that model, and all dependent resources of that model will not be updated.

Hashboard configuration files

Hashboard supports configuration files written in YAML or JSON. A Hashboard Build will attempt to validate every file in the specified path with a .yml or .json extension.

Full documentation of all configuration files can be found for each resource type:

To export configuration files, use the pull command.

Migrating existing resources to code

If you have existing content built in the UI and want to move it into code, you can specify the grn property on the resource. This will cause the config to update an existing resource with that GRN, instead of creating a new resource.

This can also be used to avoid recreating resources when renaming or refactoring the file structure of your project.

Code managed resources

To protect specific resources to only be editable with the Hashboard deployments, add the preventUpdatesFromUI flag set as true to any config. This prevents users from unintentionally updating critical resources from the Hashboard web application and gives your team greater control over valuable long lived resources that are core to your business needs.

Syncing resources

To sync your local config files with edits made to resources via the UI, use the pull command.