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

fix: puling images when working with a remote repository (#9177) #9181

Merged
merged 3 commits into from
Nov 30, 2023

Conversation

3droj7
Copy link
Contributor

@3droj7 3droj7 commented Nov 18, 2023

Fixes: #9177

Description
If the skaffold is configured to use the cluster and not the local images, it will not pull the images locally.
If everything is cached it will move to deployment stage instead of unnecessarily downloading the images.

Follow-up Work
The code could be probably improved so there will be less duplicated code.

If the skaffold is configured to use the cluster and not the local images, it will not pull the images locally.
If everything is cached it will move to deployment stage instead of unnecessarily downloading the images.
Copy link

google-cla bot commented Nov 18, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ericzzzzzzz
Copy link
Contributor

ericzzzzzzz commented Nov 21, 2023

Hi @3droj7 , Thanks for the contribution, could you please fix the failing tests, you can run make unit-tests locally to verify your change.

@3droj7
Copy link
Contributor Author

3droj7 commented Nov 24, 2023

@ericzzzzzzz It appears that there are some issues in the tests themselves-
In the TestCacheFindMissing test, the function isLocalImage is mocked to return False. However, this seems contradictory. Given that latest.LocalBuild{TryImportMissing: true} implies the image should be local, not remote, this mock setup doesn't align with the expected behavior as per the definition. retrieve_test.go#L342

There's also an issue with ImageID returning an empty string which leads to a failure in the test, as the logic then defaults to building the image, as seen here lookup.go#L98.

Do you agree that there's an issue or maybe I missed something?
If there's a real problem I can fix the test but would like some help with mocking the ImageID. It would be really helpful if you can provide an example that already does that.

Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Attention: 295 lines in your changes are missing coverage. Please review.

Comparison is base (290280e) 70.48% compared to head (5b15710) 63.73%.
Report is 1071 commits behind head on main.

Files Patch % Lines
cmd/skaffold/app/cmd/exec.go 16.32% 40 Missing and 1 partial ⚠️
cmd/skaffold/app/cmd/filter.go 47.27% 22 Missing and 7 partials ⚠️
cmd/skaffold/app/cmd/lsp.go 28.12% 23 Missing ⚠️
cmd/skaffold/app/cmd/verify.go 23.33% 23 Missing ⚠️
cmd/skaffold/app/cmd/fix.go 51.16% 17 Missing and 4 partials ⚠️
cmd/skaffold/app/cmd/inspect_job_manifest_paths.go 60.00% 15 Missing and 1 partial ⚠️
cmd/skaffold/app/cmd/inspect_namespaces.go 50.00% 13 Missing and 1 partial ⚠️
...md/skaffold/app/cmd/inspect_config_dependencies.go 45.83% 12 Missing and 1 partial ⚠️
cmd/skaffold/app/cmd/lint.go 42.85% 12 Missing ⚠️
cmd/skaffold/app/cmd/inspect_build_env.go 60.71% 11 Missing ⚠️
... and 21 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9181      +/-   ##
==========================================
- Coverage   70.48%   63.73%   -6.75%     
==========================================
  Files         515      630     +115     
  Lines       23150    32464    +9314     
==========================================
+ Hits        16317    20692    +4375     
- Misses       5776    10184    +4408     
- Partials     1057     1588     +531     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@3droj7
Copy link
Contributor Author

3droj7 commented Nov 30, 2023

@ericzzzzzzz Hey, I fixed the tests. Can you please review it

@ericzzzzzzz ericzzzzzzz added the kokoro:run runs the kokoro jobs on a PR label Nov 30, 2023
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Nov 30, 2023
@ericzzzzzzz ericzzzzzzz merged commit 9376dc0 into GoogleContainerTools:main Nov 30, 2023
14 checks passed
ericzzzzzzz added a commit that referenced this pull request Feb 15, 2024
* Revert "fix(lookupRemote): fixed lookup.go lookupRemote to compare remote and cached digests (#9278)"

This reverts commit 9ff4546.

* Revert "fix: Scope Issue with the 'entry' variable when looking up remote images and tests additions (#9211)"

This reverts commit ffe769c.

* Revert "fix: puling images when working with a remote repository (#9177) (#9181)"

This reverts commit 9376dc0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When the image is remote and cached, skaffold tries to pull it locally and ignores the cache.
4 participants