Skip to content

Add infrahubctl graphql query-report command#976

Open
ogenstad wants to merge 1 commit intodevelopfrom
pog-graphql-query-report-ifc-2236
Open

Add infrahubctl graphql query-report command#976
ogenstad wants to merge 1 commit intodevelopfrom
pog-graphql-query-report-ifc-2236

Conversation

@ogenstad
Copy link
Copy Markdown
Contributor

@ogenstad ogenstad commented Apr 28, 2026

Why

Adds a new subcommand to infrahubctl for infrahubctl graphql query-report, it's to allow users to check a query either from a .infrahub.yml file or by specifying the name of a query that exists in Infrahub and returning a query report. For now the only entry in the report is that users can see if the query can be used for unique targets for artifact definitions.

Example output

blue on  main [⇡] via 🐍 v3.12.12 (infrahub-sdk) on ☁️   took 2s
❯ /Users/patrick/Code/opsmill/infrahub/.venv/bin/infrahubctl graphql query-report gen
Query 'gen' (local: generators/gen.gql)
Targets unique nodes: false — all artifacts for the definition will be regenerated on any relevant node change.

blue on  main [⇡] via 🐍 v3.12.12 (infrahub-sdk) on ☁️
❯ /Users/patrick/Code/opsmill/infrahub/.venv/bin/infrahubctl graphql query-report character
Query 'character' (local: checks/character.gql)
Targets unique nodes: true — Infrahub will limit artifact regeneration to changed nodes only.

What changed

  • New command for infrahubctl that uses GraphQL query introduced in Infrahub 1.9.1
  • Tests

@github-actions github-actions Bot added the type/documentation Improvements or additions to documentation label Apr 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@             Coverage Diff             @@
##           develop     #976      +/-   ##
===========================================
+ Coverage    81.43%   81.47%   +0.04%     
===========================================
  Files          134      134              
  Lines        11359    11374      +15     
  Branches      1703     1707       +4     
===========================================
+ Hits          9250     9267      +17     
+ Misses        1566     1565       -1     
+ Partials       543      542       -1     
Flag Coverage Δ
integration-tests 41.92% <66.66%> (+0.02%) ⬆️
python-3.10 54.49% <100.00%> (+0.07%) ⬆️
python-3.11 54.47% <100.00%> (+0.07%) ⬆️
python-3.12 54.47% <100.00%> (+0.06%) ⬆️
python-3.13 54.49% <100.00%> (+0.07%) ⬆️
python-3.14 54.49% <100.00%> (+0.07%) ⬆️
python-filler-3.12 22.69% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/ctl/graphql.py 91.05% <100.00%> (+2.51%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ogenstad ogenstad force-pushed the pog-graphql-query-report-ifc-2236 branch from ed38b6b to a7f5a72 Compare May 6, 2026 09:43
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 6, 2026

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: a7f5a72
Status: ✅  Deploy successful!
Preview URL: https://aa4f7303.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-graphql-query-report-ifc.infrahub-sdk-python.pages.dev

View logs


if online:
node = await client.get(
kind=CoreGraphQLQuery, # type: ignore[type-abstract]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary ignore until we can resolve the protocol issues within the SDK.

@ogenstad ogenstad marked this pull request as ready for review May 6, 2026 13:46
@ogenstad ogenstad requested a review from a team as a code owner May 6, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants