From ca3e3fcf7e66554d20acd990a506d6ee5e368ca1 Mon Sep 17 00:00:00 2001 From: John Howard Date: Wed, 13 Jun 2018 09:33:19 -0700 Subject: [PATCH] Don't fail to start daemon if builder source is not available Signed-off-by: John Howard --- builder/builder-next/worker/worker.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/builder/builder-next/worker/worker.go b/builder/builder-next/worker/worker.go index 0089b39e6c..28e16368ce 100644 --- a/builder/builder-next/worker/worker.go +++ b/builder/builder-next/worker/worker.go @@ -37,6 +37,7 @@ import ( digest "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" + "github.com/sirupsen/logrus" ) // Opt defines a structure for creating a worker. @@ -77,32 +78,33 @@ func NewWorker(opt Opt) (*Worker, error) { CacheAccessor: cm, MetadataStore: opt.MetadataStore, }) - if err != nil { - return nil, err + if err == nil { + sm.Register(gs) + } else { + logrus.Warnf("Could not register builder git source: %s", err) } - sm.Register(gs) - hs, err := http.NewSource(http.Opt{ CacheAccessor: cm, MetadataStore: opt.MetadataStore, Transport: opt.Transport, }) - if err != nil { - return nil, err + if err == nil { + sm.Register(hs) + } else { + logrus.Warnf("Could not register builder http source: %s", err) } - sm.Register(hs) - ss, err := local.NewSource(local.Opt{ SessionManager: opt.SessionManager, CacheAccessor: cm, MetadataStore: opt.MetadataStore, }) - if err != nil { - return nil, err + if err == nil { + sm.Register(ss) + } else { + logrus.Warnf("Could not register builder local source: %s", err) } - sm.Register(ss) return &Worker{ Opt: opt,