Skip to content

Commit

Permalink
fix(initrd): Change detection priority
Browse files Browse the repository at this point in the history
Dockerfile > File > Directory > OCI Image

These are ordered by lightweightness and similarly to prevent
fallbacks; e.g. a Dockerfile is technically a file so ordering
a check for a file before a dockerfile first would result in the
Dockerfile being used verbatim (as opposed to being built).

Signed-off-by: Alexander Jung <[email protected]>
  • Loading branch information
nderjung committed Nov 19, 2024
1 parent 442234b commit f36a514
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions initrd/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
// New attempts to return the builder for a supplied path which
// will allow the provided ...
func New(ctx context.Context, path string, opts ...InitrdOption) (Initrd, error) {
if builder, err := NewFromFile(ctx, path, opts...); err == nil {
if builder, err := NewFromDockerfile(ctx, path, opts...); err == nil {
return builder, nil
} else if builder, err := NewFromDirectory(ctx, path, opts...); err == nil {
} else if builder, err := NewFromFile(ctx, path, opts...); err == nil {
return builder, nil
} else if builder, err := NewFromDockerfile(ctx, path, opts...); err == nil {
} else if builder, err := NewFromDirectory(ctx, path, opts...); err == nil {
return builder, nil
} else if builder, err := NewFromOCIImage(ctx, path, opts...); err == nil {
return builder, nil
Expand Down

0 comments on commit f36a514

Please sign in to comment.