{:title "API reference" :category :builds :index 150 :related [["intro/basic-example" "Basic example"] ["intro/useful-example" "A more useful example"]]}
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.api namespace. They cover a range from low-level
to high-level functions. It is advised to use the high-level functions in monkey.ci.api,
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.
Creates a new action job.
[id action opts?]| Argument | Description |
|---|---|
id | job id, must be unique in the build script |
action | 1-arity function that takes the build context, and returns the build result. A return value of nil is interpreted as a success. |
opts | optional extra configuration, specified as a map. Prefer using the manipulator functions. |
Example:
(action-job
"test-job"
(fn [ctx]
(println "This is an action job")))
Verifies if argument is an action job. Useful for testing.
[obj]true if the argument is an action job, false otherwise.| Argument | Description |
|---|---|
obj | The object to check. |
Example:
(is (= (action-job? my-job)))
Creates a new container job. Use manipulator functions to configure it.
[id opts?]| Argument | Description |
|---|---|
id | job id, must be unique in the build script |
opts | optional 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.
Verifies if argument is a container job. Useful for testing.
[obj]true if the argument is a container job, false otherwise.| Argument | Description |
|---|---|
obj | The object to check. |
Example:
(is (= (container-job? my-job)))
Gets the list of dependencies of the job. Useful for testing or conditions.
[job]| Argument | Description |
|---|---|
job | The job to get dependencies of. |
Example:
(is (not-empty (dependencies test-job)))
A manipulator function that adds a dependency to the job.
[job dependencies]| Argument | Description |
|---|---|
job | The job to add the dependency to. Can also be a function that returns a job. |
dependencies | One 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.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |