add-hugo-build #5

Merged
gec merged 18 commits from add-hugo-build into main 2024-03-15 12:02:22 +00:00
4 changed files with 18 additions and 33 deletions
Showing only changes of commit 9e75c22337 - Show all commits

View file

@ -118,23 +118,23 @@
(-> (->
sorted-auth sorted-auth
(assoc-in [:websiteauths] (rest (sorted-auth :websiteauths)))) (assoc-in [:websiteauths] (rest (sorted-auth :websiteauths))))
(let [final-config (let [curr-flat-websiteconfig
(merge (merge
website-config-defaults website-config-defaults
(flatten-and-reduce-config sorted-config)) (flatten-and-reduce-config sorted-config))
name (web/replace-dots-by-minus (:unique-name final-config))] name (web/replace-dots-by-minus (:unique-name curr-flat-websiteconfig))]
(cm/concat-vec (cm/concat-vec
result result
(ns/generate (merge {:namespace name} final-config)) (ns/generate (merge {:namespace name} curr-flat-websiteconfig))
[(web/generate-nginx-deployment final-config) [(web/generate-nginx-deployment curr-flat-websiteconfig)
(web/generate-nginx-configmap final-config) (web/generate-nginx-configmap curr-flat-websiteconfig)
(web/generate-nginx-service final-config) (web/generate-nginx-service curr-flat-websiteconfig)
(web/generate-content-pvc final-config) (web/generate-content-pvc curr-flat-websiteconfig)
(web/generate-hash-state-pvc final-config) (web/generate-hash-state-pvc curr-flat-websiteconfig)
(web/generate-build-cron final-config) (web/generate-build-cron curr-flat-websiteconfig)
(web/generate-build-secret final-config (web/generate-build-configmap curr-flat-websiteconfig)
(flatten-and-reduce-auth auth))] (web/generate-build-secret (flatten-and-reduce-auth auth))]
(generate-ingress final-config))))))) (generate-ingress curr-flat-websiteconfig)))))))
(defn-spec k8s-objects cp/map-or-seq? (defn-spec k8s-objects cp/map-or-seq?
[config config? [config config?

View file

@ -104,7 +104,7 @@
#"REDIRECTS" #"REDIRECTS"
(generate-redirects config 2))))))) (generate-redirects config 2)))))))
; TODO add test ; TODO add test & add to build-cron env
(defn-spec generate-build-configmap pred/map-or-seq? (defn-spec generate-build-configmap pred/map-or-seq?
[config websiteconfig?] [config websiteconfig?]
(let [{:keys [unique-name (let [{:keys [unique-name
@ -127,12 +127,10 @@
forgejo-host forgejo-host
forgejo-repo forgejo-repo
repo-user)))))) repo-user))))))
; TODO: remove config
(defn-spec generate-build-secret pred/map-or-seq? (defn-spec generate-build-secret pred/map-or-seq?
[config websiteconfig? [auth websiteauth?]
auth websiteauth?] (let [{:keys [unique-name
(let [{:keys [unique-name]} config
{:keys [unique-name
authtoken]} auth authtoken]} auth
name (replace-dots-by-minus unique-name)] name (replace-dots-by-minus unique-name)]
(-> (->

View file

@ -131,7 +131,7 @@
(cut/flatten-and-reduce-auth (cut/sort-auth auth2))))) (cut/flatten-and-reduce-auth (cut/sort-auth auth2)))))
(deftest test-generate (deftest test-generate
(is (= 22 (is (= 24
(count (cut/generate (count (cut/generate
(yaml/load-as-edn "website-test/valid-config.yaml") (yaml/load-as-edn "website-test/valid-config.yaml")
(yaml/load-as-edn "website-test/valid-auth.yaml")))))) (yaml/load-as-edn "website-test/valid-auth.yaml"))))))

View file

@ -228,20 +228,7 @@
:labels {:app.kubernetes.part-of "test-io-website"}}, :labels {:app.kubernetes.part-of "test-io-website"}},
:data :data
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag=="}} {:AUTHTOKEN "YWJlZGpnYmFzZG9kag=="}}
(cut/generate-build-secret {:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"], (cut/generate-build-secret {:unique-name "test.io",
:forgejo-repo "repo",
:issuer "staging",
:branchname "main",
:unique-name "test.io",
:redirects [],
:forgejo-host "gitlab.de"
:repo-user "someuser",
:build-cpu-request "500m"
:build-cpu-limit "1700m"
:build-memory-request "256Mi"
:build-memory-limit "512Mi"
:volume-size "3"}
{:unique-name "test.io",
:authtoken "abedjgbasdodj"})))) :authtoken "abedjgbasdodj"}))))
(deftest should-generate-content-pvc (deftest should-generate-content-pvc