-
Notifications
You must be signed in to change notification settings - Fork 487
feat(ontology): add Image/ImageManifestList labels to GCP and GitLab images #2337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…images Adds ontology labels to GCP Artifact Registry and GitLab container image entities to enable cross-registry unified queries, following the pattern established in PR #2318 for ECR images. Changes: - GCPArtifactRegistryContainerImage: conditional Image/ImageManifestList labels based on media_type - GCPArtifactRegistryPlatformImage: unconditional Image label (these are the actual platform-specific images within manifest lists) - GitLabContainerImage: conditional Image/ImageManifestList labels based on type field - New ontology mapping file for images This enables unified queries like: MATCH (img:Image) RETURN img.digest MATCH (ml:ImageManifestList)-[:CONTAINS_IMAGE]->(img:Image) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Kunaal Sikka <kunaal@subimage.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 5 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="cartography/models/gcp/artifact_registry/container_image.py">
<violation number="1" location="cartography/models/gcp/artifact_registry/container_image.py:87">
P1: Rule violated: **Tests and documentation quality**
Document the ontology mapping for GCPArtifactRegistryContainerImage in docs/root/modules/gcp/schema.md. The rule requires a `> **Ontology Mapping**:` note whenever a node adds ExtraNodeLabels, but the section for this node has none after adding Image/ImageManifestList labels.</violation>
</file>
<file name="cartography/models/gitlab/container_images.py">
<violation number="1" location="cartography/models/gitlab/container_images.py:109">
P1: Rule violated: **Tests and documentation quality**
Nodes that add ExtraNodeLabels must be documented in the module schema with an **Ontology Mapping** note. The new Image/ImageManifestList labels for GitLabContainerImage are not documented in docs/root/modules/gitlab/schema.md, violating the documentation requirement in the Tests and documentation quality rule.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| GitLabContainerImageContainsImageRel(), | ||
| ], | ||
| ) | ||
| extra_node_labels: ExtraNodeLabels = ExtraNodeLabels( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Rule violated: Tests and documentation quality
Nodes that add ExtraNodeLabels must be documented in the module schema with an Ontology Mapping note. The new Image/ImageManifestList labels for GitLabContainerImage are not documented in docs/root/modules/gitlab/schema.md, violating the documentation requirement in the Tests and documentation quality rule.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cartography/models/gitlab/container_images.py, line 109:
<comment>Nodes that add ExtraNodeLabels must be documented in the module schema with an **Ontology Mapping** note. The new Image/ImageManifestList labels for GitLabContainerImage are not documented in docs/root/modules/gitlab/schema.md, violating the documentation requirement in the Tests and documentation quality rule.</comment>
<file context>
@@ -104,3 +106,15 @@ class GitLabContainerImageSchema(CartographyNodeSchema):
GitLabContainerImageContainsImageRel(),
],
)
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
+ [
+ ConditionalNodeLabel(
</file context>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the missing ontology mapping documentation for GitLabContainerImage in docs/root/modules/gitlab/schema.md.
The node has conditional extra labels (Image and ImageManifestList) defined in the model at line 109, but these were not documented in the schema. I've added an "Ontology Mapping" note following the same pattern used by GCPArtifactRegistryContainerImage in the GCP schema.
Change made:
- Added ontology mapping documentation explaining that
GitLabContainerImagehas conditional extra labels:Imagefor single-platform images (type="image") andImageManifestListfor multi-architecture manifest lists (type="manifest_list")
PR: #2343
…#2342) ## Summary - Adds missing ontology mapping documentation for `GCPArtifactRegistryContainerImage` in the GCP schema docs - Documents the conditional `Image` and `ImageManifestList` extra labels that are applied based on media type - Follows the existing documentation pattern used for other nodes with `ExtraNodeLabels` ## Test plan - [x] Verify the documentation note follows the same format as other ontology mapping notes in schema.md - [ ] Review rendered markdown to ensure proper formatting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: cubic-dev-ai[bot] <1082092+cubic-dev-ai[bot]@users.noreply.github.com>
## Summary - Documents the `Image` and `ImageManifestList` extra labels for `GitLabContainerImage` in the schema documentation - Follows the same documentation pattern used by `GCPArtifactRegistryContainerImage` ## Test plan - [x] Documentation follows established pattern from GCP schema - [ ] Verify markdown renders correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: cubic-dev-ai[bot] <1082092+cubic-dev-ai[bot]@users.noreply.github.com>
jychp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Type of change
Summary
Adds ontology labels to GCP Artifact Registry and GitLab container image entities to enable cross-registry unified queries, following the pattern established in PR #2318 for ECR images.
Changes:
ImageImageManifestListImageImageImageManifestListWhy:
MATCH (img:Image))Example queries enabled:
Related issues or links
How was this tested?
make test_lintpassesmake testpasses (624 tests)Checklist
General
make test_lint).Proof of functionality
If you are changing a node or relationship
Notes for reviewers
This PR uses conditional labels for GCP based on
media_typefield rather than a simplifiedtypefield (like ECR/GitLab use). The media types are:Manifest list types →
ImageManifestList:application/vnd.docker.distribution.manifest.list.v2+jsonapplication/vnd.oci.image.index.v1+jsonSingle image types →
Image:application/vnd.docker.distribution.manifest.v2+jsonapplication/vnd.oci.image.manifest.v1+jsonGCPArtifactRegistryPlatformImagealways gets theImagelabel unconditionally because these nodes represent the actual platform-specific images within a manifest list (they have architecture, os, etc.).