SVG
SVG

API reference

This is a listing of the available functions when writing build scripts. Since MonkeyCI is open source, you can also check out the code and see for yourself. The API code is located in the monkey.ci.build.* namespaces. They cover a range from low-level to high-level functions. It is advised to use the high-level functions in monkey.ci.build.v2, unless you want to do something very specific, in which case you may also find useful functions in monkey.ci.build.core or any other adjoining namespace.

See also the cljdoc page for the auto-generated documentation with links to the source code. It's always up-to-date with the latest version.

action-job

Creates a new action job.

  • Arguments: [id action opts?]
  • Returns: a basic action job with default options.
ArgumentDescription
idjob id, must be unique in the build script
action1-arity function that takes the build context, and returns the build result. A return value of nil is interpreted as a success.
optsoptional extra configuration, specified as a map. Prefer using the manipulator functions.

Example:

(action-job
  "test-job"
  (fn [ctx]
    (println "This is an action job")))
action-job?

Verifies if argument is an action job. Useful for testing.

  • Arguments: [obj]
  • Returns: true if the argument is an action job, false otherwise.
ArgumentDescription
objThe object to check.

Example:

(is (= (action-job? my-job)))
container-job

Creates a new container job. Use manipulator functions to configure it.

  • Arguments: [id opts?]
  • Returns: a basic container job with default options.
ArgumentDescription
idjob id, must be unique in the build script
optsoptional extra configuration, specified as a map. Prefer using the manipulator functions.

Example:

(container-job "test-job" {:image "docker.io/alpine:latest"})

Note that it is preferred to use manipulator functions to configure the job, instead of using the opts map, unless there is a good reason for it.

container-job?

Verifies if argument is a container job. Useful for testing.

  • Arguments: [obj]
  • Returns: true if the argument is a container job, false otherwise.
ArgumentDescription
objThe object to check.

Example:

(is (= (container-job? my-job)))
dependencies

Gets the list of dependencies of the job. Useful for testing or conditions.

  • Arguments [job]
  • Returns: the dependencies configured on the argument.
ArgumentDescription
jobThe job to get dependencies of.

Example:

(is (not-empty (dependencies test-job)))
depends-on

A manipulator function that adds a dependency to the job.

  • Arguments: [job dependencies]
  • Returns: the updated job.
ArgumentDescription
jobThe job to add the dependency to. Can also be a function that returns a job.
dependenciesOne or more dependencies, can also be a sequence.

Example:

(-> (action-job "test-job" (fn [ctx] (println "This is a test job")))
    (depends-on "other-job" ["another-job" "yet-another-job"])
    (depends-on "even-more-jobs"))

You can specify multiple job ids, or a sequence. They will all be flattened out into a single list of dependencies. Invoking depends-on multiple times adds to the existing list of dependencies, it does not replace them.