Merge branch 'master' of https://gitea.heevyis.ninja/josha/wanijo-pipeline
commit
c94a3b3de5
@ -1,32 +1,37 @@
|
|||||||
(ns wanijo-pipeline.core
|
(ns wanijo-pipeline.core
|
||||||
(:require
|
(:require
|
||||||
[wanijo-pipeline.pipeline :as pipeline]
|
[wanijo-pipeline.pipeline :as pipeline]
|
||||||
[wanijo-pipeline.ui-selection :as ui-selection]
|
[wanijo-pipeline.ui-selection :as ui-selection]
|
||||||
[org.httpkit.server :as http-kit]
|
[org.httpkit.server :as http-kit]
|
||||||
[lambdacd.runners :as runners]
|
[lambdacd.runners :as runners]
|
||||||
[lambdacd.core :as lambdacd]
|
[lambdacd.core :as lambdacd]
|
||||||
[clojure.tools.logging :as log])
|
[clojure.tools.logging :as log]
|
||||||
|
[wanijo-pipeline.formulare-pipeline :as fp])
|
||||||
(:import (java.nio.file.attribute FileAttribute)
|
(:import (java.nio.file.attribute FileAttribute)
|
||||||
(java.nio.file Files LinkOption))
|
(java.nio.file Files LinkOption))
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
|
||||||
(defn- create-temp-dir []
|
(defn- home-dir [pipeline-name]
|
||||||
(str (Files/createTempDirectory "lambdacd" (into-array FileAttribute []))))
|
(str (System/getProperty "user.home") "/wanijo-pipeline/" pipeline-name))
|
||||||
|
|
||||||
|
(defn wanijo-pipeline []
|
||||||
|
(lambdacd/assemble-pipeline pipeline/pipeline-def
|
||||||
|
{:home-dir (home-dir "wanijo")
|
||||||
|
:name "wanijo pipeline"}))
|
||||||
|
|
||||||
|
(defn formulare-pipeline []
|
||||||
|
(lambdacd/assemble-pipeline fp/pipeline-def
|
||||||
|
{:home-dir (create-temp-dir "formulare")
|
||||||
|
:name "formulare pipeline"}))
|
||||||
|
|
||||||
(defn -main [& args]
|
(defn -main [& args]
|
||||||
(let [;; the home dir is where LambdaCD saves all data.
|
(let [wanijo-pipeline (wanijo-pipeline)
|
||||||
;; point this to a particular directory to keep builds around after restarting
|
formulare-pipeline (formulare-pipeline)
|
||||||
;; home-dir (create-temp-dir)
|
app (ui-selection/ui-routes wanijo-pipeline
|
||||||
home-dir (str (System/getProperty "user.home") "/wanijo-pipeline")
|
formulare-pipeline)]
|
||||||
config {:home-dir home-dir
|
|
||||||
:name "wanijo pipeline"}
|
|
||||||
;; initialize and wire everything together
|
|
||||||
pipeline (lambdacd/assemble-pipeline pipeline/pipeline-def config)
|
|
||||||
;; create a Ring handler for the UI
|
|
||||||
app (ui-selection/ui-routes pipeline)]
|
|
||||||
(log/info "LambdaCD Home Directory is " home-dir)
|
|
||||||
;; this starts the pipeline and runs one build after the other.
|
;; this starts the pipeline and runs one build after the other.
|
||||||
;; there are other runners and you can define your own as well.
|
;; there are other runners and you can define your own as well.
|
||||||
(runners/start-one-run-after-another pipeline)
|
(runners/start-one-run-after-another wanijo-pipeline)
|
||||||
|
(runners/start-one-run-after-another formulare-pipeline)
|
||||||
;; start the webserver to serve the UI
|
;; start the webserver to serve the UI
|
||||||
(http-kit/run-server app {:port 30500})))
|
(http-kit/run-server app {:port 30500})))
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
(ns wanijo-pipeline.formulare-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/formulare.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 "compile" args ctx))
|
||||||
|
|
||||||
|
(defn test [args ctx]
|
||||||
|
(lein "test" args ctx))
|
||||||
|
|
||||||
|
(defn deploy [args ctx]
|
||||||
|
(lein "deploy clojars" args ctx))
|
||||||
|
|
||||||
|
(def pipeline-def
|
||||||
|
`((either
|
||||||
|
manualtrigger/wait-for-manual-trigger
|
||||||
|
wait-for-repo)
|
||||||
|
(with-workspace
|
||||||
|
clone
|
||||||
|
compile
|
||||||
|
test
|
||||||
|
deploy)))
|
@ -1,30 +1,26 @@
|
|||||||
(ns wanijo-pipeline.ui-selection
|
(ns wanijo-pipeline.ui-selection
|
||||||
(:require
|
(:require
|
||||||
[hiccup.core :as h]
|
[hiccup.core :as h]
|
||||||
[lambdaui.core :as lambdaui]
|
[lambdaui.core :as lambdaui]
|
||||||
[lambdacd.ui.core :as reference-ui]
|
[lambdacd.ui.core :as reference-ui]
|
||||||
[compojure.core :refer [routes GET context]])
|
[compojure.core :refer [routes GET context]])
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
|
||||||
(defn- ui-selection []
|
(defn- ui-selection []
|
||||||
(h/html
|
(h/html
|
||||||
[:html
|
[:html
|
||||||
[:head
|
[:head
|
||||||
[:title "LambdaCD - UI Selection"]]
|
[:title "LambdaCD - UI Selection"]]
|
||||||
[:body
|
[:body
|
||||||
[:h1 "LambdaCD - UI Selection"]
|
[:h1 "LambdaCD - UI Selection"]
|
||||||
[:p "Two different UIs for LambdaCD exist: The reference-ui shipped with the core of LambdaCD and "
|
[:ul
|
||||||
[:a {:href "https://github.com/sroidl/lambda-ui"} "LambdaUI"]
|
[:li [:a {:href "./wanijo/lambdaui/index.html"} "Wanijo"]]
|
||||||
", a community developed, opinionated alternative with a more user friendly interface"]
|
[:li [:a {:href "./formulare/lambdaui/index.html"} "Formulare"]]]]]))
|
||||||
[:ul
|
|
||||||
[:li [:a {:href "./lambdaui/lambdaui/index.html"} "LambdaUI"]]
|
|
||||||
[:li [:a {:href "./reference/"} "Reference UI"]]]]]))
|
|
||||||
|
|
||||||
(defn ui-routes [pipeline]
|
(defn ui-routes [wanijo formulare]
|
||||||
(let [lambdaui-app (lambdaui/ui-for pipeline :contextPath "/lambdaui")
|
(let [wanijo-app (lambdaui/ui-for wanijo :contextPath "/wanijo")
|
||||||
referenceui-app (reference-ui/ui-for pipeline)]
|
formulare-app (lambdaui/ui-for formulare :contextPath "/formulare")]
|
||||||
(routes
|
(routes
|
||||||
(GET "/" [] (ui-selection))
|
(GET "/" [] (ui-selection))
|
||||||
(context "/lambdaui" [] lambdaui-app)
|
(context "/wanijo" [] wanijo-app)
|
||||||
(context "/reference" [] referenceui-app))))
|
(context "/formulare" [] formulare-app))))
|
||||||
|
|
||||||
|
Loading…
Reference in new issue