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

can't create symlink to a file that does not exist #1270

Open
srenatus opened this issue Aug 15, 2024 · 0 comments
Open

can't create symlink to a file that does not exist #1270

srenatus opened this issue Aug 15, 2024 · 0 comments

Comments

@srenatus
Copy link

Now, for reasons (see the bottom) I had liked to create a symlink to a nonexistent file.

With a snippet like this,

paths:
  - path: /bin/xyz
    type: symlink
    source: /ko-app/abc

I ended up getting

Error: failed to build layer image for "arm64": failed to mutate paths: symlink mutation on /bin/xyz: chmod "/bin/xyz": file does not exist

A workaround (suggested by @mattmoor, thanks!) is to add an empty-file, too:

paths:
  - path: /ko-app/abc
    type: empty-file
  - path: /bin/xyz
    type: symlink
    source: /ko-app/abc

Why?! 😮

I wanted to use apko to build a base image for use with ko. But we also needed the ko-built binary to have a (few) different name(s), so symlinks had to be added. In a unix-y system, you would use ln -sf to create a symlink to some target, which may or may not exist. I thus expected apko to work the same.

This workaround works nicely, though -- when using ko with the apko-built base image, the target (empty) file is replaced, and everything falls into place ✨

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

1 participant