Skip to content

--use-local-mounts=true will fail#718

Open
tsujie wants to merge 1 commit into
slimtoolkit:masterfrom
tsujie:feature/FixLocalArtifactLocation
Open

--use-local-mounts=true will fail#718
tsujie wants to merge 1 commit into
slimtoolkit:masterfrom
tsujie:feature/FixLocalArtifactLocation

Conversation

@tsujie

@tsujie tsujie commented Oct 4, 2024

Copy link
Copy Markdown

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

kcq commented Oct 4, 2024

Copy link
Copy Markdown
Member

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

@tsujie

tsujie commented Oct 4, 2024 via email

Copy link
Copy Markdown
Author

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