parent
6163467536
commit
e60460a674
@ -0,0 +1,41 @@
|
|||||||
|
(ns wanijo-pipeline.wedder-pipeline
|
||||||
|
(:use [lambdacd.steps.control-flow])
|
||||||
|
(:require [lambdacd.steps.manualtrigger :as manualtrigger]
|
||||||
|
[lambdacd.steps.shell :as lcd-shell]
|
||||||
|
[lambdacd-git.core :as lcd-git]))
|
||||||
|
|
||||||
|
(def repo-uri "https://gitea.heevyis.ninja/josha/wedder.git")
|
||||||
|
(def repo-branch "master")
|
||||||
|
|
||||||
|
(defn wait-for-repo [args ctx]
|
||||||
|
(lcd-git/wait-for-git ctx
|
||||||
|
repo-uri
|
||||||
|
:ref (str "refs/heads/" repo-branch)))
|
||||||
|
|
||||||
|
(defn clone [args ctx]
|
||||||
|
(let [revision (:revision args)
|
||||||
|
cwd (:cwd args)
|
||||||
|
ref (or revision repo-branch)]
|
||||||
|
(lcd-git/clone ctx repo-uri ref cwd)))
|
||||||
|
|
||||||
|
(defn lein [target args ctx]
|
||||||
|
(lcd-shell/bash ctx (:cwd args) (str "lein " target)))
|
||||||
|
|
||||||
|
(defn compile [args ctx]
|
||||||
|
(lein "uberjar" args ctx))
|
||||||
|
|
||||||
|
(defn kill-previous [args ctx]
|
||||||
|
(lcd-shell/bash ctx "pkill -f wedder"))
|
||||||
|
|
||||||
|
(defn deploy [args ctx]
|
||||||
|
(lcd-shell/bash ctx "/opt/wedder" "nohup java -jar target/wedder-0.1.0-SNAPSHOT.jar"))
|
||||||
|
|
||||||
|
(def pipeline-def
|
||||||
|
`((either
|
||||||
|
manualtrigger/wait-for-manual-trigger
|
||||||
|
wait-for-repo)
|
||||||
|
(with-workspace
|
||||||
|
clone
|
||||||
|
compile
|
||||||
|
kill-previous
|
||||||
|
deploy)))
|
Loading…
Reference in new issue