Skip to content
Florian Sellmayr edited this page Sep 19, 2015 · 3 revisions

Import: (:require [lambdacd.steps.git :as git])

wait-for-git [ctx repo-uri branch options]

Step that waits for a commit on the specified branch in the specified repository. Polls the repository in regular intervals.

Options are key-value pairs:

  • :ms-between-polls: The number or milliseconds to wait between two polling requests to the repository (default: 10000 i.e. 10 seconds)

Returns:

  • :revision The revision of the most recent commit

Example:

(defn wait-for-commit-on-lambdacd-repo [args ctx]
  (git/wait-for-git ctx "git@github.com:flosell/lambdacd.git" :ms-between-polls 1000))

wait-with-details [ctx repo-uri branch options]

Same as wait-for-git but outputs details about the new commits it found.

Returns:

  • :revision The revision of the most recent commit
  • :commits Information on the new commits.

Example:

(defn wait-for-commit-on-lambdacd-repo [args ctx]
  (git/wait-with-details ctx "git@github.com:flosell/lambdacd.git" :ms-between-polls 1000))

with-git [repo-uri steps]

Returns a step that executes the given steps with a workspace where the given repository is checked out. Works best if the step before is wait-for-git as then it'll check out the revision found by wait-for-git.

Input args:

  • :revision The revision to check out. If not given, will check out the HEAD of the master branch

args passed on to child steps:

  • :cwd contains the working directory where the repository is checked out

Example:

(defn some-step [args ctx]
  (shell/bash ctx (:cwd args) "./script-in-repo.sh"))

(defn with-repo [& steps]
  (git/with-git "git@github.com:flosell/lambdacd.git" steps))