Repository navigation
Expand file tree
/
Copy pathbb.edn
More file actions
45 lines (44 loc) · 3.3 KB
/
Copy pathbb.edn
File metadata and controls
45 lines (44 loc) · 3.3 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
42
43
44
45
; 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 resource-git artifact-local podman logger-local")
(t/scrun "rm bob-test-storage bob-test-queue resource-git artifact-local podman 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 --name podman --device /dev/fuse --security-opt seccomp=unconfined --security-opt apparmor=unconfined --security-opt label=disable --cap-add sys_admin --cap-add mknod -p 8080:8080 docker.io/mgoltzsche/podman:minimal podman system service -t 0 tcp://0.0.0.0:8080")
(t/crun "run -d -p 4223:4222 --name bob-test-storage --network bob-net docker.io/library/nats -js")
(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 resource-git -p 8000:8000 --network bob-net ghcr.io/bob-cd/resource-git")
(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 {"podman" "http://localhost:8080/v5.8.7/libpod/_ping"
"resource-git" "http://localhost:8000/ping"
"artifact-store" "http://localhost:8001/ping"
"logger-local" "http://localhost:8002/ping"
"nats" "tcp://127.0.0.1:4223"
"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 "Builds the docker images"
:task (shell "docker buildx build --push --platform linux/amd64,linux/arm64 -t ghcr.io/bob-cd/runner -f Containerfile .")}
clean {:doc "Cleans up"
:task (do (clojure "-T:build" "clean")
(shell "rm -rf .cpcache runner.jar")
(t/scrun "rmi ghcr.io/bob-cd/runner"))}}}