YAML example
Most CI/CD tools use YAML
in order to configure build scripts. YAML
was designed as a way to create structured information, readable to both humans and machines. And indeed it's great for simple configurations.
MonkeyCI also supports YAML
out of the box, but only for simple scripts, just like EDN and JSON. These three formats are mostly interchangeable so you can use either. You can even combine them, as MonkeyCI will read all files with supported extensions in the .monkeyci/
directory.
Below is a basic build configuration for a single job, stored in .monkeyci/build.yaml
:
id: echo-job
image: docker.io/alpine:latest
script:
- 'echo "Hi there, this is a test"'
Of course, multiple jobs are also possible:
- id: test
image: docker.io/maven:latest
script:
- mvn verify
save-artifacts:
- id: target
path: target/
- id: publish
image: docker.io/maven:latest
script:
- mvn deploy:deploy
dependencies:
- test
restore-artifacts:
- id: target
path: target/
This build script declares two jobs: test
, which runs Java unit tests using Apache Maven, and publish
, which publishes the artifacts and which is dependent on the test
job for the binaries exposed as artifacts in order to execute.
As stated, this is only useful for the simplest build scripts. As soon as you need conditions or you want to run action jobs, you'll need to code your scripts using Clojure. Don't forget you can also combine YAML
with Clojure code!