Skip to content
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

Support digest for input image in convertor #304

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

tianouya-db
Copy link
Contributor

@tianouya-db tianouya-db commented Sep 25, 2024

What this PR does / why we need it:

The userspace convertor requires an --input-tag to identify the image to convert (USERSPACE_CONVERTOR.md).

-i, --input-tag string          tag for image converting from (required)

This is sometimes inconvenient because:

  • A tag can be volatile
  • Sometimes the client has access to the digest but not the tags on the image to convert

This PR supports a parameter to specify the digest of the image to convert, as an enhancement.

-g, input-digest             digest for image converting from (required when input-tag is not set)

With this change, the command accepts either a tag (--input-tag) or a digest (--input-digest) to specify the image to convert.

Example usage with the digest parameter:

bin/convertor -r docker.io/overlaybd/redis -u user:pass -g sha256:309f99718ff2424f4ae5ebf0e46f7f0ce03058bf47d9061d1d66e4af53b70ffc -o 309f99718ff2424f4ae5ebf0e46f7f0ce03058bf47d9061d1d66e4af53b70ffc_obd

Manual test

I built the convertor locally, and ran it to convert an image with digest to verify it works:

sudo bin/convertor --mkfs --repository my.registry.com/repo --username <user>:<password>--input-digest sha256:ea1b8ca870974180c0f369eda3dbb529e06303ff8b519a237573002d7ed85bee --overlaybd 0.1-overlaybd

INFO[0000] building [Overlaybd - Native]  image...
INFO[0000] building tmp_conv/1--ea1b8ca870974180c0f369eda3dbb529e06303ff8b519a237573002d7ed85bee ...
INFO[0000] fetching manifest sha256:ea1b8ca870974180c0f369eda3dbb529e06303ff8b519a237573002d7ed85bee with type application/vnd.docker.distribution.manifest.v2+json
INFO[0002] downloaded layer 0
INFO[0002] mkfs for baselayer, vsize: 64 GB
INFO[0003] layer 0 committed, uuid: bce45ce6-13d3-4bff-6a34-04a4c2d56a5f, parent uuid:
INFO[0003] layer 0 converted
INFO[0007] layer 0 uploaded
INFO[0008] config uploaded
INFO[0009] manifest uploaded, sha256:2446e61a1ea59a980b96e6e1e32b639ac4be4a05b64cb45ee2c8b4bd7f9c038e
INFO[0009] convert finished
INFO[0009] converted to "my.registry.com/repo:0.1-overlaybd", digest: "sha256:2446e61a1ea59a980b96e6e1e32b639ac4be4a05b64cb45ee2c8b4bd7f9c038e"
INFO[0009] overlaybd build finished

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #284

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

Copy link
Contributor

@WaberZhuang WaberZhuang left a comment

Choose a reason for hiding this comment

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

LGTM

@liulanzheng liulanzheng added the ok-to-test Pull request is ok to run ci test label Sep 27, 2024
@liulanzheng
Copy link
Member

@yuchen0cc pls see the e2e failure

@yuchen0cc yuchen0cc merged commit 21384b9 into containerd:main Sep 27, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Pull request is ok to run ci test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support digest for input image in userspace converter
4 participants