Skip to content

Commit fd9268c

Browse files
committed
Follow up docs
1 parent 8b8d79f commit fd9268c

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

docs/docs/guides/artifact.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,20 @@ If artifacts aren't generating:
166166
3. Ensure group members inherit from `CoreArtifactTarget`
167167
4. Confirm the Git repository sync is working
168168

169+
If artifacts are regenerating for all nodes instead of only changed nodes, the Transformation query may not uniquely identify its targets. Use `InfrahubGraphQLQueryReport` to diagnose:
170+
171+
```graphql
172+
{
173+
InfrahubGraphQLQueryReport(
174+
query: "<paste your transformation query here>"
175+
) {
176+
targets_unique_nodes
177+
}
178+
}
179+
```
180+
181+
If `targets_unique_nodes` returns `false`, update the query to filter by a required `ids` argument or a field matching the model's uniqueness constraints. See [artifact regeneration](../topics/artifact.mdx#artifact-regeneration) for details.
182+
169183
## Next steps
170184

171185
- [Create complex Transformations with Python](./python-transform.mdx)

docs/docs/topics/artifact.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,34 @@ nodes:
7676
When a `CoreArtifactTarget` node is deleted, all artifacts associated with it are automatically deleted as well.
7777
:::
7878

79+
## Artifact regeneration
80+
81+
When a relevant node changes, Infrahub regenerates affected artifacts. Regeneration operates in one of two modes:
82+
83+
- **Targeted regeneration**: Infrahub regenerates artifacts only for the specific nodes that changed. This requires the artifact definition's Transformation query to uniquely identify its target nodes — via a required `ids` argument or a field that matches the model's uniqueness constraints.
84+
- **Full regeneration**: Infrahub regenerates artifacts for all nodes in the target group. This is the fallback when the query does not uniquely identify targets.
85+
86+
Targeted regeneration reduces unnecessary work and speeds up artifact updates after node changes. Full regeneration is safe but less efficient for large groups.
87+
88+
### Validating your Transformation query
89+
90+
Before creating or updating an artifact definition, use the `InfrahubGraphQLQueryReport` introspection query to confirm whether your Transformation query will trigger targeted or full regeneration:
91+
92+
```graphql
93+
{
94+
InfrahubGraphQLQueryReport(
95+
query: "{ NetworkDeviceQuery(ids: [\"<device-id>\"]) { edges { node { id name__value } } } }"
96+
) {
97+
targets_unique_nodes
98+
}
99+
}
100+
```
101+
102+
- `targets_unique_nodes: true` — Infrahub will regenerate only the artifacts for nodes that changed.
103+
- `targets_unique_nodes: false` — Infrahub will regenerate all artifacts in the definition on any relevant node change.
104+
105+
For step-by-step instructions on diagnosing unexpected full regenerations, see [generating artifacts](../guides/artifact.mdx#troubleshooting).
106+
79107
## Composing content across artifacts
80108

81109
A Transformation can reference and include the rendered content of other artifacts or file objects using built-in Jinja2 filters or the Python SDK object store API. This enables modular configuration pipelines where each artifact generates one section, and a composite artifact assembles the final result.

0 commit comments

Comments
 (0)