Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Generation and reverse generation

glechev edited this page Jun 30, 2021 · 1 revision

Generation and Reverse Generation

Generation

Generation is the process of creating content in the target system.

Generation Flow

Content files most often return a single or multiple entities that we want generated. Each model object is broken down into a set of commands and entities that are passed to a standard REST API Client. From there they are sent to the respective target system API for creation or modification.

The order of generation is as follows:

  1. Content files may be prefixed with 3-digit index followed by dash (for example 010-my-content.groovy).
    • Files with a lower index will be processed first.
    • Files with the same index will be processed in parallel
    • If no index is specified, the files will be treated as they have an index of 500 (default value)
  2. When multiple entities are to be created from a single content file, these are processed sequentially in the order of definition.

Reverse generation

This is similar to the above, but it runs backwards. Using the client, all the required objects from the target system are fetched. These objects are translated into model objects that are written down to content files.

It's important to note, that even if this operation looks similar to exporting data from the target system, it doesn't have the same parity. Unlike exporting, When the data is translated from the API object to model object, only the known bits are written down. It's possible some things are lost in translation. It's also possible that some things are added if that makes sense for generation.

It's highly recommended to verify your content after reverse generation.

  1. Make sure all the passwords and secrets are put down - we cannot export these.
  2. Make sure there are no hardcoded IDs referenced, and if there are rework the respective code to use names instead. For instance, this may be observed for Cloud Assembly extensibility subscriptions criteria.
  3. Generate the content in another, test instance that is different than the one you exported the content from.