introduce terragrunt

This commit is contained in:
Michael Jerger 2024-07-27 16:32:08 +02:00
parent ae5ccc60f1
commit e0b5eb0ee3
2 changed files with 38 additions and 7 deletions

View file

@ -1,9 +1,8 @@
(ns dda.build.terragrunt (ns dda.build.terragrunt
(:require [orchestra.core :refer [defn-spec]] (:require [orchestra.core :refer [defn-spec]]
[babashka.tasks :as t]
[dda.build.devops :as d] [dda.build.devops :as d]
[dda.build.devops.domain :as dd] [dda.build.terragrunt.domain :as domain]
[dda.build.terragrunt.domain :as dterra])) [dda.build.infrastructure :as i]))
(def default (def default
(merge d/default {})) (merge d/default {}))
@ -11,7 +10,7 @@
(defn-spec plan nil? (defn-spec plan nil?
[devops ::d/devops] [devops ::d/devops]
(let [final (merge default devops)] (let [final (merge default devops)]
(apply t/shell (dd/clean-build-dir-command final)) (i/execute (domain/clean-build-dir-command final) final)
(apply t/shell (dd/create-build-dir-command final)) (d/create-build-dir final)
(apply t/shell (dterra/copy-terragrunt-command final)) (i/execute (domain/copy-terragrunt-command final) final)
(apply t/shell (dterra/plan-command final)))) ))

View file

@ -0,0 +1,32 @@
(ns dda.build.terragrunt.domain-test
(:require
[clojure.test :refer [deftest is are testing run-tests]]
[clojure.spec.test.alpha :as st]
[dda.build.terragrunt.domain :as cut]))
(st/instrument `cut/clean-build-dir-command)
(st/instrument `cut/copy-terragrunt-command)
(deftest should-calculate-clean-build-dir-command
(is (= ["rm" "-rf" "../../target/test"]
(cut/clean-build-dir-command {:name "test"
:module "statistics"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false}))))
(deftest should-calculate-copy-terragrunt-command
(is (= ["cp" "." "../../target/test/statistics" "&&"
"cp" "statistics" "../../target/test/statistics"]
(cut/copy-terragrunt-command {:name "test"
:module "statistics"
:project-root-path "../.."
:build-dir-name "target"
:version "4.11.8-dev"
:stage "dev"
:debug false
:dry-run false}))))