Compare commits

..

No commits in common. "f27d140a633b8a777da03ad1d1f21c0e76155eb8" and "bd2683b7224aba4848c86d90d957fe149eb0f3f2" have entirely different histories.

4 changed files with 11 additions and 196 deletions

View file

@ -4,7 +4,7 @@
[dda.build.devops.domain :as d] [dda.build.devops.domain :as d]
[dda.c4k-common.predicate :as pred])) [dda.c4k-common.predicate :as pred]))
(s/def ::c4k-output-filename string?) (s/def ::c4k-output-filenname string?)
(s/def ::autoapply boolean?) (s/def ::autoapply boolean?)
(s/def ::sensitive boolean?) (s/def ::sensitive boolean?)
@ -28,7 +28,7 @@
(s/def ::config (s/def ::config
(s/keys :req-un [::d/name ::d/stage ::d/project-root-path ::d/build-dir-name ::d/debug (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-filename ::autoapply ::c4k-config-filename ::c4k-auth-filename] ::d/dry-run ::d/module ::c4k-output-filenname ::autoapply ::c4k-config-filename ::c4k-auth-filename]
:opt-un [])) :opt-un []))
(defn-spec config-path string? (defn-spec config-path string?
@ -52,15 +52,15 @@
(defn-spec c4k-uberjar-command seq? (defn-spec c4k-uberjar-command seq?
[config ::config] [config ::config]
(let [{:keys [name]} config (let [{:keys [module]} config
executable-name (str "c4k-" name "-standalone.jar")] executable-name (str "c4k-" module "-standalone.jar")]
["bash" "-c" (str executable-name " " (config-path config) " " (auth-path config) " > " (output-path config))])) [["bash" "-c" (str executable-name " " (config-path config) " " (auth-path config) " > " (output-path config))]]))
(defn-spec c4k-graalvm-command seq? (defn-spec c4k-graalvm-command seq?
[config ::config] [config ::config]
(let [{:keys [name]} config (let [{:keys [module]} config
executable-name (str "c4k-" name)] executable-name (str "c4k-" module)]
["bash" "-c" (str executable-name " " (config-path config) " " (auth-path config) " > " (output-path config))])) [["bash" "-c" (str executable-name " " (config-path config) " " (auth-path config) " > " (output-path config))]]))
(defn-spec create-c4k-config map? (defn-spec create-c4k-config map?
[config ::config [config ::config

View file

@ -16,9 +16,8 @@
(s/def ::k3s-provision-user pred/bash-env-string?) (s/def ::k3s-provision-user pred/bash-env-string?)
(s/def ::config (s/def ::config
(s/keys :req-un [::d/name ::d/stage ::d/project-root-path ::d/build-dir-name ::d/debug (s/keys :req-un [::d/name ::d/stage ::d/project-root-path ::d/build-dir-name ::d/debug
::d/dry-run ::c4k-d/c4k-output-filename ::d/dry-run ::d/module ::c4k-d/c4k-output-filenname
::email ::echo ::k3s-output-filename ::k3s-provision-user] ::email ::echo ::k3s-output-filename ::k3s-provision-user]))
:opt-un [::d/module]))
(s/def ::node (s/def ::node
(s/keys :req-un [::ipv4 ::ipv6])) (s/keys :req-un [::ipv4 ::ipv6]))
(s/def ::letsencryptEndpoint pred/letsencrypt-issuer?) (s/def ::letsencryptEndpoint pred/letsencrypt-issuer?)
@ -37,7 +36,7 @@
tf-out ::c4k-d/tf-out] tf-out ::c4k-d/tf-out]
(let [{:keys [k3s-output-filename k3s-provision-user]} config (let [{:keys [k3s-output-filename k3s-provision-user]} config
fqdn (get-in tf-out [:out :value :fqdn])] 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? (defn-spec create-k3s-config map?
[config ::config [config ::config

View file

@ -1,129 +0,0 @@
(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"}))))

View file

@ -1,55 +0,0 @@
(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 "::"}}}))))