Only download pods when os.name / os.arch don't match (#1354)
This commit is contained in:
parent
dcae949496
commit
c97fb958dc
2 changed files with 11 additions and 4 deletions
|
|
@ -9,20 +9,20 @@
|
||||||
(defn load-pod [& args]
|
(defn load-pod [& args]
|
||||||
(apply pods/load-pod @ctx args))
|
(apply pods/load-pod @ctx args))
|
||||||
|
|
||||||
(defn load-pods-metadata [pods-map]
|
(defn load-pods-metadata [pods-map opts]
|
||||||
(reduce-kv
|
(reduce-kv
|
||||||
(fn [pod-namespaces pod-spec coord]
|
(fn [pod-namespaces pod-spec coord]
|
||||||
(merge pod-namespaces
|
(merge pod-namespaces
|
||||||
(condp #(contains? %2 %1) coord
|
(condp #(contains? %2 %1) coord
|
||||||
:version
|
:version
|
||||||
(pods/load-pod-metadata pod-spec
|
(pods/load-pod-metadata pod-spec
|
||||||
(merge {:cache true}
|
(merge opts {:cache true}
|
||||||
(select-keys coord [:version :cache])))
|
(select-keys coord [:version :cache])))
|
||||||
|
|
||||||
:path
|
:path
|
||||||
(pods/load-pod-metadata (-> @bb-edn :file io/file)
|
(pods/load-pod-metadata (-> @bb-edn :file io/file)
|
||||||
pod-spec
|
pod-spec
|
||||||
(merge {:cache true}
|
(merge opts {:cache true}
|
||||||
(select-keys coord [:path :cache])))
|
(select-keys coord [:path :cache])))
|
||||||
|
|
||||||
(throw (IllegalArgumentException.
|
(throw (IllegalArgumentException.
|
||||||
|
|
|
||||||
|
|
@ -741,6 +741,12 @@ Use bb run --help to show this help output.
|
||||||
|
|
||||||
(def pod-namespaces (volatile! {}))
|
(def pod-namespaces (volatile! {}))
|
||||||
|
|
||||||
|
(defn download-only?
|
||||||
|
"If we're preparing pods for another OS / arch, don't try to run them."
|
||||||
|
[]
|
||||||
|
(or (not= (System/getenv "OS_NAME") (System/getProperty "os.name"))
|
||||||
|
(not= (System/getenv "OS_ARCH") (System/getProperty "os.arch"))))
|
||||||
|
|
||||||
(defn exec [cli-opts]
|
(defn exec [cli-opts]
|
||||||
(binding [*unrestricted* true]
|
(binding [*unrestricted* true]
|
||||||
(sci/binding [core/warn-on-reflection @core/warn-on-reflection
|
(sci/binding [core/warn-on-reflection @core/warn-on-reflection
|
||||||
|
|
@ -859,7 +865,8 @@ Use bb run --help to show this help output.
|
||||||
sci-ctx (sci/init opts)
|
sci-ctx (sci/init opts)
|
||||||
_ (vreset! common/ctx sci-ctx)
|
_ (vreset! common/ctx sci-ctx)
|
||||||
_ (when-let [pods (:pods @common/bb-edn)]
|
_ (when-let [pods (:pods @common/bb-edn)]
|
||||||
(let [pod-metadata (pods/load-pods-metadata pods)]
|
(when-let [pod-metadata (pods/load-pods-metadata
|
||||||
|
pods {:download-only (download-only?)})]
|
||||||
(vreset! pod-namespaces pod-metadata)))
|
(vreset! pod-namespaces pod-metadata)))
|
||||||
preloads (some-> (System/getenv "BABASHKA_PRELOADS") (str/trim))
|
preloads (some-> (System/getenv "BABASHKA_PRELOADS") (str/trim))
|
||||||
[expressions exit-code]
|
[expressions exit-code]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue