grim/tagpull

661a31198963
Parents 232236236f1a
Children 4f65422a6fcb
Fix a crash and a round the duration output down to seconds
  • +4 -4
    operator.go
  • +9 -1
    registry.go
  • --- a/operator.go Thu Jun 18 06:38:36 2020 -0500
    +++ b/operator.go Sun Jul 05 05:06:31 2020 -0500
    @@ -110,7 +110,7 @@
    log.Debugf(
    "%s will be checked in %s",
    name,
    - time.Until(lastCheck.Add(interval)),
    + time.Until(lastCheck.Add(interval)).Round(time.Second),
    )
    return nil
    @@ -144,7 +144,7 @@
    func (o *Operator) checkPod(pod corev1.Pod, images map[string]string) error {
    for _, container := range pod.Spec.Containers {
    - log.Debugf("checking %s/%s", pod.ObjectMeta.Namespace, pod.Name)
    + log.Debugf("checking pod %s/%s", pod.ObjectMeta.Namespace, pod.Name)
    if container.ImagePullPolicy != corev1.PullAlways {
    log.Warnf(
    @@ -189,9 +189,9 @@
    } else {
    log.Infof("cycled pod %s", pod.Name)
    }
    + } else {
    + log.Debugf("pod %s/%s is up to date", pod.ObjectMeta.Namespace, pod.Name)
    }
    -
    - break
    }
    }
    --- a/registry.go Thu Jun 18 06:38:36 2020 -0500
    +++ b/registry.go Sun Jul 05 05:06:31 2020 -0500
    @@ -1,6 +1,8 @@
    package main
    import (
    + "strings"
    +
    "github.com/heroku/docker-registry-client/registry"
    )
    @@ -10,10 +12,16 @@
    return "", err
    }
    + // make sure the repository doesn't have a tag
    + repository = strings.SplitN(repository, ":", 2)[0]
    +
    // disable the logger on the registry
    reg.Logf = func(format string, args ...interface{}) {}
    manifest, err := reg.ManifestV2(repository, tag)
    + if err != nil {
    + return "", err
    + }
    - return manifest.Config.Digest.String(), err
    + return manifest.Config.Digest.String(), nil
    }