-
Notifications
You must be signed in to change notification settings - Fork 2
Add support for imagefs and fix multi-stage cache probing #25
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
Changes from all commits
bc4a095
b98e540
e2ad0e6
83510bf
e585662
32937a1
a298d5a
0f87b47
da6fccd
0ef352d
7ed3388
5f3faef
d60cb01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -216,9 +216,10 @@ func TestCalculateDependencies(t *testing.T) { | |
| mockInitConfig func(partial.WithConfigFile, *config.KanikoOptions) (*v1.ConfigFile, error) | ||
| } | ||
| tests := []struct { | ||
| name string | ||
| args args | ||
| want map[int][]string | ||
| name string | ||
| args args | ||
| want map[int][]string | ||
| wantImage map[string][]string | ||
| }{ | ||
| { | ||
| name: "no deps", | ||
|
|
@@ -359,9 +360,27 @@ COPY --from=second /bar /bat | |
| 1: {"/bar"}, | ||
| }, | ||
| }, | ||
| { | ||
| name: "dependency from image", | ||
| args: args{ | ||
| dockerfile: ` | ||
| FROM scratch as target | ||
| COPY --from=alpine /etc/alpine-release /etc/alpine-release | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: have you tried implementing more tests?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I enabled the disabled |
||
| `, | ||
| }, | ||
| wantImage: map[string][]string{ | ||
| "alpine": {"/etc/alpine-release"}, | ||
| }, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| if tt.want == nil { | ||
| tt.want = map[int][]string{} | ||
| } | ||
| if tt.wantImage == nil { | ||
| tt.wantImage = map[string][]string{} | ||
| } | ||
| if tt.args.mockInitConfig != nil { | ||
| original := initializeConfig | ||
| defer func() { initializeConfig = original }() | ||
|
|
@@ -385,14 +404,18 @@ COPY --from=second /bar /bat | |
| } | ||
| stageNameToIdx := ResolveCrossStageInstructions(kanikoStages) | ||
|
|
||
| got, err := CalculateDependencies(kanikoStages, opts, stageNameToIdx) | ||
| got, gotImage, err := CalculateDependencies(kanikoStages, opts, stageNameToIdx) | ||
| if err != nil { | ||
| t.Errorf("got error: %s,", err) | ||
| } | ||
|
|
||
| if !reflect.DeepEqual(got, tt.want) { | ||
| diff := cmp.Diff(got, tt.want) | ||
| t.Errorf("CalculateDependencies() = %v, want %v, diff %v", got, tt.want, diff) | ||
| t.Errorf("CalculateDependencies() crossStageDependencies = %v, want %v, diff %v", got, tt.want, diff) | ||
| } | ||
| if !reflect.DeepEqual(gotImage, tt.wantImage) { | ||
| diff := cmp.Diff(gotImage, tt.wantImage) | ||
| t.Errorf("CalculateDependencies() imageDependencies = %v, wantImage %v, diff %v", gotImage, tt.wantImage, diff) | ||
mafredri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| }) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.