Hosted environments
Hosted environments are not available yet. The commands on this page exist, but there is no hosted service for them to reach: jcm publish, jcm promote, jcm login, jcm link and jcm status have only been run against a test double of it.
Publishing and promoting
jcm login # shows an address and a code; approve it there
jcm link dev # this project publishes to dev
jcm publish # check, upload, follow the build, print the address
jcm promote dev test # shows what moves, asks, promotes
jcm promote test prod # waits for approval, and says who may approve
jcm status
- Sign-in.
jcm loginuses a device code: open the address it prints, enter the code, and it signs in once you have approved it there. The token is kept in your OS keychain where the launcher finds one (macOS Keychain, or the Secret Service throughsecret-toolon Linux; the account isjcm-<SHA-256 of the control plane's origin>), else as one file per control plane,tokens/<SHA-256 of the origin>in your jcm config folder (~/.config/jcm, or$XDG_CONFIG_HOME/jcm;%APPDATA%\jcmon Windows), mode 0600 in a 0700 folder. A token is found by computing that one name; no plane name is ever matched as a pattern. An oldercredentials.jsonis moved there once and removed. On Windows the file is the only store: Windows PowerShell has no Credential Manager command of its own. It is never written in the project. Each token is kept for the control plane that issued it (its origin: scheme, host and port) and is sent to that one only: a project file naming another control plane gets no token, and saysrun jcm login --control-plane <url>. Redirects are not followed. A control plane must behttps://, but for this machine (localhost,127.0.0.1), which the fake uses. With a keychain the tokens reach the tools container as the variableJCM_TOKEN(withJCM_TOKEN_ORIGIN, the origin it belongs to), named on thedocker runline without its value: one token, the project's control plane's, never all of them, and only forlink,status,promoteand the upload half ofpublish. The config folder is mounted only forloginandlogout.jcm publishruns as two containers: the first refuses a dirty tree and runsjcm checkwith no Docker socket, token or config folder; the second uploads and follows the build with the one token and no socket and no build. So the project's own build (Gradle, its plugins, the tests and the started application) never shares a container with a token.JCM_KEYCHAIN=offkeeps tokens in the file. An expired token says so: runjcm loginagain.jcm logout --control-plane <url>forgets one;jcm logoutall.jcm loginwithout--control-planein a project whose file names one asks first (--yesdoes not), since a committed file chose the address. A token with characters a token never has (outsideA-Za-z0-9._~+/=-) is not kept.JCM_ALLOW_INSECURE=1lets a token travel over plain http to another machine; it is for the tests' fake only, and jcm warns each time it lets a call through. - Publish refuses a working tree with uncommitted changes (
--allow-dirtypublishes the last commit without them, and says thatjcm checkthen ran on the uncommitted files), runsjcm checkfirst (--skip-checkdoes not), uploads the tracked files at the current commit (git archive, at most 200 MB), or names the commit when the environment builds from a connected repository, then prints the build's log as it comes and the environment's address once it is deployed. The control plane runs the checks again in its own build; only a passing build is deployed. A build still running after an hour (JCM_BUILD_TIMEOUT, in seconds) is no longer followed;jcm statusshows when it is deployed. - Promote moves the image an environment runs, as it is, to the next one: dev → test → prod and no other way.
It shows what moves (commit, JCM version, image) and what it replaces, asks unless
--yes, and follows it. A promotion that needs approval (prod, usually) says who may approve it and ends there with exit code 10 (it has not moved yet, so a script must not read it as done);jcm statusshows when it has moved, or--waitfollows it to the end (exit 0 once it has).
The control plane's address comes from JCM_CONTROL_PLANE, else the project file, else the one jcm login last
used (config.json beside the token), else https://control-plane.example.invalid.
Hosted commands
jcm login (device code), jcm link <env>, jcm publish [--allow-dirty] [--skip-check], jcm promote <from> <to> [--yes] [--wait], jcm status, jcm logout. The contract is cli/control-plane-api.yaml; what a running application calls is cli/tenant-plane-api.yaml. The token is in
the OS keychain where the launcher finds one (macOS security, Linux secret-tool), else in the file
<config>/tokens/<SHA-256 of the origin> with mode 0600, one per control-plane origin, sent to that origin only (https
required but for localhost; redirects not followed; a project file naming another plane is refused with run jcm login --control-plane <url>), and reaches a container as JCM_TOKEN (one token, the project's plane's) with
JCM_TOKEN_ORIGIN, by name; the project's own build never gets it (core.without_tokens). Publish refuses a
dirty tree, runs jcm check first, uploads git archive of the commit (or names the commit when the
environment's source is git), follows the build log by offset and prints the address. Promote shows what
moves, asks, and a promotion waiting for approval names its approvers and exits 10.
Hosted side: publish and promote are proven against the contract and the fake control plane
(cli/fake-control-plane/server.py: a failing build, an approval wait, an expired token) only: no hosted service
exists yet.