Skip to content
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

[improvement sugestion] fail build fast for -dir (or create it) #3922

Open
weakcamel opened this issue Apr 26, 2023 · 1 comment
Open

[improvement sugestion] fail build fast for -dir (or create it) #3922

weakcamel opened this issue Apr 26, 2023 · 1 comment

Comments

@weakcamel
Copy link

weakcamel commented Apr 26, 2023

Description

Would be great if linuxkit verified input parameters or handled them in a more gracious way.

Steps to reproduce the issue:

$ time linuxkit build -format vmdk -dir output platform-vmware.yml
Extract kernel image: docker.io/linuxkit/kernel:5.10.104
Add init containers:
Process init image: docker.io/linuxkit/init:14df799bb3b9e0eb0491da9fda7f32a108a2e2a5
Process init image: docker.io/linuxkit/runc:436357ce16dd663e24f595bcec26d5ae476c998e
Process init image: docker.io/linuxkit/containerd:eeb3aaf497c0b3f6c67f3a245d61ea5a568ca718
Process init image: docker.io/linuxkit/ca-certificates:4de36e93dc87f7ccebd20db616ed10d381911d32
Add onboot containers:
  Create OCI config for linuxkit/sysctl:e5959517fab7b44692ad63941eecf37486e73799
Add service containers:
  Create OCI config for linuxkit/getty:06f34bce0facea79161566d67345c3ea49965437
  Create OCI config for linuxkit/rngd:331294919ba6d953d261a2694019b659a98535a4
  Create OCI config for linuxkit/dhcpcd:2a8ed08fea442909ba10f950d458191ed3647115
  Create OCI config for nginx:1.13.8-alpine
Create outputs:
  output/platform-vmware.vmdk
FATA[0020] Error writing outputs: Error writing vmdk output: open output/platform-vmware.vmdk: no such file or directory
real	0m20.118s
user	0m26.201s
sys	0m2.044s

Describe the results you received:

When output dir doesn't exist, linuxkit works as usual and fails at the stage of writing out the output image.

Describe the results you expected:

It would be great if linuxkit did one of:

  • fail immediately (not after downloading all the images and processing them) if output dir doesn't exist, or
  • not fail and create the output directory automatically

At the very least it should document that in help message, i.e. say it has to be an existing directory:

$  linuxkit build -help
USAGE: linuxkit build [options] <file>[.yml] | -

Options:
[...]
  -cache value
    	Directory for caching and finding cached image, overrides env var LINUXKIT_CACHE (default /Users/waldekm/.linuxkit/cache)
[...]
  -dir string
    	Directory for output files, default current directory

Note that the -cache option silently creates the output dir.

Additional information you deem important (e.g. issue happens only occasionally):

@deitch
Copy link
Collaborator

deitch commented Apr 28, 2023

I see no issues with an os.MkdirAll(dir) for the target directory. Open a PR @weakcamel ? Just need to it around here

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

No branches or pull requests

2 participants