Skip to content

Commit

Permalink
Log credential retrieval only when verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
viesti committed May 23, 2020
1 parent 79dc1e0 commit 86b36bd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/mach/pack/alpha/jib.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
(def string-array (into-array String []))
(def target-dir "/app")

(def logger
(defn make-logger [verbose]
(reify java.util.function.Consumer
(accept [this log-event]
(println log-event))))
(when verbose
(println log-event)))))

(defn unique-base-path
"Creates a unique string from a path by joining path elements with `-`.
Expand Down Expand Up @@ -132,7 +133,7 @@
base-image-with-creds (-> (RegistryImage/named ^String base-image)
(.addCredentialRetriever (or
(explicit-credentials from-registry-username from-registry-password)
(-> (CredentialRetrieverFactory/forImage (ImageReference/parse base-image) logger)
(-> (CredentialRetrieverFactory/forImage (ImageReference/parse base-image) (make-logger verbose))
(.dockerConfig)))))]
(-> (cond-> (Jib/from base-image-with-creds)
include (.addLayer [(Paths/get (first (.split include ":")) string-array)]
Expand Down Expand Up @@ -163,7 +164,7 @@
:registry (-> (RegistryImage/named image-name)
(.addCredentialRetriever (or
(explicit-credentials to-registry-username to-registry-password)
(-> (CredentialRetrieverFactory/forImage (ImageReference/parse image-name) logger)
(-> (CredentialRetrieverFactory/forImage (ImageReference/parse image-name) (make-logger verbose))
(.dockerConfig)))))))
(seq additional-tags) (add-additional-tags additional-tags)
(not quiet) (.addEventHandler ProgressEvent (progress-bar-consumer))
Expand Down

0 comments on commit 86b36bd

Please sign in to comment.