Environment Variables
Status: 🟢 The variables below are set during builds. 🟡
KARGO_JOBSis set, but describes no limit the build itself observes. ⚪ Variables marked planned depend on features that are not built yet (workspaces, flavors reaching the build path).
Kargo exports a standard set of variables to compiler invocations, hooks, and plugins, so a script never has to be told where it is or what it is building.
Package
| Variable | Example | Status |
|---|---|---|
KARGO_MANIFEST_DIR | /home/jane/my-app | 🟢 |
KARGO_PKG_NAME | my-app | 🟢 |
KARGO_PKG_VERSION | 1.2.0 | 🟢 |
KARGO_PKG_VERSION_MAJOR | 1 | 🟢 |
KARGO_PKG_VERSION_MINOR | 2 | 🟢 |
KARGO_PKG_VERSION_PATCH | 0 | 🟢 |
KARGO_PKG_AUTHORS | Jane Doe <jane@example.com> | 🟢 |
KARGO_PKG_DESCRIPTION | Order processing service | 🟢 |
KARGO_PKG_REPOSITORY | https://github.com/example/my-app | 🟢 |
The split version components save a script from parsing semver to stamp a build number or compute a Docker tag.
Build context
| Variable | Example | Status |
|---|---|---|
KARGO_BUILD_DIR | /home/jane/my-app/build | 🟢 |
KARGO_TARGET | jvm | 🟢 |
KARGO_PROFILE | release | 🟢 |
KARGO_JOBS | 8 | 🟡 |
KARGO_KOTLIN_VERSION | 2.4.21 | 🟢 |
KARGO_TOOLCHAIN_DIR | ~/.kargo/toolchains/kotlin-2.4.21 | 🟢 |
KARGO_CACHE_DIR | ~/.kargo/cache | ⚪ |
KARGO_TOOLCHAIN_DIR is how a hook reaches kotlinc or kotlin-daemon-client
without guessing a path or depending on a global install.
KARGO_JOBS is [build] jobs passed through verbatim, and
that is all it is: nothing in Kargo runs concurrently because of it, so it is a
number a hook can read rather than a budget a hook is sharing. Sizing your own
parallelism to it is choosing that number yourself — which is reasonable, since
it defaults to the core count, but it is not coordination. It does not bound
downloads either; those have a limit of their own.
Flavors and variants
Set when flavors are configured. ⚪ Flavors do not reach the build path yet, so these are not populated today.
| Variable | Example |
|---|---|
KARGO_VARIANT | paid-production-release |
KARGO_FLAVOR_<DIMENSION> | KARGO_FLAVOR_TIER=paid |
KARGO_BUILD_CONFIG_<KEY> | KARGO_BUILD_CONFIG_API_URL=https://api.example.com |
Dimension names are upper-cased: dimension tier becomes KARGO_FLAVOR_TIER.
Every build-config entry is exported with a KARGO_BUILD_CONFIG_ prefix, so a
deploy script can read the same API URL the application was compiled with.
Workspaces
Status: ⚪ Planned — depends on workspace orchestration.
| Variable | Example |
|---|---|
KARGO_WORKSPACE_DIR | /home/jane/my-workspace |
KARGO_WORKSPACE_MEMBER | shared |
Variables from .kargo.env
Every entry in .kargo.env is exported to builds, hooks,
and plugins, and is available for ${env:…} interpolation in the manifest.
# .kargo.env
DEPLOY_TARGET=staging
[hooks]
post-build = ["./scripts/deploy.sh"]
#!/usr/bin/env bash
echo "Deploying $KARGO_PKG_NAME $KARGO_PKG_VERSION to $DEPLOY_TARGET"
echo "Artifacts in $KARGO_BUILD_DIR/$KARGO_TARGET/$KARGO_PROFILE/output"
Variables Kargo reads
Alongside what it exports, Kargo honors these from your environment:
| Variable | Used for |
|---|---|
JAVA_HOME | JDK discovery |
ANDROID_HOME, ANDROID_SDK_ROOT | Android SDK discovery |
KARGO_HOME | Overrides ~/.kargo — useful in CI where only project paths are cached |
NO_COLOR | Disables colored output |
RUST_LOG | Verbosity of internal tracing output, for debugging Kargo itself |
export KARGO_HOME="$CI_PROJECT_DIR/.kargo-home"
Terminal output
Read by Kargo, not set by it. An explicit --color overrides them.
| Variable | Effect |
|---|---|
NO_COLOR | Set to anything to disable colour. |
CLICOLOR=0 | Disable colour. |
CLICOLOR_FORCE=1 | Colour even when the output is piped. |
In practice
# A hook that stamps the build
cat > build/generated/version.txt <<EOT
${KARGO_PKG_NAME} ${KARGO_PKG_VERSION}
built for ${KARGO_TARGET} (${KARGO_PROFILE})
with Kotlin ${KARGO_KOTLIN_VERSION}
EOT