(ctx context.Context, target *Target, skew int)
| 612 | } |
| 613 | |
| 614 | func (hc *FetchitConfig) processKube(ctx context.Context, target *Target, skew int) { |
| 615 | time.Sleep(time.Duration(skew) * time.Millisecond) |
| 616 | target.mu.Lock() |
| 617 | defer target.mu.Unlock() |
| 618 | |
| 619 | kube := target.Methods.Kube |
| 620 | initial := kube.initialRun |
| 621 | tag := []string{"yaml", "yml"} |
| 622 | mo := &SingleMethodObj{ |
| 623 | Conn: hc.conn, |
| 624 | Method: kubeMethod, |
| 625 | Target: target, |
| 626 | } |
| 627 | |
| 628 | if initial { |
| 629 | err := hc.getClone(target) |
| 630 | if err != nil { |
| 631 | klog.Errorf("Failed to clone repo at %s for target %s: %v", target.Url, target.Name, err) |
| 632 | return |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | latest, err := hc.GetLatest(mo.Target) |
| 637 | if err != nil { |
| 638 | klog.Errorf("Failed to get latest commit: %v", err) |
| 639 | return |
| 640 | } |
| 641 | |
| 642 | current, err := hc.GetCurrent(mo.Target, mo.Method) |
| 643 | if err != nil { |
| 644 | klog.Errorf("Failed to get current commit: %v", err) |
| 645 | return |
| 646 | } |
| 647 | |
| 648 | if latest != current { |
| 649 | err = hc.Apply(ctx, mo, current, latest, mo.Target.Methods.Kube.TargetPath, &tag) |
| 650 | if err != nil { |
| 651 | klog.Errorf("Failed to apply changes: %v", err) |
| 652 | return |
| 653 | } |
| 654 | |
| 655 | hc.UpdateCurrent(ctx, target, mo.Method, latest) |
| 656 | klog.Infof("Moved kube from %s to %s for target %s", current, latest, target.Name) |
| 657 | } else { |
| 658 | klog.Infof("No changes applied to target %s this run, kube currently at %s", target.Name, current) |
| 659 | } |
| 660 | |
| 661 | kube.initialRun = false |
| 662 | } |
| 663 | |
| 664 | func (hc *FetchitConfig) processClean(ctx context.Context, target *Target, skew int) { |
| 665 | time.Sleep(time.Duration(skew) * time.Millisecond) |
nothing calls this directly
no test coverage detected