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

Excluding the .imgpkg folder of a bundle does not allow pushing as an image #29

Open
StevenLocke opened this issue Dec 9, 2020 · 2 comments
Labels
carvel accepted This issue should be considered for future work and that the triage process has been completed discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution enhancement This issue is a feature request good first issue An issue that will be a good candidate for a new contributor Hacktoberfest Issues that are ready for Hacktoberfest participants. priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. snack This issue has been identified as lightweight and potentially quick to deliver.

Comments

@StevenLocke
Copy link
Contributor

StevenLocke commented Dec 9, 2020

What steps did you take:
Create a bundle directory (bundle_dir) including the necessary .imgpkg dir and images.yml file
Attempt to push the bundle directory as an image
imgpkg push -i <repo> -f bundle_dir
Observe the expected error.

...consider using a bundle

Now, exclude the .imgpkg directory from the push command.
imgpkg push -i <repo> -f bundle_dir --file-exclude-defaults .imgpkg

What happened:
The same error.

...consider using a bundle

What did you expect:
The directory and its contents pushed as an image to the repo.

Unsure if this is a pathway we want to allow/encourage, it's a little strange to be pushing a bundle as an image, but I would expect the tool to respect my "exclude" choices.

Anything else you would like to add:
This happens because of where our excluded files are checked, only when making the tarball, after the image/bundle verification steps.

Environment:

  • imgpkg version (use imgpkg --version): imgpkg version 0.2.0
  • Docker registry used (e.g. Docker HUB): Any repo
  • OS (e.g. from /etc/os-release): Mac
@StevenLocke StevenLocke added bug This issue describes a defect or unexpected behavior discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution carvel triage This issue has not yet been reviewed for validity labels Dec 9, 2020
@joaopapereira
Copy link
Member

Given the help text of the --file-exclude-defaults flag, I would be inclined to say that if the flag is present and excludes the .imgpkg folder when pushing the image to the registry the folder should not be present.
But my expectation when trying to exclude .imgpkg folder is that I would get an error, since this is part of the imgpkg internals.

IMHO I believe what we should do is give a different error message when you try to exclude the .imgpkg folder using --file-exclude-defaults. Something in the lines of Error: The folder .imgpkg cannot be excluded.

In my research, for this issue, I found out that you can push a bundle and ignore the .imgpkg folder which is a problem and the solution that I propose above could solve it.
The example:

$ imgpkg push -b localhost:5000/test -f examples/basic-bundle --file-exclude-defaults .imgpkg
dir: .
file: config.yml
Pushed 'localhost:5000/test@sha256:319deaae5b3ce1633f14000f57144ebe1c73fbd4eb3d37874910335a92ab32ca'
Succeeded


$ imgpkg pull -b localhost:5000/test -o tmp
Pulling image 'localhost:5000/test@sha256:319deaae5b3ce1633f14000f57144ebe1c73fbd4eb3d37874910335a92ab32ca'
Extracting layer 'sha256:53484d40f83668beb17852cc4d95b4530fad5aca908446288136b75b6aa3e06b' (1/1)

Error: Rewriting image lock file: Reading image lock file: open tmp/.imgpkg/images.yml: no such file or directory

@danielhelfand
Copy link
Contributor

Agree with @joaopapereira that the error message for this specific case makes sense. It should be easy enough to catch if .imgpkg is part of the path included with --file-exclude-defaults and error out to explain to the user why not to do this.

@danielhelfand danielhelfand added carvel accepted This issue should be considered for future work and that the triage process has been completed and removed carvel triage This issue has not yet been reviewed for validity labels Dec 9, 2020
@aaronshurley aaronshurley added enhancement This issue is a feature request good first issue An issue that will be a good candidate for a new contributor priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. snack This issue has been identified as lightweight and potentially quick to deliver. and removed bug This issue describes a defect or unexpected behavior labels Aug 26, 2021
@DennisDenuto DennisDenuto added the Hacktoberfest Issues that are ready for Hacktoberfest participants. label Oct 6, 2021
@aaronshurley aaronshurley moved this to To Triage in Carvel Jul 25, 2022
@github-project-automation github-project-automation bot moved this to To Triage in Carvel Feb 14, 2023
@joaopapereira joaopapereira moved this from To Triage to Unprioritized in Carvel Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
carvel accepted This issue should be considered for future work and that the triage process has been completed discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution enhancement This issue is a feature request good first issue An issue that will be a good candidate for a new contributor Hacktoberfest Issues that are ready for Hacktoberfest participants. priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. snack This issue has been identified as lightweight and potentially quick to deliver.
Projects
Status: Unprioritized
Development

No branches or pull requests

5 participants