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 31 additions and 14 deletions
Showing only changes of commit 248c33613a - Show all commits

View file

@ -94,7 +94,6 @@
#(str "rewrite ^" (first %1) "\\$ " (second %1) " permanent;")
redirects))))
(defn-spec generate-nginx-configmap map?
[config websiteconfig?]
(let [{:keys [fqdns unique-name]} config
@ -114,20 +113,20 @@
(generate-redirects config 2)))))))
(defn-spec generate-build-secret pred/map-or-seq?
[config websiteconfig?
auth websiteauth?]
; TODO generate git path without username
; TODO add test
(defn-spec generate-build-configmap pred/map-or-seq?
[config websiteconfig?]
(let [{:keys [unique-name
forgejo-host
forgejo-repo
branchname]} config
{:keys [authtoken
username]} auth
name (replace-dots-by-minus unique-name)]
name (replace-dots-by-minus unique-name)
username "TODO"]
(->
(yaml/load-as-edn "website/build-secret.yaml")
(yaml/load-as-edn "website/build-configmap.yaml")
(replace-all-matching-prefixes "NAME" name)
(cm/replace-all-matching-values-by-new-value "TOKEN" (b64/encode authtoken))
(cm/replace-all-matching-values-by-new-value "REPOURL" (b64/encode
(generate-gitrepourl
forgejo-host
@ -140,6 +139,18 @@
forgejo-repo
username))))))
(defn-spec generate-build-secret pred/map-or-seq?
[config websiteconfig?
auth websiteauth?]
(let [{:keys [unique-name]} config
{:keys [authtoken
username]} auth
name (replace-dots-by-minus unique-name)]
(->
(yaml/load-as-edn "website/build-secret.yaml")
(replace-all-matching-prefixes "NAME" name)
(cm/replace-all-matching-values-by-new-value "TOKEN" (b64/encode authtoken)))))
(defn-spec generate-content-pvc map?
[config websiteconfig?]

View file

@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: build-configmap
namespace: NAME
labels:
app.kubernetes.part-of: NAME-website
data:
GITREPOURL: REPOURL
GITCOMMITURL: COMMITURL

View file

@ -7,5 +7,3 @@ metadata:
app.kubernetes.part-of: NAME-website
data:
AUTHTOKEN: TOKEN
GITREPOURL: REPOURL
GITCOMMITURL: COMMITURL

View file

@ -217,9 +217,7 @@
:namespace "test-io",
:labels {:app.kubernetes.part-of "test-io-website"}},
:data
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag==",
:GITREPOURL "aHR0cHM6Ly9naXRsYWIuZGUvYXBpL3YxL3JlcG9zL3NvbWV1c2VyL3JlcG8vYXJjaGl2ZS9tYWluLnppcA==",
:GITCOMMITURL "aHR0cHM6Ly9naXRsYWIuZGUvYXBpL3YxL3JlcG9zL3NvbWV1c2VyL3JlcG8vZ2l0L2NvbW1pdHMvSEVBRA=="}}
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag=="}}
(cut/generate-build-secret {:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
:forgejo-repo "repo",
:issuer "staging",