8000 [WIP] store: extract artifact layers automatically by sohankunkerkar · Pull Request #9150 · cri-o/cri-o · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[WIP] store: extract artifact layers automatically #9150

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sohankunkerkar
Copy link
Member
< 8000 p dir="auto">I have used the following artifact for testing:

oras manifest fetch quay.io/sohankunkerkar/test-artifact:v1 --pretty
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "application/vnd.example.artifact",
  "config": {
    "mediaType": "application/vnd.oci.image.config.v1+json",
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
    "size": 2
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar+zstd",
      "digest": "sha256:790f90c6a85920d6b355c0c042f48cbeb4387ba5f536907e066f2c43ecdab02c",
      "size": 123,
      "annotations": {
        "org.opencontainers.image.title": "zstd.tar.zst"
      }
    }
  ],
  "annotations": {
    "org.opencontainers.image.created": "2025-04-23T19:57:41Z"
  }
}

Once we build the consensus on the approach, I will push this to the crio quay repo if feasible.

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #9132

Special notes for your reviewer:

Does this PR introduce a user-facing change?

store: extract artifact layers automatically based on compression algorithms

@sohankunkerkar sohankunkerkar requested a review from mrunalp as a code owner April 23, 2025 21:19
@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Apr 23, 2025
@openshift-ci openshift-ci bot requested review from hasan4791 and QiWang19 April 23, 2025 21:20
Copy link
Contributor
openshift-ci bot commented Apr 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sohankunkerkar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2025
@sohankunkerkar sohankunkerkar force-pushed the fix-tar-artifact branch 2 times, most recently from 301df78 to 8d4f6fc Compare April 23, 2025 21:37
@sohankunkerkar sohankunkerkar marked this pull request as draft April 23, 2025 21:38
Copy link
codecov bot commented Apr 23, 2025

Codecov Report

Attention: Patch coverage is 10.44776% with 120 lines in your changes missing coverage. Please review.

Project coverage is 46.83%. Comparing base (23bec10) to head (3c63062).
Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9150      +/-   ##
==========================================
- Coverage   47.00%   46.83%   -0.17%     
==========================================
  Files         161      161              
  Lines       23634    23732      +98     
==========================================
+ Hits        11108    11115       +7     
- Misses      11426    11515      +89     
- Partials     1100     1102       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
@@ -75,7 +75,7 @@ ARTIFACT_IMAGE="$ARTIFACT_REPO:singlefile"
crictl inspecti "${imageId:0:12}"

# shortname
crictl inspecti crio/artifact:singlefile
crictl inspecti sohankunkerkar/artifact:singlefile
Copy link
Member Author

Choose a reason for hiding this comment

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

$ oras manifest fetch quay.io/sohankunkerkar/artifact:singlefile --pretty
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "application/vnd.oci.empty.v1+json",
  "config": {
    "mediaType": "application/vnd.oci.empty.v1+json",
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
    "size": 2,
    "data": "e30="
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar",
      "digest": "sha256:a77e1fdc58b9e6eb5f240aec21015ea9ebaaed5c5fa0f3efa169fd9d64a7bf29",
      "size": 10240,
      "annotations": {
        "org.opencontainers.image.title": "artifact.txt"
      }
    }
  ],
  "annotations": {
    "org.opencontainers.image.created": "2025-04-24T02:37:33Z"
  }
}

Copy link
Member Author

Choose a reason for hiding this comment

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

For multiple-files:

oras manifest fetch quay.io/sohankunkerkar/artifact:multiplefiles   --pretty
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "application/vnd.oci.empty.v1+json",
  "config": {
    "mediaType": "application/vnd.oci.empty.v1+json",
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
    "size": 2,
    "data": "e30="
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar",
      "digest": "sha256:a77e1fdc58b9e6eb5f240aec21015ea9ebaaed5c5fa0f3efa169fd9d64a7bf29",
      "size": 10240,
      "annotations": {
        "org.opencontainers.image.title": "artifact.txt"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar",
      "digest": "sha256:b1f4119972d3636a5f27f91149d45c5e3021b10642c72f83fac30c4e69bd674f",
      "size": 10240,
      "annotations": {
        "org.opencontainers.image.title": "artifact.sh"
      }
    }
  ],
  "annotations": {
    "org.opencontainers.image.created": "2025-04-24T03:47:13Z"
  }
}

@@ -479,35 +483,113 @@ func (s *Store) BlobMountPaths(ctx context.Context, artifact *Artifact, sys *typ
return nil, fmt.Errorf("failed to get an image reference: %w", err)
}

extractDir := filepath.Join(s.rootPath, "extracted", artifact.Digest().Encoded())
Copy link
Member

Choose a reason for hiding this comment

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

unsure about this. is this a convention? is there a convention? seems odd to hardcode the path but I'm unsure about the alternative

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I tried changing that logic. Let me know how it feels.3c63062

Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
@openshift-ci openshift-ci bot added dco-signoff: no Indicates the PR's author has not DCO signed all their commits. and removed dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Apr 25, 2025
@openshift-ci openshift-ci bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. and removed dco-signoff: no Indicates the PR's author has not DCO signed all their commits. labels Apr 25, 2025
Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
}
defer blob.Close()

content, err := s.processLayerContent(l.MediaType, blob)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder which is better extracting when pulling or when mounting.
Images are extracted when it's pulled, aren't they? I think it'd be better to align with images.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 30, 2025
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support compressed artifact layers
4 participants
0