feat: expose image digest in GraphQL#486
Merged
Merged
Conversation
thokra-nav
reviewed
Jul 2, 2026
thokra-nav
approved these changes
Jul 2, 2026
a33da78 to
e5969a3
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the workload image parsing/model so GraphQL can expose an image digest as a first-class field, while preserving existing vulnerability lookup semantics (v13s) by reusing the same parsing primitive across workload + vulnerability code paths. It also expands unit/integration test coverage for tag-only, digest-only, and tag+digest image references.
Changes:
- Add
digesttoContainerImagein the GraphQL schema and Go model, and introduceParseImageReferenceto parse tag/digest without conflating them. - Update vulnerability image splitting/lookup to use the shared workload parser while keeping “default tag to latest” and lookup formatting semantics.
- Extend Go and Lua tests/resources to cover digest-only and nested-path image references (including registries with ports).
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/workload/models.go | Adds Digest to ContainerImage and introduces ParseImageReference/ParsedImageReference for consistent tag+digest parsing. |
| internal/workload/models_test.go | Expands round-trip and metadata tests for image parsing/ref reconstruction across many reference shapes. |
| internal/vulnerability/queries.go | Replaces local parsing with workload.ParseImageReference while keeping “tag defaults to latest” behavior. |
| internal/vulnerability/queries_test.go | Adds test cases for nested-path images (digest-only, tag+digest, registry ports). |
| internal/vulnerability/fake/fakedata.go | Adjusts fake v13s workload summaries to format image lookup refs correctly with the new parsing semantics. |
| internal/graph/schema/workloads.graphqls | Adds digest: String to ContainerImage. |
| internal/graph/gengql/workloads.generated.go | Regenerates gqlgen code to expose ContainerImage.digest. |
| internal/graph/gengql/root_.generated.go | Regenerates schema/complexity plumbing for the new digest field. |
| integration_tests/vulnerability_digest_only.lua | New integration test asserting digest-only image behavior (tag == "", digest != null). |
| integration_tests/vulnerabilities.lua | Updates expectations to split tag vs digest in vulnerability summary responses. |
| integration_tests/k8s_resources/vulnerability/dev/slug-1/app.yaml | Keeps YAML document separator in the correct place while retaining tag+digest image input. |
| integration_tests/k8s_resources/vulnerability_digest_only/dev/slug-1/app.yaml | Adds digest-only workload resource fixture. |
| integration_tests/instance_groups.lua | Extends GraphQL selection/expectations to include digest for instance group images. |
Files not reviewed (1)
- internal/graph/gengql/workloads.generated.go: Generated file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ContainerImageTesting
rtk go test ./internal/workload ./internal/vulnerability✅