|
|
@ -50,6 +50,16 @@ func isFileSupported(path string) bool {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func isTarball(path string) bool {
|
|
|
|
|
|
|
|
for _, ext := range tarfile.SupportedExtensions {
|
|
|
|
|
|
|
|
if strings.HasSuffix(path, ext) {
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (w *Watcher) HandleWatch(path string) error {
|
|
|
|
func (w *Watcher) HandleWatch(path string) error {
|
|
|
|
if err := w.watcher.Add(path); err != nil {
|
|
|
|
if err := w.watcher.Add(path); err != nil {
|
|
|
|
return errors.Wrap(err, fmt.Sprintf("failed to watch from %s directory: %v", path, err))
|
|
|
|
return errors.Wrap(err, fmt.Sprintf("failed to watch from %s directory: %v", path, err))
|
|
|
@ -129,6 +139,10 @@ func (w *Watcher) processNextEventForImages(ctx context.Context, cfg *config.Nod
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if isTarball(event.Name) {
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if err := w.processImageEvent(ctx, event, cfg, client, imageClient); err != nil {
|
|
|
|
if err := w.processImageEvent(ctx, event, cfg, client, imageClient); err != nil {
|
|
|
|
logrus.Errorf("Failed to process image event: %v", err)
|
|
|
|
logrus.Errorf("Failed to process image event: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -225,7 +239,6 @@ func (w *Watcher) processImageEvent(ctx context.Context, event fsnotify.Event, c
|
|
|
|
|
|
|
|
|
|
|
|
w.filesMap[event.Name] = info
|
|
|
|
w.filesMap[event.Name] = info
|
|
|
|
logrus.Debugf("File added to watcher controller: %s", event.Name)
|
|
|
|
logrus.Debugf("File added to watcher controller: %s", event.Name)
|
|
|
|
|
|
|
|
|
|
|
|
start := time.Now()
|
|
|
|
start := time.Now()
|
|
|
|
if err := preloadFile(ctx, cfg, client, imageClient, event.Name); err != nil {
|
|
|
|
if err := preloadFile(ctx, cfg, client, imageClient, event.Name); err != nil {
|
|
|
|
logrus.Errorf("Error encountered while importing %s: %v", event.Name, err)
|
|
|
|
logrus.Errorf("Error encountered while importing %s: %v", event.Name, err)
|
|
|
|