diff --git a/dda-devops-build.sh b/dda-devops-build.sh deleted file mode 100755 index 5e349e5..0000000 --- a/dda-devops-build.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bb - diff --git a/src/main/clj/dda/devops_build/devops.clj b/src/main/clj/dda/devops_build/devops.clj index baf0b3a..19551a5 100644 --- a/src/main/clj/dda/devops_build/devops.clj +++ b/src/main/clj/dda/devops_build/devops.clj @@ -9,7 +9,7 @@ (s/def ::project-root-path ::domain/project-root-path) (s/def ::build-dir-name ::domain/build-dir-name) -(s/def ::devops +(s/def ::devops (s/keys :req-un [::name] :opt-un [::module ::stage ::project-root-path ::build-dir-name])) diff --git a/src/main/clj/dda/devops_build/image.clj b/src/main/clj/dda/devops_build/image.clj index 5c334e2..602544f 100644 --- a/src/main/clj/dda/devops_build/image.clj +++ b/src/main/clj/dda/devops_build/image.clj @@ -5,7 +5,7 @@ [dda.devops-build.devops.domain :as dd] [dda.devops-build.image.domain :as domain])) -(def default +(def default (merge d/default {})) (defn-spec dbuild nil? diff --git a/src/main/clj/dda/devops_build/image/domain.clj b/src/main/clj/dda/devops_build/image/domain.clj index ca164d2..28c5ee4 100644 --- a/src/main/clj/dda/devops_build/image/domain.clj +++ b/src/main/clj/dda/devops_build/image/domain.clj @@ -8,7 +8,6 @@ (let [{:keys [name]} devops] ["cp" "-r" "image" (d/build-path devops)])) - (defn-spec dbuild-command seq? [devops ::d/devops] (let [{:keys [name]} devops] diff --git a/src/test/clj/dda/devops_build/devops/domain_test.clj b/src/test/clj/dda/devops_build/devops/domain_test.clj index e090e6a..b897e7d 100644 --- a/src/test/clj/dda/devops_build/devops/domain_test.clj +++ b/src/test/clj/dda/devops_build/devops/domain_test.clj @@ -1,32 +1,40 @@ (ns dda.devops-build.devops.domain-test (:require [clojure.test :refer [deftest is are testing run-tests]] + [clojure.spec.test.alpha :as st] [dda.devops-build.devops.domain :as cut])) +(st/instrument `cut/build-path) +(st/instrument `cut/create-build-dir-command) + (deftest should-calculate-build-path (is (= "../../target/dda-backup" (cut/build-path {:name "dda-backup" :project-root-path "../.." :build-dir-name "target" - :version "4.11.8-dev"}))) + :version "4.11.8-dev" + :stage "dev"}))) (is (= "../../target/dda/backup" (cut/build-path {:name "dda" :module "backup" :project-root-path "../.." :build-dir-name "target" - :version "4.11.8-dev"})))) + :version "4.11.8-dev" + :stage "dev"})))) (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"})))) + :version "4.11.8-dev" + :stage "dev"})))) (deftest should-calculate-create-build-dir-command (is (= ["mkdir" "-p" "../../target/dda-backup"] (cut/create-build-dir-command {:name "dda-backup" - :project-root-path "../.." - :build-dir-name "target" - :version "4.11.8-dev"})))) + :project-root-path "../.." + :build-dir-name "target" + :version "4.11.8-dev" + :stage "dev"})))) diff --git a/src/test/clj/dda/devops_build/image/domain_test.clj b/src/test/clj/dda/devops_build/image/domain_test.clj index 1331cbc..efdf8b9 100644 --- a/src/test/clj/dda/devops_build/image/domain_test.clj +++ b/src/test/clj/dda/devops_build/image/domain_test.clj @@ -1,14 +1,20 @@ (ns dda.devops-build.image.domain-test (:require [clojure.test :refer [deftest is are testing run-tests]] + [clojure.spec.test.alpha :as st] [dda.devops-build.image.domain :as cut])) +(st/instrument `cut/copy-image-command) +(st/instrument `cut/dbuild-command) + + (deftest should-calculate-copy-image-command (is (= ["cp" "-r" "image" "../../target/dda-backup"] (cut/copy-image-command {:name "dda-backup" - :project-root-path "../.." - :build-dir-name "target" - :version "4.11.8-dev"})))) + :project-root-path "../.." + :build-dir-name "target" + :version "4.11.8-dev" + :stage "dev"})))) (deftest should-calculate-dbuild-command (is (= ["docker" @@ -19,7 +25,8 @@ "../../target/dda-backup/image/Dockerfile" "../../target/dda-backup/image"] (cut/dbuild-command {:name "dda-backup" - :project-root-path "../.." - :build-dir-name "target" - :version "4.11.8-dev"})))) + :project-root-path "../.." + :build-dir-name "target" + :version "4.11.8-dev" + :stage "dev"}))))