-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Hot reload crashes the skaffold dev #1769
Comments
skaffold dev
This should be fixed in master branch with #1735 |
Yes, sync doesn't crash now. But some reason it doesn't serve the changed code. I need to restart skaffold to see the changes. |
I had the same issue with the sync crashing and the current master branch build fixed it for me. But the sync process is not working correctly with subdirectories. I can see a file from say "./src/app/test.js" is copied to "./test.js" in the working directory of the pod. However, I expect the file to be placed within the exact same subdirectory. |
@stfnsch sync patterns should match Docker COPY rules, so to copy a file into a specific subdirectory you'll have to specify it like this in the skaffold.yaml: sync:
'*.js' : '/src/app' We recently found a bug in this & fixed it in the latest release, which may be why your files are being synced to unexpected (but, hopefully, now correct) locations. |
@priyawadhwa Thanks for your answer. So, if I have a javascript application with say 10 subdirectories (src/app/module1/, src/app/module2/, src/app/module3/, ...), do I need to setup the sync pattern for each of these directories to have the files synced to correct locations? sync:
'src/app/module1/*.js' : 'src/app/module1'
'src/app/module2/*.js' : 'src/app/module2'
'src/app/module3/*.js' : 'src/app/module3'
# ... Or is there a simpler way for this? What I don't like is that you have to add a sync pattern every time you create a new subdirectory (module) in your application. |
@stfnsch unfortunately that's correct, you'll need a sync pattern for each module to sync to the correct location. If you specify a relative path in the skaffold.yaml, it will be preprended by the current working directory of the image to generate an absolute path. You could simplify the skaffold.yaml a bit by changing the working directory in the image to
and then in the skaffold.yaml: sync:
'src/app/module1/*.js' : 'module1'
'src/app/module2/*.js' : 'module2'
'src/app/module3/*.js' : 'module3'
|
@priyawadhwa so there is no way of syncing a complete path with folder structure? We work on very large projects with 50+ directories in |
@Torsten85 Subtree sync is already in the current master, also see #1837 for details. |
@corneliusweig is correct, subtree sync works today in v0.26.0. you should be able to do something like sync:
'src/app/***': src/app and files should end up in their subdirectories where you'd expect. @dnmahendra @Torsten85 @stfnsch can you try on your projects and see if things are working for you? |
@nkubala It is working nicely! I really like this sync option. However, I think there is a small difference in terms of performance/speed between: sync:
'src/app/***': src/app and: sync:
'src/app/module1/*': src/app/module1 |
interesting, how small are we talking? 😄 i'd love to see some performance benchmarking around both sync and the watcher. it's worth mentioning that sync is currently going through a potential redesign from @corneliusweig, see #1844 for the full proposal and discussion. for now I think this issue is resolved though, so I'll close it. |
Expected behavior
Skaffold should watch and hot reload the source code changes
Actual behavior
Skaffold crashes immediately after changing the code.
Information
Steps to reproduce the behavior
cd rc-devops && skaffold dev -f skaffold.yaml
Not sure if I missing something here, any help would be much appreciated.
The text was updated successfully, but these errors were encountered: