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

zarf tools registry pull doesn't seem to respect --platform in newer version #2571

Closed
WeaponX314 opened this issue May 31, 2024 · 2 comments · Fixed by #2609
Closed

zarf tools registry pull doesn't seem to respect --platform in newer version #2571

WeaponX314 opened this issue May 31, 2024 · 2 comments · Fixed by #2609
Labels
bug 🐞 Something isn't working

Comments

@WeaponX314
Copy link
Contributor

WeaponX314 commented May 31, 2024

Environment

Device and OS: amd64, RHEL 8
App version: 0.34.0
Kubernetes distro being used: k3s, but not relevant here
Other:

Steps to reproduce

  1. Download both zarf 0.33.0 and zarf 0.34.0 on an amd64 native Linux machine,
  2. Make both executable and run the following:
    $ ./zarf_v0.33.0_Linux_amd64 tools registry pull --platform linux/arm64 registry.k8s.io/pause:3.9 test-0.33.0.tar
    $ ./zarf_v0.34.0_Linux_amd64 tools registry pull --platform linux/arm64 registry.k8s.io/pause:3.9 test-0.34.0.tar

Expected result

-rw-r--r--. 1 root root 268288 May 31 12:21 test-0.33.0.tar
-rw-r--r--. 1 root root 268288 May 31 12:21 test-0.34.0.tar
And both image archives should contain arm64 versions

Actual Result

-rw-r--r--. 1 root root 268288 May 31 12:21 test-0.33.0.tar
-rw-r--r--. 1 root root 322048 May 31 12:21 test-0.34.0.tar

The size of 322048 happens to be the amd64 version of pause.

Visual Proof (screenshots, videos, text, etc)

Severity/Priority

Priority is up to you of course, my workaround for now is continue using 0.33.0. I have not tested 0.33.1/0.33.2 yet to see where it breaks.

Additional Context

Add any other context or screenshots about the technical debt here.

It's not just the pause image, seems to be any image, pause is just small and happened to be the first one I noticed. You can see it with nginx too for example which is a popular one:

$ ./zarf_v0.33.0_Linux_amd64 tools registry pull --platform linux/arm64 nginx nginx-0.33.0.tar
$ ./zarf_v0.34.0_Linux_amd64 tools registry pull --platform linux/arm64 nginx nginx-0.34.0.tar

-rw-r--r--. 1 root root 67664896 May 31 12:24 nginx-0.33.0.tar
-rw-r--r--. 1 root root 71000576 May 31 12:24 nginx-0.34.0.tar

@WeaponX314
Copy link
Contributor Author

Verified the issue is NOT present in 0.33.2. So this is a brand new issue with 0.34.0.

@phillebaba
Copy link
Member

I have verified that this is a regression caused by #2460. During the refactoring of image pulling the options slice was changed from a pointer to a a value. The problem here is that the arguments are evaluated immediately and due to how the platform options are populated these are run at a later time.

I will create a PR to fix this.

@phillebaba phillebaba added bug 🐞 Something isn't working and removed possible-bug 🐛 labels Jun 11, 2024
AustinAbro321 added a commit that referenced this issue Jun 11, 2024
## Description

During refactoring in #2460 we broke the option parameters for Crane.
Honestly I am not surprised that this has happened. The way that these
options are parsed and passed around are a threading mess. The issue is
that this seems to also be the method in which Crane does it. This
change reverts the specific pointer changes which caused the issue in
the first place.

This is one the reasons why I do not like Cobra. The use of init
functions and global variables are doomed to cause threading issues.
Reminds me of writing Java programs with Spring Boot.

## Related Issue

Fixes #2571 

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed

Co-authored-by: Austin Abro <37223396+AustinAbro321@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants