Skip to content

Conversation

tsujie
Copy link

@tsujie tsujie commented Oct 4, 2024

pkg/app/master/command/build/image.go

Fixes-###

What

When I run slim build with --use-local-mounts=true and provide local state-path. Then the slim build will fail with error

cmd=build info=build.error status='optimized.image.build.error' error='no layers' 

Why

The reason is for local mounts, there is no files.tar file exits. Only the files folder exists. But the check is

dataDir := filepath.Join(imageInspector.ArtifactLocation, "files")
if fsutil.Exists(dataTar) && fsutil.IsDir(dataDir) {
  layerInfo := imagebuilder.LayerDataInfo{
	  Type:   imagebuilder.DirSource,
	  Source: dataDir,
	  Params: &imagebuilder.DataParams{
		  TargetPath: "/",
	  },
  }
  
  opts.Layers = append(opts.Layers, layerInfo)
  hasData = true
} else {
  logger.Info("WARNING - no data artifacts")
}

which will check if dataTar exists. In this case, it is false, so it will trigger the failure

How Tested

set --use-local-mounts=true and provide your local --state-path

@kcq
Copy link
Member

kcq commented Oct 4, 2024

@tsujie thanks a lot for the enhancement! Do you mind signing it and adding it here

@tsujie
Copy link
Author

tsujie commented Oct 4, 2024 via email

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

Successfully merging this pull request may close these issues.

3 participants