Skip to content

Conversation

@kunaals
Copy link
Collaborator

@kunaals kunaals commented Feb 4, 2026

Type of change

  • New feature (non-breaking change that adds functionality)

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:

Node Ontology Label(s) Condition
GCPArtifactRegistryContainerImage Image media_type is Docker V2 or OCI manifest
GCPArtifactRegistryContainerImage ImageManifestList media_type is manifest list or OCI index
GCPArtifactRegistryPlatformImage Image Unconditional (actual platform images)
GitLabContainerImage Image type="image"
GitLabContainerImage ImageManifestList type="manifest_list"

Why:

Example queries enabled:

-- Find all images across registries
MATCH (img:Image)
RETURN img.digest, img.architecture

-- Find manifest lists and their platform images
MATCH (ml:ImageManifestList)-[:CONTAINS_IMAGE]->(img:Image)
RETURN ml.digest, img.architecture, img.os

Related issues or links

How was this tested?

  • make test_lint passes
  • make test passes (624 tests)
  • Verified schema imports and label configuration work correctly

Checklist

General

  • I have read the contributing guidelines.
  • The linter passes locally (make test_lint).
  • I have added/updated tests that prove my fix is effective or my feature works.

Proof of functionality

  • New or updated unit/integration tests.

If you are changing a node or relationship

Notes for reviewers

This PR uses conditional labels for GCP based on media_type field rather than a simplified type field (like ECR/GitLab use). The media types are:

Manifest list types → ImageManifestList:

  • application/vnd.docker.distribution.manifest.list.v2+json
  • application/vnd.oci.image.index.v1+json

Single image types → Image:

  • application/vnd.docker.distribution.manifest.v2+json
  • application/vnd.oci.image.manifest.v1+json

GCPArtifactRegistryPlatformImage always gets the Image label unconditionally because these nodes represent the actual platform-specific images within a manifest list (they have architecture, os, etc.).

…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>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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(
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 4, 2026

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>
Fix with Cubic

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 4, 2026

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 GitLabContainerImage has conditional extra labels: Image for single-platform images (type="image") and ImageManifestList for multi-architecture manifest lists (type="manifest_list")

PR: #2343

kunaals and others added 4 commits February 4, 2026 12:54
…#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>
Copy link
Collaborator

@jychp jychp left a comment

Choose a reason for hiding this comment

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

LGTM

@jychp jychp merged commit 74cb27a into master Feb 4, 2026
5 of 8 checks passed
@jychp jychp deleted the feat/ontology-image-labels-gcp-gitlab branch February 4, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants