From c8265a38e4102d1c3f146eb241e0066d829f73b0 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Tue, 18 Dec 2018 22:04:34 +0100 Subject: [PATCH 1/2] add joshavgde pipeline --- src/wanijo_pipeline/core.clj | 13 +++++++++++-- src/wanijo_pipeline/joshavgde_pipeline.clj | 21 +++++++++++++++++++++ src/wanijo_pipeline/ui_selection.clj | 11 +++++++---- 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 src/wanijo_pipeline/joshavgde_pipeline.clj diff --git a/src/wanijo_pipeline/core.clj b/src/wanijo_pipeline/core.clj index 99db057..191d538 100644 --- a/src/wanijo_pipeline/core.clj +++ b/src/wanijo_pipeline/core.clj @@ -3,7 +3,8 @@ [wanijo-pipeline [wanijo-pipeline :as wp] [formulare-pipeline :as fp] - [wedder-pipeline :as wdp]] + [wedder-pipeline :as wdp] + [joshavgde-pipeline :as jvgde]] [wanijo-pipeline.ui-selection :as ui-selection] [org.httpkit.server :as http-kit] [lambdacd.runners :as runners] @@ -33,17 +34,25 @@ {:home-dir (home-dir "wedder") :name "wedder pipeline"})) +(defn joshavgde-pipeline [] + (lambdacd/assemble-pipeline jvgde/pipeline-def + {:home-dir (home-dir "joshavgde") + :name "joshavgde pipeline"})) + (defn -main [& args] (let [wanijo-pipeline (wanijo-pipeline) formulare-pipeline (formulare-pipeline) wedder-pipeline (wedder-pipeline) + joshavgde-pipeline (joshavgde-pipeline) app (ui-selection/ui-routes wanijo-pipeline formulare-pipeline - wedder-pipeline)] + wedder-pipeline + joshavgde-pipeline)] ;; this starts the pipeline and runs one build after the other. ;; there are other runners and you can define your own as well. (runners/start-one-run-after-another wanijo-pipeline) (runners/start-one-run-after-another formulare-pipeline) (runners/start-one-run-after-another wedder-pipeline) + (runners/start-one-run-after-another joshavgde-pipeline) ;; start the webserver to serve the UI (http-kit/run-server app {:port 30500}))) diff --git a/src/wanijo_pipeline/joshavgde_pipeline.clj b/src/wanijo_pipeline/joshavgde_pipeline.clj new file mode 100644 index 0000000..6637d2b --- /dev/null +++ b/src/wanijo_pipeline/joshavgde_pipeline.clj @@ -0,0 +1,21 @@ +(ns wanijo-pipeline.joshavgde-pipeline + (:use [lambdacd.steps.control-flow]) + (:require [lambdacd.steps.manualtrigger :as manualtrigger] + [lambdacd.steps.shell :as lcd-shell] + [lambdacd-git.core :as lcd-git])) + +(defn pull [args ctx] + (lcd-shell/bash ctx "/opt/wedder" "git pull")) + +(defn render [args ctx] + (lcd-shell/bash ctx "/opt/wedder" "lein equilibrium render")) + +(defn deploy [args ctx] + (lcd-shell/bash ctx (:cwd args) "lein equilibrium deploy")) + +(def pipeline-def + `(manualtrigger/wait-for-manual-trigger + (with-workspace + pull + render + deploy))) diff --git a/src/wanijo_pipeline/ui_selection.clj b/src/wanijo_pipeline/ui_selection.clj index 81535f9..4779f76 100644 --- a/src/wanijo_pipeline/ui_selection.clj +++ b/src/wanijo_pipeline/ui_selection.clj @@ -16,14 +16,17 @@ [:ul [:li [:a {:href "./wanijo/lambdaui/index.html"} "Wanijo"]] [:li [:a {:href "./formulare/lambdaui/index.html"} "Formulare"]] - [:li [:a {:href "./wedder/lambdaui/index.html"} "Wedder"]]]]])) + [:li [:a {:href "./wedder/lambdaui/index.html"} "Wedder"]] + [:li [:a {:href "./joshavgde/lambdaui/index.html"} "joshavg.de"]]]]])) -(defn ui-routes [wanijo formulare wedder] +(defn ui-routes [wanijo formulare wedder joshavgde] (let [wanijo-app (lambdaui/ui-for wanijo :contextPath "/wanijo") formulare-app (lambdaui/ui-for formulare :contextPath "/formulare") - wedder-app (lambdaui/ui-for wedder :contextPath "/wedder")] + wedder-app (lambdaui/ui-for wedder :contextPath "/wedder") + joshavgde-app (lambdaui/ui-for joshavgde :contextPath "/joshavgde")] (routes (GET "/" [] (ui-selection)) (context "/wanijo" [] wanijo-app) (context "/formulare" [] formulare-app) - (context "/wedder" [] wedder-app)))) + (context "/wedder" [] wedder-app) + (context "/joshavgde" [] joshavgde-app)))) From cd8412285c09f0481818091320d1893f5c054d65 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Tue, 18 Dec 2018 22:11:29 +0100 Subject: [PATCH 2/2] fix joshavgde pipeline --- src/wanijo_pipeline/joshavgde_pipeline.clj | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/wanijo_pipeline/joshavgde_pipeline.clj b/src/wanijo_pipeline/joshavgde_pipeline.clj index 6637d2b..fce1c61 100644 --- a/src/wanijo_pipeline/joshavgde_pipeline.clj +++ b/src/wanijo_pipeline/joshavgde_pipeline.clj @@ -4,18 +4,31 @@ [lambdacd.steps.shell :as lcd-shell] [lambdacd-git.core :as lcd-git])) -(defn pull [args ctx] - (lcd-shell/bash ctx "/opt/wedder" "git pull")) +(def repo-uri "https://gitea.heevyis.ninja/josha/equilibrium.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 render [args ctx] - (lcd-shell/bash ctx "/opt/wedder" "lein equilibrium render")) + (lcd-shell/bash ctx (:cwd args) "lein equilibrium render")) (defn deploy [args ctx] (lcd-shell/bash ctx (:cwd args) "lein equilibrium deploy")) (def pipeline-def - `(manualtrigger/wait-for-manual-trigger + `((either + manualtrigger/wait-for-manual-trigger + wait-for-repo) (with-workspace - pull + clone render deploy)))