SVG
SVG

Local Builds

Sometimes you just need to run something on your local machine. This is of course not advised for production purposes, but every once in a while, it can be useful to run the full build pipeline on your own machine. MonkeyCI makes this possible, as long as you either have Docker or Podman on your machine.

First of all, you need to install the command-line interface. After that, open up a command shell and go to your repository directory (the one where .monkeyci/ is located). Then invoke the build command:

$ monkeyci build

There are of course many parameters you can customize. But more on that later! You can start by asking for help:

$ monkeyci build --help

Needless to say, we advise to use this feature sparingly and certainly not for production purposes! You really wouldn't want to wipe that precious production database by accident...

Running a Build Script

In order to run the build script that is present in the local .monkeyci/ subdirectory, just execute thie build run command:

$ monkeyci build run

This will load the build scripts, and execute the jobs they declare. If you are using parameters in your scripts, they will not have any value unless you either explicitly specify them, or configure access to the MonkeyCI API to fetch them there.

Manually Specifying Parameters

To pass parameters on the command line, you can specify literal values using the --param argument (or -p in short):

$ monkeyci build run --param some-param=some-value -p other-param=other-value

As you can see, you can specify multiple parameters at once.

Alternatively, you can put multiple parameters into a configuration file and refer it in your command:

$ monkeyci build run --param-file path/to/file

The file can be a json, yaml, edn or Java Properties file. For example, using yaml:

# Example params.yaml file
some-param: some-value
other-param: other-value

Or in json:

{
  "some-param": "some-value",
  "other-param": "other-value"
}

Similar to literal parameter values, you can specify multiple files at once. When there are multiple conflicting values (parameters with same name but specified in multiple sources), the one that is specified last will have priority.

Fetching Parameters from API

In addition, you can fetch the parameters from the MonkeyCI REST API. This is similar to how parameters are exposed to builds when executing them remotely. Which parameters are available depends on the configured parameters, their labels, and the labels configured on the repository.

In order to allow for this, you need to configure the organization and the repository the build belongs to, and set up an API key on that organization, or on your user account (that needs access to that organization).

See the CLI configuration section for more details on where to configure this.

In addition, you can specify these values on the command line, for example:

$ monkeyci build --api-key mysecretkey run -o monkey-projects -r monkeyci

The above example will build the code using the parameters for organization monkey-projects and repository monkeyci, using the specified API key.