Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Provide --cache-repo as OCI image layout path#2250

Merged
imjasonh merged 3 commits intoGoogleContainerTools:mainfrom
natalieparellano:oci-layout-cache
Sep 28, 2022
Merged

Provide --cache-repo as OCI image layout path#2250
imjasonh merged 3 commits intoGoogleContainerTools:mainfrom
natalieparellano:oci-layout-cache

Conversation

@natalieparellano
Copy link
Copy Markdown

Description

Adds the ability to provide --cache-repo as an OCI image layout path to cache layers on disk.

This is useful if you want to avoid providing registry credentials to kaniko (when used together with --cache-dir.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Adds integration tests if needed.

See the contribution guide for more details.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Release Notes

  • kaniko adds the ability to provide --cache-repo as an OCI image layout path to cache layers on disk

Natalie Arellano added 2 commits September 15, 2022 16:29
- Adds cache.LayoutCache to implement cache.LayerCache interface
- When opts.CacheRepo has "oci:" prefix, instantiates a LayoutCache

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>

cacheFlag := "--cache=true"

for dockerfile := range d.TestCacheDockerfiles {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I may be missing something, but this function is called inside a for loop that also ranges over TestCacheDockerfiles.

testutil.CheckErrorAndDeepEqual(t, false, err, want, got)
}

var calledExecCommand = []bool{}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This was never getting mutated anywhere except setCalledFalse

}
CheckPushPermissions(&opts)
for i, shdCall := range test.ShouldCallExecCommand {
if i < len(calledExecCommand) && shdCall != calledExecCommand[i] {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Because calledExecCommand is never mutated, it is always 0 length, and this statement is always false; I wasn't exactly sure what this was originally supposed to be testing, but I added checkPushPermsCallCount to give some more coverage.

Copy link
Copy Markdown
Contributor

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

LGTM, some small nits that you can choose to ignore if you'd rather not.

Thanks for your patience, and sorry this took so long to get around to.

@natalieparellano
Copy link
Copy Markdown
Author

Thanks @imjasonh! I'll make the changes you suggested... will push up a new commit shortly.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@imjasonh imjasonh merged commit 4d077e2 into GoogleContainerTools:main Sep 28, 2022
@natalieparellano natalieparellano deleted the oci-layout-cache branch September 28, 2022 16:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants