tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.73k stars 308 forks source link

Work around permissions errors when syncing/untarring files #2300

Open maiamcc opened 5 years ago

maiamcc commented 5 years ago

from @MattHodge:

Was having this error when live syncing, which is just tar's awful error when it doesn't have permissions:

etc/fun-facts/pgbouncer.supervisor.conf
etc/fun-facts/pgbouncer.userlist.txt
tar: etc/fun-facts/pgbouncer.userlist.txt: Cannot open: File exists
tar: etc/fun-facts/seelog.xml: Cannot open: File exists
tar: etc/fun-facts/test.ini: Cannot open: File exists
etc/fun-facts/seelog.xml
etc/fun-facts/test.ini
usr/local/bin/fun-facts
tar: usr/local/bin/fun-facts: Cannot open: File exists
tar: Exiting with failure status due to previous errors
got unexpected error during build/deploy: command terminated with exit code 2

Our container runs under a particular user but files baked into the image are using a different one

Tilt should have a way to work around permissions when sync'ing / be able to untar files as a specific user. Maybe the user can provide an optional custom "untar command"?

dbentley commented 5 years ago

My strawman was something like:

live_update=[ sync('foo', 'bar', untar_cmd='su user2; tar -xf /dev/stdin', rm_cmd='su user2; xargs rm') ]

(Times like this I wish tar had support for "this file was deleted")

markgarrigan commented 3 years ago

@nicks Do you know if there is a way to fix this? I'm diving in to remote builds using Kaniko and I'm running into this as well.

STEP 1/1 — updating image docker.repo1.uhc.com/optumiq_dsw/tilt/dss-updating-container
     Updating container: 96b62f9ec2
Will copy 1 file(s) to container: 96b62f9ec2
- '/Users/mgarriga/Development/dss/dss-updating/src/index.html' --> '/etc/nginx/html/index.html'
tar: etc/nginx/html/index.html: Cannot open: File exists
tar: Exiting with failure status due to previous errors

Live Update failed with unexpected error:
    command terminated with exit code 2
Falling back to a full image build + deploy
nicks commented 3 years ago

@markgarrigan here's the error message i added in v0.18.10:

108239836-4a9eb180-7118-11eb-9ce8-8621ab12e032

which suggests a couple possible fixes. does that help?