Compare commits
4 commits
bd2683b722
...
f27d140a63
Author | SHA1 | Date | |
---|---|---|---|
f27d140a63 | |||
b6814110cb | |||
d164b55834 | |||
aa8e44a901 |
4 changed files with 196 additions and 11 deletions
|
@ -4,7 +4,7 @@
|
|||
[dda.build.devops.domain :as d]
|
||||
[dda.c4k-common.predicate :as pred]))
|
||||
|
||||
(s/def ::c4k-output-filenname string?)
|
||||
(s/def ::c4k-output-filename string?)
|
||||
(s/def ::autoapply boolean?)
|
||||
|
||||
(s/def ::sensitive boolean?)
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
(s/def ::config
|
||||
(s/keys :req-un [::d/name ::d/stage ::d/project-root-path ::d/build-dir-name ::d/debug
|
||||
::d/dry-run ::d/module ::c4k-output-filenname ::autoapply ::c4k-config-filename ::c4k-auth-filename]
|
||||
::d/dry-run ::d/module ::c4k-output-filename ::autoapply ::c4k-config-filename ::c4k-auth-filename]
|
||||
:opt-un []))
|
||||
|
||||
(defn-spec config-path string?
|
||||
|
@ -52,15 +52,15 @@
|
|||
|
||||
(defn-spec c4k-uberjar-command seq?
|
||||
[config ::config]
|
||||
(let [{:keys [module]} config
|
||||
executable-name (str "c4k-" module "-standalone.jar")]
|
||||
[["bash" "-c" (str executable-name " " (config-path config) " " (auth-path config) " > " (output-path config))]]))
|
||||
(let [{:keys [name]} config
|
||||
executable-name (str "c4k-" name "-standalone.jar")]
|
||||
["bash" "-c" (str executable-name " " (config-path config) " " (auth-path config) " > " (output-path config))]))
|
||||
|
||||
(defn-spec c4k-graalvm-command seq?
|
||||
[config ::config]
|
||||
(let [{:keys [module]} config
|
||||
executable-name (str "c4k-" module)]
|
||||
[["bash" "-c" (str executable-name " " (config-path config) " " (auth-path config) " > " (output-path config))]]))
|
||||
(let [{:keys [name]} config
|
||||
executable-name (str "c4k-" name)]
|
||||
["bash" "-c" (str executable-name " " (config-path config) " " (auth-path config) " > " (output-path config))]))
|
||||
|
||||
(defn-spec create-c4k-config map?
|
||||
[config ::config
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
(s/def ::k3s-provision-user pred/bash-env-string?)
|
||||
(s/def ::config
|
||||
(s/keys :req-un [::d/name ::d/stage ::d/project-root-path ::d/build-dir-name ::d/debug
|
||||
::d/dry-run ::d/module ::c4k-d/c4k-output-filenname
|
||||
::email ::echo ::k3s-output-filename ::k3s-provision-user]))
|
||||
::d/dry-run ::c4k-d/c4k-output-filename
|
||||
::email ::echo ::k3s-output-filename ::k3s-provision-user]
|
||||
:opt-un [::d/module]))
|
||||
(s/def ::node
|
||||
(s/keys :req-un [::ipv4 ::ipv6]))
|
||||
(s/def ::letsencryptEndpoint pred/letsencrypt-issuer?)
|
||||
|
@ -36,7 +37,7 @@
|
|||
tf-out ::c4k-d/tf-out]
|
||||
(let [{:keys [k3s-output-filename k3s-provision-user]} config
|
||||
fqdn (get-in tf-out [:out :value :fqdn])]
|
||||
[["provs-server.jar" "k3s" (str k3s-provision-user "@" fqdn) "-c" (output-path config) "-a" (c4k-d/output-path config)]]))
|
||||
["provs-server.jar" "k3s" (str k3s-provision-user "@" fqdn) "-c" (output-path config) "-a" (c4k-d/output-path config)]))
|
||||
|
||||
(defn-spec create-k3s-config map?
|
||||
[config ::config
|
||||
|
|
129
test/dda/build/c4k/domain_test.clj
Normal file
129
test/dda/build/c4k/domain_test.clj
Normal file
|
@ -0,0 +1,129 @@
|
|||
(ns dda.build.c4k.domain-test
|
||||
(:require
|
||||
[clojure.test :refer [deftest is]]
|
||||
[clojure.spec.test.alpha :as st]
|
||||
[dda.build.c4k.domain :as cut]))
|
||||
|
||||
(st/instrument `cut/config-path)
|
||||
(st/instrument `cut/auth-path)
|
||||
(st/instrument `cut/output-path)
|
||||
(st/instrument `cut/clean-build-dir-command)
|
||||
(st/instrument `cut/c4k-uberjar-command)
|
||||
(st/instrument `cut/c4k-graalvm-command)
|
||||
(st/instrument `cut/create-c4k-config)
|
||||
|
||||
(deftest should-calculate-config-path
|
||||
(is (= "../../target/dda-backup/config.yaml"
|
||||
(cut/config-path {:name "dda-backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"})))
|
||||
(is (= "../../target/dda/backup/config.yaml"
|
||||
(cut/config-path {:name "dda"
|
||||
:module "backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"}))))
|
||||
|
||||
(deftest should-calculate-auth-path
|
||||
(is (= "../../target/dda-backup/auth.yaml"
|
||||
(cut/auth-path {:name "dda-backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"})))
|
||||
(is (= "../../target/dda/backup/auth.yaml"
|
||||
(cut/auth-path {:name "dda"
|
||||
:module "backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"}))))
|
||||
|
||||
|
||||
(deftest should-calculate-output-path
|
||||
(is (= "../../target/dda-backup/out.yaml"
|
||||
(cut/output-path {:name "dda-backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"})))
|
||||
(is (= "../../target/dda/backup/out.yaml"
|
||||
(cut/output-path {:name "dda"
|
||||
:module "backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"}))))
|
||||
|
||||
(deftest should-calculate-clean-build-dir-command
|
||||
(is (= ["rm" "-rf" "../../target/dda-backup"]
|
||||
(cut/clean-build-dir-command {:name "dda-backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"}))))
|
||||
|
||||
(deftest should-calculate-c4k-uberjar-command
|
||||
(is (= ["bash" "-c" "c4k-dda-backup-standalone.jar ../../target/dda-backup/config.yaml ../../target/dda-backup/auth.yaml > ../../target/dda-backup/out.yaml"]
|
||||
(cut/c4k-uberjar-command {:name "dda-backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"}))))
|
||||
|
||||
(deftest should-calculate-c4k-graalvm-command
|
||||
(is (= ["bash" "-c" "c4k-dda-backup ../../target/dda-backup/config.yaml ../../target/dda-backup/auth.yaml > ../../target/dda-backup/out.yaml"]
|
||||
(cut/c4k-graalvm-command {:name "dda-backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-config-filename "config.yaml"
|
||||
:c4k-auth-filename "auth.yaml"
|
||||
:c4k-output-filename "out.yaml"}))))
|
||||
|
55
test/dda/build/provs/domain_test.clj
Normal file
55
test/dda/build/provs/domain_test.clj
Normal file
|
@ -0,0 +1,55 @@
|
|||
(ns dda.build.provs.domain-test
|
||||
(:require
|
||||
[clojure.test :refer [deftest is]]
|
||||
[clojure.spec.test.alpha :as st]
|
||||
[dda.build.provs.domain :as cut]))
|
||||
|
||||
(st/instrument `cut/output-path)
|
||||
(st/instrument `cut/provs-server-command)
|
||||
(st/instrument `cut/create-k3s-config)
|
||||
|
||||
(deftest should-calculate-output-path
|
||||
(is (= "../../target/dda-backup/k3s-out.yaml"
|
||||
(cut/output-path {:name "dda-backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-output-filename "out.yaml"
|
||||
:k3s-provision-user "root"
|
||||
:k3s-output-filename "k3s-out.yaml"
|
||||
:email "test@test.t"
|
||||
:echo false})))
|
||||
(is (= "../../target/dda/backup/k3s-out.yaml"
|
||||
(cut/output-path {:name "dda"
|
||||
:module "backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:c4k-output-filename "out.yaml"
|
||||
:k3s-provision-user "root"
|
||||
:k3s-output-filename "k3s-out.yaml"
|
||||
:email "test@test.t"
|
||||
:echo false}))))
|
||||
|
||||
(deftest should-calculate-provs-server-command
|
||||
(is (= ["provs-server.jar" "k3s" "root@test.test.de" "-c" "../../target/dda-backup/k3s-out.yaml" "-a" "../../target/dda-backup/out.yaml"]
|
||||
(cut/provs-server-command {:name "dda-backup"
|
||||
:project-root-path "../.."
|
||||
:build-dir-name "target"
|
||||
:version "4.11.8-dev"
|
||||
:stage "dev"
|
||||
:debug false
|
||||
:dry-run false
|
||||
:k3s-output-filename "k3s-out.yaml"
|
||||
:k3s-provision-user "root"
|
||||
:c4k-output-filename "out.yaml"
|
||||
:email "test@test.t"
|
||||
:echo false}
|
||||
{:out {:sensitive false :type [] :value {:fqdn "test.test.de" :ipv4 "127.0.0.1" :ipv6 "::"}}}))))
|
||||
|
Loading…
Reference in a new issue