-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbb.edn
More file actions
41 lines (40 loc) · 2.81 KB
/
bb.edn
File metadata and controls
41 lines (40 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
; Copyright 2018- Rahul De
;
; Use of this source code is governed by an MIT-style
; license that can be found in the LICENSE file or at
; https://opensource.org/licenses/MIT.
{:paths ["../tasks"]
:tasks {:requires ([tasks :as t])
cclean {:doc "Cleans up cluster containers"
:task (do (t/scrun "kill bob-test-storage bob-test-queue artifact-local logger-local")
(t/scrun "rm bob-test-storage bob-test-queue artifact-local logger-local")
(t/scrun "network rm -f bob-net")
(t/scrun "volume prune -f"))}
prep {:doc "Prepares the deps"
:task (do (clojure "-P" "-A:build")
(clojure "-P" "-M" "-A:test")
(clojure "-P"))}
test {:doc "Sets up the cluster and runs tests"
:task (try
(run 'cclean)
(t/scrun "network create bob-net")
(t/crun "run -d -p 2380:2379 --name bob-test-storage --network bob-net -e ETCD_NAME=bob-etcd -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 -e ETCD_ADVERTISE_CLIENT_URLS=http://bob-etcd.etcd:2379 quay.io/coreos/etcd:v3.6.8")
(t/crun "run -d --name bob-test-queue -p 5673:5672 -p 5552:5552 --network bob-net -e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS='-rabbitmq_stream advertised_host localhost' --entrypoint sh rabbitmq:management-alpine -c 'rabbitmq-plugins enable --offline rabbitmq_stream && rabbitmq-server'")
(t/crun "run -d --name artifact-local -p 8001:8001 --network bob-net ghcr.io/bob-cd/artifact-local")
(t/crun "run -d --name logger-local -p 8002:8002 --network bob-net ghcr.io/bob-cd/logger-local")
(println "Waiting for cluster readiness.")
(t/wait-for {"artifact-store" "http://localhost:8001/ping"
"logger-local" "http://localhost:8002/ping"
"etcd" "tcp://127.0.0.1:2380"
"rabbitmq" "tcp://127.0.0.1:5673"})
(t/crun "exec bob-test-queue rabbitmq-plugins enable rabbitmq_stream")
(apply shell "clojure -M:test" *command-line-args*)
(finally (run 'cclean)))}
compile {:doc "Builds the compiled aritfact"
:task (clojure "-T:build" "uber")}
image {:doc "Build and push the docker image"
:task (shell "docker buildx build --push --platform linux/amd64,linux/arm64 -t ghcr.io/bob-cd/apiserver -f Containerfile .")}
clean {:doc "Cleans up"
:task (do (clojure "-T:build" "clean")
(shell "rm -rf .cpcache")
(t/scrun "rmi ghcr.io/bob-cd/apiserver"))}}}