Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
patch from #135 that reproduces the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
flosell committed Oct 16, 2016
1 parent 5fa1273 commit 6afa77d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 9 deletions.
2 changes: 2 additions & 0 deletions dev-resources/first.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./second.sh
9 changes: 9 additions & 0 deletions dev-resources/second.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
echo "creating long output..."

for i in `seq 3000`;
do
OUTPUT="$OUTPUT\n$i) here is a very long line. Bacon ipsum dolor amet shankle kevin ball tip tenderloin burgdoggen jerky rump frankfurter"
done

echo -e $OUTPUT
5 changes: 2 additions & 3 deletions example/clj/todopipeline/pipeline.clj
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
;; uncomment this, run and see the magic happen (the first build will immediately run since there is no known state)
; wait-for-frontend-repo

; do-stuff
compare-screenshots
;; this step executes his child-steps (the arguments after the in-parallel) in parallel and waits
chaining-long-output

;; until all of them are done. if one of them fails, the whole step fails.
(alias "build and publish"
(in-parallel
Expand Down
49 changes: 43 additions & 6 deletions example/clj/todopipeline/steps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
(:require [lambdacd.steps.shell :as shell]
[lambdacd.steps.git :as git]
[lambdacd.steps.manualtrigger :as manualtrigger]
[lambdacd.steps.support :as support]))
[lambdacd.steps.support :as support :refer [injected-args injected-ctx]]
[clojure.java.io :as io]
))

;; Let's define some constants
(def backend-repo "[email protected]:flosell/todo-backend-compojure.git")
Expand Down Expand Up @@ -40,7 +42,42 @@
(git/checkout-and-execute backend-repo (:backend-revision args) args ctx steps)))

(defn wait-for-greeting [args ctx]
(manualtrigger/parameterized-trigger {:greeting { :desc "some greeting"}} ctx))
(manualtrigger/parameterized-trigger {:greeting {:desc "some greeting"}} ctx))

(defn prepare-failure1 [args ctx]
(let [home (:home-dir (:config ctx))
first-source (-> "first.sh" io/resource io/file)
second-source (-> "second.sh" io/resource io/file)
dest (fn [name] (io/file home name))
]
(io/copy first-source (dest "first.sh"))
(io/copy second-source (dest "second.sh"))
{:status :success :out (str "Copied '" first-source "' and '" second-source "' to '" (dest "") "'")}))

(defn prepare-failure [args ctx]
(let [home (:home-dir (:config ctx))
first-source (-> "build.sh" io/resource io/file)
second-source (-> "updatedependencies" io/resource io/file)
third-source (-> "package.json" io/resource io/file)
dest (fn [name] (io/file home name))
]
(io/copy first-source (dest "build.sh"))
(io/copy second-source (dest "updatedependencies"))
(io/copy third-source (dest "package.json"))
{:status :success :out (str "Copied '" first-source "' and '" second-source "' to '" (dest "") "'")}))

(defn run-failure [args ctx]
(let [home (:home-dir (:config ctx))
_ (shell/bash ctx home "chmod +x *")]
(shell/bash ctx home "./first.sh")
))

(defn chaining-long-output [args ctx]
(support/always-chaining args ctx
(prepare-failure1 injected-args injected-ctx)
(run-failure injected-args injected-ctx))
)


(defn demonstrate-ansi [args ctx]
(shell/bash ctx "/"
Expand Down Expand Up @@ -99,12 +136,12 @@
(defn server-test [{cwd :cwd} ctx]
(println "server test cwd: " cwd)
(shell/bash ctx cwd
"lein test"))
"lein test"))

(defn server-package [{cwd :cwd} ctx]
(println "server package cwd: " cwd)
(shell/bash ctx cwd
"lein uberjar"))
"lein uberjar"))

(defn ^{:depends-on-previous-steps true} server-publish [{cwd :cwd} ctx]
(shell/bash ctx cwd
Expand All @@ -123,8 +160,8 @@
;; more or less means that some values have special meaning for the UI to display things.
;; Check out the implementation of ```shell/bash``` if you want to know more.
(defn some-step-that-cant-be-reached [& _]
{ :some-info "hello world"
:status :success})
{:some-info "hello world"
:status :success})


;; Another step that just fails using bash.
Expand Down

0 comments on commit 6afa77d

Please sign in to comment.