Skip to content

Added OCI v1 support to image download file.#48533

Closed
jjimbo137 wants to merge 17 commits intomoby:masterfrom
jjimbo137:master
Closed

Added OCI v1 support to image download file.#48533
jjimbo137 wants to merge 17 commits intomoby:masterfrom
jjimbo137:master

Conversation

@jjimbo137
Copy link
Copy Markdown
Contributor

@jjimbo137 jjimbo137 commented Sep 19, 2024

- What I did
Added support for OCI v1 image support. Also fixed issue with chained jq commands where it wasn't accepting newline characters.
- How I did it
Added the OCI v1 media type tags to the acceptable download formats.
- How to verify it
Tested on registry-1 for 1 layer and multi-layer downloads. both worked and downloaded the docker images.

- Description for the changelog

Added OCI v1 image download support.

- A picture of a cute animal (not mandatory but encouraged)

Added additions to handle OCI container V1 format.  This added handling for the mediaType in both the manifest and layer sections.
Shortened to minimum code because OCI v1 is essentially equivalent to Docker v2.2 format.  Also fixed formatting issue with jq where it wouldn't accept newline  character in chained jq commands.
@thaJeztah
Copy link
Copy Markdown
Member

Thank you for contributing! It appears your commit message is missing a DCO sign-off,
causing the DCO check to fail.

We require all commit messages to have a Signed-off-by line with your name
and e-mail (see "Sign your work"
in the CONTRIBUTING.md in this repository), which looks something like:

Signed-off-by: YourFirsName YourLastName <[email protected]>

There is no need to open a new pull request, but to fix this (and make CI pass),
you need to amend the commit(s) in this pull request, and "force push" the amended
commit.

Unfortunately, it's not possible to do so through GitHub's web UI, so this needs
to be done through the git commandline.

You can find some instructions in the output of the DCO check (which can be found
in the "checks" tab on this pull request), as well as in the Moby contributing guide.

Steps to do so "roughly" come down to:

  1. Set your name and e-mail in git's configuration:

    git config --global user.name "YourFirstName YourLastName"
    git config --global user.email "[email protected]"

    (Make sure to use your real name (not your GitHub username/handle) and e-mail)

  2. Clone your fork locally

  3. Check out the branch associated with this pull request

  4. Sign-off and amend the existing commit(s)

    git commit --amend --no-edit --signoff

    If your pull request contains multiple commits, either squash the commits (if
    needed) or sign-off each individual commit.

  5. Force push your branch to GitHub (using the --force or --force-with-lease flags) to update the pull request.

Sorry for the hassle (I wish GitHub would make this a bit easier to do), and let me know if you need help or more detailed instructions!

@thaJeztah thaJeztah added dco/no Automatically set by a bot when one of the commits lacks proper signature area/contrib labels Sep 19, 2024
Copy link
Copy Markdown
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

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

A few nits/suggestions and a question 🙇 ❤️

Comment thread contrib/download-frozen-image-v2.sh Outdated
Comment thread contrib/download-frozen-image-v2.sh Outdated
Comment thread contrib/download-frozen-image-v2.sh Outdated
Comment thread contrib/download-frozen-image-v2.sh Outdated
Comment thread contrib/download-frozen-image-v2.sh Outdated
Comment thread contrib/download-frozen-image-v2.sh Outdated
jjimbo137 and others added 5 commits September 23, 2024 11:15
Updating per suggestion.

Co-authored-by: Tianon Gravi <[email protected]>
updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>
Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>
Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>
Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>
Updated per suggestions from merge review.
Removed redundant accept statements.

Signed-off-by: Jimbo Jones <[email protected]>
@jjimbo137
Copy link
Copy Markdown
Contributor Author

I think I just signed the commit and made all the updates. I'm not great with git yet. Thanks for sharing!

@jjimbo137 jjimbo137 closed this Sep 23, 2024
@jjimbo137 jjimbo137 reopened this Sep 23, 2024
@thaJeztah
Copy link
Copy Markdown
Member

Thanks! I see that the last commit has a sign-off, but there's now many commits in the PR. We generally squash commits so that there's only a single commit in the PR; can you squash the commits? Let me try outline the steps for that;

Assuming your "upstream" remote points to the upstream (https://github.com/moby/moby) repository and "origin" remote points to your fork, steps are as follows;

First fetch your remotes are up-to-date;

git fetch upstream
git fetch origin

Then start an interactive rebase on top of the "master" branch in "upstream" (upstream being the https://github.com/moby/moby repository);

git rebase --interactive upstream/master

The interactive rebase opens a temporary file in your default editor, which contains the list of commits in your PR, and allows you to tell git what to do with those commits as part of the rebase;

p fe967bdab3 Update download-frozen-image-v2.sh to include OCI containers
p 1673f5a212 Update download-frozen-image-v2.sh added OCI v1 support
p ba24b190de Update contrib/download-frozen-image-v2.sh
p 6a5411109f Update contrib/download-frozen-image-v2.sh
p e3fb8a8b7b Update contrib/download-frozen-image-v2.sh
p fded672057 Update contrib/download-frozen-image-v2.sh
p 86f86d60cb Update contrib/download-frozen-image-v2.sh
p 67252baac9 Update download-frozen-image-v2.sh
p 784f291e28 Update download-frozen-image-v2.sh

# Rebase 3cf65ec598..784f291e28 onto 3cf65ec598 (9 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# .....

You can edit this file to control what git will do with your changes; the first column in the list of commits indicates what you want to happen with that commit; it defaults to p ("pick"), which is to apply the commit as a separate commit. In this case, we want all the commits to be squashed with the first one.

To do so, change the first column of all the "commit" lines from p to s EXCEPT for the first one, which must remain pick (it's the commit that the other get squashed into);

p fe967bdab3 Update download-frozen-image-v2.sh to include OCI containers
s 1673f5a212 Update download-frozen-image-v2.sh added OCI v1 support
s ba24b190de Update contrib/download-frozen-image-v2.sh
s 6a5411109f Update contrib/download-frozen-image-v2.sh
s e3fb8a8b7b Update contrib/download-frozen-image-v2.sh
s fded672057 Update contrib/download-frozen-image-v2.sh
s 86f86d60cb Update contrib/download-frozen-image-v2.sh
s 67252baac9 Update download-frozen-image-v2.sh
s 784f291e28 Update download-frozen-image-v2.sh

After you modified those lines, save the file, and exit the editor; git will now perform the squash; it will open another editor, asking you to write the commit message for the combined commits;

# This is a combination of 9 commits.
# This is the 1st commit message:

Update download-frozen-image-v2.sh to include OCI containers

Added additions to handle OCI container V1 format.  This added handling for the mediaType in both the manifest and layer sections.
# This is the commit message #2:

Update download-frozen-image-v2.sh added OCI v1 support

Shortened to minimum code because OCI v1 is essentially equivalent to Docker v2.2 format.  Also fixed formatting issue with jq where it wo>
# This is the commit message #3:
...
...

You can remove all the lines you don't need for the commit message; comment-lines (lines starting with #) are ignored, but save to remove; I think the second commit has the most complete description, so I suggest using the content of that one, and keeping the "co-authored-by" and "signed-off-by";

Update download-frozen-image-v2.sh added OCI v1 support

Shortened to minimum code because OCI v1 is essentially equivalent to
Docker v2.2 format. Also fixed formatting issue with jq where it wouldn't
accept newline character in chained jq commands.

Co-authored-by: Tianon Gravi <[email protected]>
Signed-off-by: Jimbo Jones <[email protected]>

After you made your changes, safe the file, and exit your editor; git now completes the rebase;

...
...
Successfully rebased and updated refs/heads/jjimbo137-master.

These changes are only local on your machine, so now have to be pushed. Given that "rebase" and "squash" rewrites history, you need to "force push" your change.

jjimbo137 and others added 5 commits September 24, 2024 08:14
Shortened to minimum code because OCI v1 is essentially equivalent to Docker v2.2 format.  Also fixed formatting issue with jq where it wouldn't accept newline  character in chained jq commands.

Update contrib/download-frozen-image-v2.sh

Updating per suggestion.

Co-authored-by: Tianon Gravi <[email protected]>

Update contrib/download-frozen-image-v2.sh

updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>

Update contrib/download-frozen-image-v2.sh

Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>

Update contrib/download-frozen-image-v2.sh

Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>

Update contrib/download-frozen-image-v2.sh

Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>

Update download-frozen-image-v2.sh

Updated per suggestions from merge review.

Update download-frozen-image-v2.sh

Removed redundant accept statements.

Signed-off-by: Jimbo Jones <[email protected]>
Shortened to minimum code because OCI v1 is essentially equivalent to Docker v2.2 format.  Also fixed formatting issue with jq where it wouldn't accept newline  character in chained jq commands.

Co-authored-by: Tianon Gravi <[email protected]>

Updated per suggestions from merge review.

Removed redundant accept statements.

Signed-off-by: Jimbo Jones <[email protected]>

Update contrib/download-frozen-image-v2.sh

updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>

Update contrib/download-frozen-image-v2.sh

Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>

Update contrib/download-frozen-image-v2.sh

Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>

Update contrib/download-frozen-image-v2.sh

Updating per suggestion

Co-authored-by: Tianon Gravi <[email protected]>

Update download-frozen-image-v2.sh

Updated per suggestions from merge review.

Update download-frozen-image-v2.sh

Removed redundant accept statements.

Signed-off-by: Jimbo Jones <[email protected]>
@jjimbo137
Copy link
Copy Markdown
Contributor Author

jjimbo137 commented Sep 24, 2024

I just checked out my github fork, so don't have the upstream branch in it. I tried to squash by doing "git log download-fro...." and do a rebase -i from the first commit (fe967bd), but it seems to leave that one out after the squash. Not sure how to proceed.

jjimbo137 and others added 2 commits September 24, 2024 08:48
Shortened to minimum code because OCI v1 is essentially equivalent to Docker v2.2 format.  Also fixed formatting issue with jq where it wouldn't accept newline  character in chained jq commands.

Co-authored-by: Tianon Gravi <[email protected]>
Signed-off-by: Jimbo Jones <[email protected]>
@thaJeztah
Copy link
Copy Markdown
Member

I pushed a rebased and squashed version of your commits to #48546

@thaJeztah
Copy link
Copy Markdown
Member

This was merged as;

Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/contrib dco/no Automatically set by a bot when one of the commits lacks proper signature status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants