Actions Reference
Actions are the functions that kbuild executes on packages. Every action receives a context map containing:
-
:package— the resolved package map for the current package -
:packages— all resolved packages (the full set, after filtering) -
:project?— boolean indicating if the package is a project (undersystems/) -
:root— monorepo root path
Plus any extra options passed on the command line or merged from implicits.
Invoke an action directly:
clojure -T:kbuild run :action <namespace/fn> :package <name>
Packaging
kbuild.uber/jar
Builds a standard Clojure uberjar. All dependencies (except local monorepo deps, which are inlined as sources) are merged into a single jar.
When :entry-point is provided the namespace is AOT-compiled and Main-Class is set in the manifest, making the jar executable with java -jar.
| Option | Default | Description |
|---|---|---|
|
— |
Main namespace. Triggers AOT compilation and sets |
|
|
Output jar filename. |
clojure -T:kbuild run :action kbuild.uber/jar :package janus/chm-api
clojure -T:kbuild run :action kbuild.uber/jar :package janus/chm-api \
:entry-point io.forward-publishing.janus.facade.main
kbuild.uber/rama-jar
Builds a Rama-compatible uberjar.
Same as kbuild.uber/jar but never performs AOT compilation — the :entry-point option is ignored.
| Option | Default | Description |
|---|---|---|
|
|
Output jar filename. |
clojure -T:kbuild run :action kbuild.uber/rama-jar :package janus/chm-backend
kbuild.pack/skinny
Builds a skinny jar with dependencies copied to a separate lib/ directory.
The main jar’s Class-Path manifest entry points to the jars in lib/, preserving the correct classpath order.
When :entry-point is provided the namespace is AOT-compiled and Main-Class is set.
| Option | Default | Description |
|---|---|---|
|
— |
Main namespace. Triggers AOT compilation and sets |
|
|
Output jar filename. |
Output structure:
target/
<package>.jar
lib/
dep1.jar
dep2.jar
...
clojure -T:kbuild run :action kbuild.pack/skinny :package janus/my-app
kbuild.pack/one-jar
Builds a self-executable One-JAR using pack.alpha. All dependencies are bundled inside a single jar and loaded via a custom classloader, avoiding file-name conflicts that can occur with traditional uberjars.
When :entry-point is provided the namespace is AOT-compiled and Main-Class is set.
Without it, the jar defaults to clojure.main.
| Option | Default | Description |
|---|---|---|
|
— |
Main namespace. Triggers AOT compilation and sets |
|
|
Output jar filename. |
clojure -T:kbuild run :action kbuild.pack/one-jar :package janus/my-app
Deployment
kbuild.maven/deploy
Deploys a package jar to a Maven repository.
The jar must already exist in target/ (i.e. run a packaging action first).
| Option | Default | Description |
|---|---|---|
|
— |
Required. Maven repository name (must match a |
|
|
Jar filename override. |
clojure -T:kbuild run :action kbuild.maven/deploy :package janus/chm-backend \
:mvn/repo '"janus"'
Version control
kbuild.git/tag-version
Creates a git tag for the package’s current version. The tag format is determined by kmono’s versioning system.
This is the default action for the release implicit — it runs automatically when you invoke clojure -T:kbuild release, with no per-package configuration needed.
Override per-package with :kbuild/implicits {:release {:kbuild/action custom/fn}}.
| Option | Default | Description |
|---|---|---|
|
|
Push tags to the remote after creating them. |
# Via the release implicit (recommended)
clojure -T:kbuild release :package janus/chm-backend
clojure -T:kbuild release :package janus/chm-backend :push-tags true
# Direct invocation
clojure -T:kbuild run :action kbuild.git/tag-version :package janus/chm-backend \
:push-tags true
Testing
kbuild.test/test
Runs clojure -M<aliases> in the package directory (defaults to -M:test).
This is the default action for the test implicit — it works out-of-the-box for any package that has a :test alias in its deps.edn.
| Option | Default | Description |
|---|---|---|
|
|
Vector of alias keywords to append to |
A typical :test alias using Kaocha:
:test {:extra-paths ["test"]
:extra-deps {lambdaisland/kaocha {:mvn/version "..."}}
:main-opts ["-m" "kaocha.runner"]}
# Direct invocation
clojure -T:kbuild run :action kbuild.test/test :package janus/core
# Via the test implicit (equivalent when no per-package override)
clojure -T:kbuild run :action test :package janus/core
# Shorthand
clojure -T:kbuild test :package janus/core
Docker
kbuild.docker/build
Builds a Docker image for the package by running docker build -t <local-ref> . in the package directory.
The image is tagged with two local refs (no registry prefix): a versioned ref derived from the package’s group, name, and version (e.g. janus-chm-api:1.0.0), and a stable <name>:latest ref.
The versioned ref is the canonical intermediate image used by kbuild.docker/push; the :latest ref is used by kbuild.grype/scan.
Takes no action-specific options (:docker/image-refs is used only by push).
clojure -T:kbuild run :action kbuild.docker/build :package janus/chm-api
kbuild.docker/push
Pushes the Docker image for the package to every image ref in :docker/image-refs.
For each image ref, retags the local image (docker tag) and pushes the resulting ref (docker push).
The version tag is appended automatically to each image ref.
The local image must already exist (i.e. kbuild.docker/build must have been run first).
| Option | Default | Description |
|---|---|---|
|
— |
Required. Vector of fully qualified image references (without tag) to push to. |
clojure -T:kbuild run :action kbuild.docker/push :package janus/chm-api
kbuild.docker/build+push
Combines <<`kbuild.docker/build`>> and <<`kbuild.docker/push`>> into a single action.
The image is built once and pushed to every image ref in :docker/image-refs.
| Option | Default | Description |
|---|---|---|
|
— |
Required. Vector of fully qualified image references (without tag) to build and push to. |
clojure -T:kbuild run :action kbuild.docker/build+push :package janus/chm-api
;; deps.edn
:kbuild/implicits
{:publish {:kbuild/action kbuild.docker/build+push
:docker/image-refs ["ghcr.io/my-org/my-app"
"123456789.dkr.ecr.eu-west-1.amazonaws.com/chm-api/my-app"]}}
Vulnerability scanning
kbuild.grype/scan
Scans a locally-built Docker image with Grype and fails the build if any CRITICAL vulnerabilities are found.
Use this as the verify implicit action by declaring it explicitly in the package’s deps.edn.
Grype must be installed and available on PATH (grype version should succeed).
The image ref is derived from the package’s group and name with a :latest suffix (e.g. janus-chm-api:latest), matching the tag added by kbuild.docker/build.
Pass :docker/image to override.
| Option | Default | Description |
|---|---|---|
|
|
Local image ref to scan (e.g. |
|
monorepo root |
Root path for writing the report. Provided automatically by kbuild.core. |
Output:
-
Prints a colored per-severity count table (
Critical,High,Medium,Low,Negligible,Unknown). -
Lists each CRITICAL finding with CVE id, package name, version, and available fix versions.
-
Writes a JSON report to
reports/grype/<image-name>-grype-report.json. -
Throws if any CRITICAL vulnerabilities are found, failing the build.
clojure -T:kbuild run :action kbuild.grype/scan :package janus.chm/api
clojure -T:kbuild run :action verify :package janus.chm/api
;; systems/chm/api/deps.edn
:kbuild/implicits
{:verify {:kbuild/action kbuild.grype/scan}}