You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running an artifact definition will create new nodes as defined by the generator, or remove old ones that are no longer required. The removal of obsolete objects is handled using the [SDK tracking feature]($(base_url)python-sdk/topics/tracking)
25
+
Running a generator definition will create new nodes as defined by the generator, or remove old ones that are no longer required. The removal of obsolete objects is handled using the [SDK tracking feature]($(base_url)python-sdk/topics/tracking)
26
26
27
27
The targets point to a [group](./groups.mdx) that will consist of objects that are impacted by the generator. The members of this group can be any type of object within your schema, service objects, devices, contracts or anything you want the generator to act upon. Generator groups (`CoreGeneratorGroup`) serve as target collections that define which objects trigger generator execution, while the actual tracking of generated objects is handled by individual generator instances.
28
28
29
29
The [GraphQL query](graphql) defines the data that will be collected when running the generator. Any object identified in this step is added as a member to a GraphQL query [group](./groups.mdx) (`CoreGraphQLQueryGroup`). The membership in these groups are then used to determine which generators need to be executed as part of a proposed change during the pipeline run.
30
30
31
31
The Generator itself is a Python class that is based on the `InfrahubGenerator` class from the SDK. Just like [transforms](transformation) and [checks](check), the Generators are user defined.
32
32
33
+
Generators can be executed in several ways, depending on your workflow and where you are in the lifecycle (local development vs. in Infrahub):
34
+
35
+
1. During development with infrahubctl
36
+
37
+
Use the `infrahubctl generator` command to iterate locally while building and testing your generator.
38
+
2. Manually from the UI
39
+
40
+
From the Infrahub UI, open the Generator Definition detail page (Actions > Generator Definitions) and click Run to trigger the generator on demand.
41
+
3. Automatically via Proposed Changes
42
+
43
+
When you open a Proposed Change that affects the generator’s targets, the generator runs as part of Infrahub’s CI checks. Review the results in the Checks and Data tabs of the Proposed Change. This behavior can also be disabled per generator in the repository configuration file.
44
+
4. Automatically via Events and Actions
45
+
46
+
You can configure Infrahub Event rules and Actions to trigger generators automatically based on changes in your data. This enables fully automated execution aligned with your workflows.
47
+
33
48
## Video guides
34
49
35
50
In this video series we’re diving into the concept of generators and services, exploring their significance, structure, and how they can streamline processes for teams. Whether you’re a developer or just curious about automation in IT, this guide will provide you with a comprehensive understanding of generators and their applications.
0 commit comments