Remote
Register the servers hammerkit can send runs to and choose the default location.
Experimental. remote run runs tasks of a published build file from a git ref of the
repository. Sending a run of the files on your machine (--on, running a task with a
runner:) arrives in follow-up releases, see
the remote compute spec.
remote manages the list of hammerkit servers your machine knows about. Each one
is registered under a short name, which later features (--on <name>, a task's
runner:) refer to instead of a URL.
How a server is set up, and how it decides who may run what, is described in Remote compute.
hammerkit remote add build https://build.example.com --issuer https://login.example.com
hammerkit remote login build
hammerkit remote accounts build
hammerkit remote publish build
hammerkit remote run test --server build
hammerkit remote verify test --server build
hammerkit remote approvals build
hammerkit remote approve run_Qx3k9ZpL2mW7vN4a build
hammerkit remote list
hammerkit remote use build
hammerkit remote remove buildExcept for publish, run and verify, the commands only touch your host config and talk to the
server, so they work with or without a build file in the working directory.
Leaving out the server name
Every command that takes a server ([name], [server] or --server <name>) works without
one. It then uses the default set with remote use, and when there is none (or the default
is local or auto), the only registered server. So with one server you can write:
hammerkit remote add build https://build.example.com --issuer https://login.example.com
hammerkit remote login
hammerkit remote publish
hammerkit remote run testWith several servers and no default, hammerkit asks you to name one and lists them:
2 servers are registered (build and staging), name one as the last argument, or make one the default with: hammerkit remote use <name>A default that names a server which is no longer registered is an error, never a reason
to pick another one. remote add, remote remove and remote use always need the name. Where a run of
hammerkit run goes is a separate choice, see Runner: a single
registered server does not make those runs remote.
Commands
| Command | What it does |
|---|---|
remote add <name> <url> --issuer <url> | Register a server. --issuer is the OAuth issuer the server accepts tokens from, written exactly as the iss of its tokens (some providers end it with a slash). --client-id, --audience and --scope pin what a login asks for, see Signing in. --token-command <command> takes the token for this server from a command instead of a login, see A token command per server; --no-token-command removes it. |
remote list | Show the registered servers and which one is the default. |
remote use <location> | Set the default location: local, auto or a registered name. |
remote remove <name> | Forget a server. If it was the default, runs are local again. |
remote login [name] | Sign in to the server with your identity provider. |
remote logout [name] | Forget the sign-in. |
remote accounts [name] | Show who you are on the server and which service accounts you may use. Without a name, the default server or the only one, see Leaving out the server name. |
remote publish [server] | Publish the build file of the working directory (or the one --file names) and the files it includes, and print its hash, see Publishing. --dry-run only checks it against the server's policy. |
remote run <tasks...> | Run tasks of a published build file on a server from a git ref, print their output and exit as they did, see Running tasks. |
remote up <services...> | Start services of a published build file on a server from a git ref and keep them up, with --endpoint service:port at addresses of their own, see Service runs. |
remote status [server] | Show how the server stands for you: the places that run and for how long, the queue with how long each run waited and why, your limits and the runs that count against them, the service runs, and the capacity. --json for scripts, see Status. |
remote tasks [server] | Show what the past runs of each task took: how often it ran, failed and came from the cache, the median and 90th percentile of its time, and how long its runs waited. --mine for your runs only, see Past tasks. |
remote capacity [server] | Show what the machines of the server have and what its runs take: CPU and memory requested and in use, per namespace on Kubernetes, see Capacity. |
remote dashboard [server] | Print the address of the dashboard of a server that has one. |
remote services [server] | List the service runs that are starting, up or asleep, yours and those of others you may see, with their addresses where you may open them, and when they end or sleep. --ended adds the ended ones. |
remote runs [server] | List your runs on a server, newest first: their state, what they ran, how long they waited and ran, where a queued one stands, and why one failed. --limit <count> shows more than 20; --state, --services, --tasks and --all filter, see Status. |
remote logs <run> [server] | Print the log of a run, also of one that ended: what its tasks and services printed, and what the server and the cluster said. --task <name> keeps one task or service, --tail <lines> the last lines, --follow keeps printing until the run ends, see Reading a run again. |
remote extend <run> <ttl> [server] | Keep a service run up for this long from now. |
remote stop <run> [server] | Stop a run; a service run takes its services and endpoints down. |
remote retry <run> [server] | Start a run that is over again as a new run of yours, at the commit it ran, see Retrying a run. |
remote verify <tasks...> | Check that the server already passed tasks for the files checked out here, without running them, see Verifying checks. |
remote versions [server] | List the published versions, newest first, with who published them, where they come from and whether they were yanked. --filter key=value (repeatable) keeps the ones with that annotation. |
remote approvals [server] | List the runs that wait for your approval. |
remote show <run or hash> [server] | Show a run that waits for your approval, or a proposed or published version, in full: per task the commands, image, secrets and accounts, and every file of a version, see Approving runs and Proposing. |
remote proposals [server] | List the proposed versions of build files you made or may approve, see Proposing. |
remote approve <run or hash> [server] | Let a run go ahead, or publish a proposed version. --reason <text> is optional. |
remote yank <hash> [server] | Pull a published version back: no run starts from it. --reason <text> is shown to whoever tries to run it. Needs builds: publish or use of an account the version works with. |
remote unyank <hash> [server] | Let a yanked version go on. Needs builds: publish. |
remote reject <run or hash> [server] | End a run, or drop a proposed version. --reason <text> is shown to who asked for it. |
remote mcp | Serve a sandbox on a server as MCP tools over stdio for a coding agent, see remote mcp. |
Re-running remote add with the same values changes nothing. What you leave out keeps
what was registered: the pinned client, audience and scope, and the token command. To
point an existing name at a different server pass --force, so a typo can't silently
redirect your runs. A name pointed at another server starts without the old token
command. To drop a pin, remove the server and add it again.
local and auto are reserved and can't be used as server names.
Host config
Registrations live in ~/.hammerkit/config.yaml. Set HAMMERKIT_CONFIG to use a
different file.
servers:
build:
url: https://build.example.com
issuer: https://login.example.com
ci:
url: https://ci.example.com
issuer: https://accounts.google.com
tokenCommands:
ci:
url: https://ci.example.com
issuer: https://accounts.google.com
command: gcloud auth print-identity-token --audiences=hammerkit --include-email --impersonate-service-account=hammerkit-ci@my-project.iam.gserviceaccount.com
run:
on: buildtokenCommands are written by remote add --token-command.
Each is bound to the URL and issuer it was registered for, like a sign-in, and is not used
once the name points elsewhere. They sit beside servers so that hammerkit before 2.0,
which refuses unknown keys of a server, still reads the file.
The config is deliberately not part of the project's build file. A checked-in file naming a server URL could redirect your source code and OAuth tokens, so the decision of where to send work stays on the machine.
The same file can hold the secretProviders and secretAccounts this machine reads
secrets with, see On this machine only.
URLs
Server URLs must use https. Plain http is accepted only for localhost,
127.0.0.1 and [::1], for local testing. URLs with credentials, a query string
or a fragment are rejected, and a trailing slash is dropped.
Publishing a build file
A server runs published build files, it does not take task definitions from the one
who runs them. remote publish sends yours:
$ hammerkit remote publish build
published to build: sha256:9f2c61d0... (3 files)
tasks and services: build, deploy, more:lint
from: path=.hammerkit.yaml repo=github.com/corp/payments commit=4be1a07c... machine=ci-runner-7 user=runnerIt reads the build file with the parser of a run and sends it together with every
local file it includes or references, as text. That is the bundle, up to 200 files
and 1 MiB. Includes have to be below the directory of the build file, because a
server could not reproduce anything else. That goes for where a file really is too: an
include that is a link (or sits in a linked directory) pointing outside of that
directory is refused, not followed, so publishing a checkout never sends a file of
your machine that the checkout only links to. Git includes are not sent, the server
fetches them and wants them pinned to a commit. The version printed is the hash of
the bundle, computed here the same way the server computes it, so the same files
always have the same version. That hash is the only name the version has: a run
names it, there is no latest. Publishing what a server already has says already published and changes nothing.
With the bundle go annotations that say
where it comes from, the from: line: the path of the build file in its git repository,
the repository and commit, this machine and your user name. When a file of the bundle is
not as the commit has it (changed, or not committed at all), dirty=true says so, so the
version is not taken for that commit's. They are not part of the hash. --annotation key=value adds one or replaces one, --annotation user= leaves one
out, and it can be given more than once. remote versions lists what a server has and
finds it by them, and remote show <hash> prints one whole. Anybody else sees them as
from (unverified), since the server takes them as you sent them:
$ hammerkit remote versions build --filter repo=github.com/corp/payments
build: 1 published
sha256:9f2c61d0... published by ci at 2026-10-12T20:31:00.000Z
from (unverified): path=.hammerkit.yaml repo=github.com/corp/payments commit=4be1a07c... machine=ci-runner-7 user=runner
tasks and services: build, deploy, more:lint
accounts: op-payments-prodYou need builds: publish on the server, see
entitlements. A build file that reads secrets as an
account you do not use is proposed instead, see below. Without a server name the default
server (or the only one) is used, and --file <path> publishes another build file.
--dry-run publishes nothing: the server checks the bundle against its policy and says
what publishing it would do. Any builds level may check, run too:
$ hammerkit remote publish build --dry-run
checked with the policy of build: sha256:9f2c61d0... (3 files), nothing was published
tasks and services: build, deploy, more:lint
publishing it would propose it, it names accounts you do not use: op-payments-prodTasks and services marked publish: false are left out, see
Only part of a build file.
Proposing a version
With only builds: propose, or when the build file names an account you do not use,
the same command proposes the version. It does not become a version and can not run
until somebody who may publish, and uses those accounts, approves it:
$ hammerkit remote publish build
proposed to build: sha256:4be1a07c... (3 files)
tasks and services: build, deploy, more:lint
it can not run before somebody who may publish approves it, until 2026-10-11T11:41:00.000ZThe one who may publish reads the whole version before deciding:
$ hammerkit remote proposals build
build: 1 proposed
sha256:4be1a07c... proposed by coding-agent, waits for your approval
from (unverified): path=.hammerkit.yaml repo=github.com/corp/payments machine=agent-sandbox-3 user=agent
tasks and services: build, deploy, more:lint
accounts: op-payments-prod, the proposer does not use op-payments-prod
decide before 2026-10-11T11:41:00.000Z
$ hammerkit remote show sha256:4be1a07c... build
sha256:4be1a07c... on build, proposed by coding-agent (https://login.example.com), waiting
deploy task, docker node:22
$ ./deploy.sh
after: build
secret gsm:kube-token as op-payments-prod -> KUBE_TOKEN
...
--- .hammerkit.yaml (entry)
tasks:
build:
cmds: [npm run build, ./upload.sh]
...
$ hammerkit remote approve sha256:4be1a07c... build
approved sha256:4be1a07c... on build, it is publishedremote show prints what each task does and then every file of the bundle, whole and
with control characters replaced by ?, so nothing hides in it. It does not compare
with an earlier version: a version has no name and follows none, so a diff would only
show what the proposer chose to compare with. remote reject drops the proposal, with a
--reason the one who proposed it reads in remote proposals. Nobody approves their
own proposal, and what you may not decide does not exist for you. After a rejection you
can not propose again for ten minutes, and nobody that version (approvals.cooldown).
Running tasks
remote run starts a run of a published version on a server, from a branch or tag of
your repository that the server checks out itself, and follows it to its end:
$ hammerkit remote run test --server build
run_Qx3k9ZpL2mW7vN4a on build: test from main at 4be1a07c...
[hammerkit] checked out github.com/corp/payments at 4be1a07c...
✓ 42 tests passed
run_Qx3k9ZpL2mW7vN4a succeededIt prints every line of the run as the server logs it, with the task in front when the line
is not of the one task you named ([hammerkit] is the server's own, so a task of that name
is best called something else). It exits with 0 when
the run succeeded and with the exit code of the task that failed otherwise, 1 when the
run was rejected, cancelled or failed without one. Control characters of the output show as
?, so the output of a run can not rewrite your terminal; tabs stay.
Several tasks named (remote run ci:check test:e2e) run as one plan, side by side as far as
their dependencies allow and in no particular order, the
longest remaining chain first. To run
one after the other, make the second depend on the first.
What it runs, when you leave the options out, is what is checked out where you are:
| Option | What it is | Left out |
|---|---|---|
--build <hash> | The published version to run, also HAMMERKIT_BUILD. | The hash of the build file here (or the one --file names), computed as remote publish does. When the server does not have it, see A build file the server does not have. |
--repo <host/path> | The repository, such as github.com/corp/payments. The server reads it from its own sources. | The origin of the checkout. |
--ref <ref> | The branch or tag. | The branch checked out here. In a detached checkout, the one branch or tag of origin at its commit, see below. |
--commit <sha> | The commit the ref has to be at. A ref that moved since is refused, so the run executes the code you meant: main is at 9e1f... now, not at 4be1a07c.... | The commit checked out here when --ref is left out too, else no pin. |
--server <name> | The server. | The default of remote use, else the only registered server. |
--env, --cache, --timeout, --max-timeout | As for run. | The server's and the build file's defaults. |
--detach | Submit the run and exit, without following it: it prints the run and follow it with: hammerkit remote logs <id> --follow. For a check that CI verifies later. | Follow the run to its end. |
--publish | Publish the build file here first when the server does not have it, without asking. Not with --build or HAMMERKIT_BUILD. | Ask at a terminal, fail without one. |
A detached checkout, such as a worktree made with git worktree add --detach, is on no
branch. Without --ref it takes the one branch of origin (as your last fetch or push left it)
or tag whose head is its commit, pinned to that commit as --commit does, so a branch that
moved since is refused. With none, or several, it fails and names them:
the checkout here is on no branch, and its commit 4be1a07c... is the head of branch agent/fix and tag v1.2.0 of origin: name one with --refA name that looks like a commit is left out, since the server would run it as that commit, and
a branch and a tag of the same name can only be run by the commit (--ref 4be1a07c...).
What follows -- goes to the one task named, as the
arguments of a run. The server refuses them for a
task that reads a secret or depends on one that does, for a task that says args: false, and,
on a server with runs.args: declared, for every task that doesn't say args: true.
A run on an account you may only request waits for an approval, and says so:
waiting until somebody who uses deploy-prod approves it, before 2026-10-24T10:41:00.000Z: hammerkit remote approve run_Qx3k9ZpL2mW7vN4aThe command waits as long as the server lets the run wait (approvals.timeout, one hour by
default). Ctrl-C, or the cancel of a CI job, cancels the run on the server: the command waits
up to ten seconds for the server to take the cancel before it ends. The token is the one of
Signing in, or HAMMERKIT_TOKEN_COMMAND / HAMMERKIT_TOKEN, which is how a CI
job signs in with its own identity, see
CI through a server.
A build file the server does not have
When you leave --build out and the server does not have the build file here, a run can not
start, since a server only runs published versions. At a terminal
the command offers to publish it and goes on once you answer y:
$ hammerkit remote up web --endpoint web:8080
the build file here is not published on build (sha256:9f2c61d0...), 3 files
tasks and services: build, web, more:lint
publish it to build now and go on? [y/N] y
published to build: sha256:9f2c61d0... (3 files)
tasks and services: build, web, more:lint
from: path=.hammerkit.yaml repo=github.com/corp/shop commit=4be1a07c... machine=laptop user=pascal
run_Vd1rX9pQ2mT7wN4a on build: web from feature/login at 4be1a07c...It publishes exactly as remote publish does, with the same entitlements:
- Any other answer, or Ctrl-C, publishes nothing and the command fails.
- With only
builds: runit does not ask: it says that somebody who may publish has to runremote publish. - When publishing would only propose the version (
builds: propose, or an account you do not use), it askspropose it to build now?and says why. A proposal can not run yet, so the command proposes it and fails withis only proposed on build, nothing was started; run it again once it is approved.
Without a terminal, in CI or with stdin or stdout redirected, or with CI set, it asks
nothing and fails with the build file here is not published on build (sha256:...), publish it first with: hammerkit remote publish build, or pass --publish. --publish publishes it
without asking, for a job that may publish. A job that should only run what was published
leaves it out, and the failure tells that the build file changed.
With no build file here at all, the command was most likely started in another folder than the
checkout meant. It fails and says so: there is no build file at <path>. Run this in the checkout whose build file the server has, or name a published version with --build <hash>, listed by: hammerkit remote versions.
Service runs
remote up starts a service run: services of a published
version from a branch or tag, kept up until their time ends, and follows it until they are
up. Then it prints the address of each endpoint and exits; the services stay.
$ hammerkit remote up web --endpoint web:8080 --ttl 3d --sleep-ttl 30m
run_Vd1rX9pQ2mT7wN4a on build: web from feature/login at 4be1a07c...
[hammerkit] checked out github.com/corp/shop at 4be1a07c...
run_Vd1rX9pQ2mT7wN4a is up until 2026-10-28T10:12:00.000Z, asleep after 30m without a request
web:8080 https://feature-login-8080-3fa2c1e09b7d.run.example.com/| Option | What it is | Left out |
|---|---|---|
--endpoint <service:port> | A port of a service to publish, the container port it declares. More than once for more. | No endpoints. |
--public-path <run:service:port=paths> | Paths of an endpoint that need no sign-in of the server, such as preview:web:8080=/mcp,/.well-known, for an app that signs in on its own. run is the --name of this run. A service that reads a secret can not have them, and the run is refused. More than once for more, see Paths without sign-in. | No public paths. |
--ttl <duration> | How long the run lasts once its services are ready, asleep or not; then they are removed. | The server's runs.up.ttl. |
--sleep-ttl <duration> | How long the services stay up without a request, then they sleep until the next request wakes them. | The server's runs.up.sleepTtl, or never. |
--name <name> | Lower case letters, digits and -. A later remote up of yours with this name moves this run to its commit, or replaces it when it starts other services or another build file; the addresses stay. | The branch. |
--build, --repo, --ref, --commit, --server, --env, --publish | As for remote run, see also A build file the server does not have. | As there. |
When a run of yours with the name is up or asleep and starts the same services of the same
build file version, remote up moves it
to the commit instead: it keeps its id, addresses and the data of its services, and only
services that changed restart (on Kubernetes). It follows the move until the run is up at the
new commit, or for a run that is asleep, says which commit its next wake starts:
$ hammerkit remote up web --endpoint web:8080
run_Vd1rX9pQ2mT7wN4a on build (up) moves to feature/login at 9e01b77d...
[hammerkit] moving from 4be1a07c... to 9e01b77d...
run_Vd1rX9pQ2mT7wN4a is up until 2026-10-28T10:12:00.000Z, asleep after 30m without a request
web:8080 https://feature-login-8080-3fa2c1e09b7d.run.example.com/A move that does not get there leaves the run where it was and exits with 1:
did not move to 9e01b77d...: <why>; it stays at 4be1a07c.... Ctrl-C while it moves stops
following; the run moves on without.
It prints what the services print while they start, on Kubernetes too, and the server's
[hammerkit] lines, such as what a service waits for (web waits for a node: 0/3 nodes are available: 3 Insufficient cpu). When the run fails before it is up, it says which service
failed and why, and exits with 1:
[web] service web can not become ready, it keeps crashing: it exited with code 1 (Error), restarted 2 times
[hammerkit] what the cluster said in hk-run-3f2a...:
[hammerkit] pod web-6c9f...-x2k8q: Running, restarted: it exited with code 1 (Error), restarted 2 times
[hammerkit] event BackOff pod/web-6c9f...-x2k8q: Back-off restarting failed container web (4 times)
read its log again with: hammerkit remote logs run_Vd1rX9pQ2mT7wN4a
run_Vd1rX9pQ2mT7wN4a failed: web: service web can not become ready, it keeps crashing: it exited with code 1 (Error), restarted 2 timesCtrl-C while it starts cancels it.
remote extend <run> 8h keeps it for that long from now (never shorter than it was),
remote stop <run> takes it down, asleep or not.
Reading a run again
A run that failed says why when it ends: the error of the run, then each task that failed with its own error or exit code, then where its log stays:
migrate: exit code 2
read its log again with: hammerkit remote logs run_Qx3k9ZpL2mW7vN4a
run_Qx3k9ZpL2mW7vN4a failed: migrate failedThe server keeps the log of your last runs (runs.keep, 200 by default) after they ended,
also over a restart, so the pods of a run can be gone and its log is still there.
remote runs lists them, newest first:
$ hammerkit remote runs
run_Vd1rX9pQ2mT7wN4a 2026-11-07T07:12:03.000Z failed up web: web: service web can not become ready, its image ghcr.io/corp/web:4be1a07 could not be pulled (ImagePullBackOff)
run_Qx3k9ZpL2mW7vN4a 2026-11-07T06:58:41.000Z succeeded testremote logs <run> prints the log of one, each line with its task or service in front, then
how it ended:
| Option | What it does |
|---|---|
--task <name> | Only the lines of this task or service (hammerkit for the server's own), without the name in front. |
--tail <lines> | Only the last lines, at most 1000. |
-f, --follow | Keep printing what comes until the run ends, as remote run does. Ctrl-C stops following and leaves the run alone. For a service run that is up, that is the output of its services. |
remote retry <run> starts a run that is over again, as a new run of yours: the same tasks,
settings and arguments, at the commit it ran. It prints the new run, which you follow with
remote logs <run> --follow:
$ hammerkit remote retry run_Qx3k9ZpL2mW7vN4a
run_Hk2v8RqW5nM3xT1b on build retries run_Qx3k9ZpL2mW7vN4a: queued, follow it with hammerkit remote logs run_Hk2v8RqW5nM3xT1b --followThe server decides about it as about any run you start, see Retrying a run.
A log longer than the server keeps of a run (runs.maxLogBytes) ends with the last lines of
each task, which the server always keeps. On Kubernetes the log of a run that failed also
holds what the cluster said before the server removed its pods: each pod that was not as it
should be, and the warning events of the run's objects, such as FailedScheduling, a failed
image pull or a container that was killed for its memory. A container that ended says its exit
code, the reason Kubernetes gave and, above 128, the signal that killed it
(container web: it exited with code 137 (Error), killed by SIGKILL, restarted 0 times); only
one with a healthcheck adds that a failing healthcheck kills it so. A pod that copies a task's
files into or out of its volume says it is a helper of that task, not the task. The output of a
failed probe is the service's own and is left out. The server needs list on events for that, see
What the server may do.
Verifying checks
remote verify tells whether the server already passed tasks for the files checked out here,
so a CI job does not have to run them:
$ hammerkit remote verify test e2e --server build
test: passed 2026-10-25T09:14:03.120Z in 1m12s, run_Qx3k9ZpL2mW7vN4a by agent-x, from a check of sandbox sbx_4vJ0mT2cX9qLw1aB, fetched at 4be1a07c1a2b
e2e: no run on build passed it for these files
not verified: e2e; run on the server: hammerkit remote run e2eIt computes the check key of each task over the files
here, runs nothing, and asks the server for a run that passed it: a run from a ref without
arguments, or a check of a sandbox. It exits 0 when there is one for every task, and 1 at
once otherwise, also for a task that has no key (no src that matches a file). It never waits
for a run and never starts one. The guide is
Checks that ran before CI.
| Option | What it is | Left out |
|---|---|---|
--repo <host/path> | The repository, as the server knows it. | The origin of the checkout. |
--env <name> | The environment of the build file, as for run. | None. |
--server <name> | The server. | The default of remote use, else the only registered server. |
The caller needs checks: read or a builds level, with repos that cover the repository,
see Entitlements.
Approving runs
A run that reads secrets as a service account its caller may only request waits for somebody who uses that account to approve it. If you use the account:
$ hammerkit remote approvals build
build: 1 waiting for your approval
run_Qx3k9ZpL2mW7vN4a requested by 4f1c2b (https://login.example.com)
build file sha256:9f2c61d0...
tasks: deploy
accounts: op-payments-prod, source ref refs/heads/main, env=staging
op-payments-prod: waits for somebody who uses it to approve
decide before 2026-10-11T10:41:00.000Z
$ hammerkit remote approve run_Qx3k9ZpL2mW7vN4a build
approved run_Qx3k9ZpL2mW7vN4a on build, it is queuedremote show prints what each task of the run does, so the decision does not need the
build file:
$ hammerkit remote show run_Qx3k9ZpL2mW7vN4a build
...
deploy task, docker node:22 [remote-include]
$ ./deploy.sh
after: build
secret gsm:kube-token as op-payments-prod -> KUBE_TOKENThe line look at: of the list names the tasks with a flag: local-task runs on the host
and not in a container, host-port binds a port of the host and remote-include
includes a file from git. A secret's value is never shown, only where it is read from.
A run that passes arguments uses no account, so it
waits for nobody; one stored before that rule lists them on a line of their own, each as a
JSON string (arguments: "--region" "eu, us"). remote show prints each command as it
runs. Arguments and commands are never cut; other text longer than 300 characters ends in … (+N chars). Control
characters show as ?, and bidi and zero-width characters are written out
(\u{202e}), so what you read is the order it runs in. A task that isn't open shows
its network.
What you see is what the decision rests on: who asked, which version of the build file, the tasks, the service accounts they read secrets as and where the code comes from. The version is the one the run is pinned to, so what you approve is what runs. You approve for every account you use; a run on several waits until they are all covered. You see the runs on the accounts you use, and no others.
Signing in
remote login uses the OAuth device authorization grant, so it works on a machine
without a browser:
$ hammerkit remote login build
signing in to https://build.example.com through https://login.example.com
client hammerkit-cli, audience hammerkit, scope openid api://hammerkit/.default
To sign in, open https://login.example.com/activate and enter the code ABCD-EFGH
signed in to build as 4f1c2b
service accounts: op-payments-dev (use), op-payments-prod (request), op-web-dev (use)Open the address on any device, sign in as you normally do, and enter the code. The
server tells hammerkit which identity provider client, audience and scope to use, so
there is nothing to configure beyond remote add. The --issuer you registered has to be one the
server accepts, otherwise the login stops before the browser step.
The server is only trusted with that once. The first successful login pins the client,
audience and scope in the host config, and a later login refuses a server that asks
for something else (register it again with remote add --force if the change is
expected). Look at the line printed before the code: a client or audience you do not
recognise, such as one of a cloud provider's own APIs, means stop. To not rely on the
first use, give them to remote add (--client-id, --audience, --scope), the
values come from whoever runs the server. Before a token is sent to the server,
hammerkit checks that it was issued by the registered issuer for the pinned audience,
so a token for another service never leaves your machine. offline_access is dropped
from the scope: no refresh token is requested.
What is stored is one short-lived access token in ~/.hammerkit/credentials.json
(HAMMERKIT_CREDENTIALS picks another file), readable by you only (a file others can read is not used; hammerkit says how to fix it). A refresh token
is not kept: when the token expires, remote login again. The token is bound to the
URL and issuer it was issued for, so registering the name again for another server
(remote add --force) does not send the old token there.
Agents and CI do not use login. They bring their own token, an agent from its own
client credentials and a CI job from the OIDC token of the job, and the server maps
it to service accounts through its entitlements.
The remote commands take such a token instead of a sign-in, in this order:
| Variable | What it is |
|---|---|
HAMMERKIT_TOKEN_COMMAND | A command that prints the token, run for each command, such as a script that asks the identity provider for a service account. |
HAMMERKIT_TOKEN | The token itself, as a CI job gets it. |
publish:
id_tokens:
HAMMERKIT_TOKEN:
aud: hammerkit
script:
- hammerkit remote add build https://build.example.com --issuer https://gitlab.com
- hammerkit remote publish buildThe token goes only to the server the name is registered for.
A token command per server
The variables hold for every server. When servers want tokens of different service accounts or audiences, or you don't want to export a variable in every shell, register the command with the server:
hammerkit remote add ci https://ci.example.com --issuer https://accounts.google.com \
--token-command 'gcloud auth print-identity-token --audiences=hammerkit --include-email --impersonate-service-account=hammerkit-ci@my-project.iam.gserviceaccount.com'
hammerkit remote publish ciEvery remote command and remote mcp that talks to ci then runs
it for a token, and runs it again when the server stops accepting the token. It runs with
your environment and identity, through the shell, and has a minute to print the token alone
on stdout. When it fails, hammerkit says how it ended and shows what it printed on stderr;
what it printed on stdout is never shown, as it can hold more than the token. The order is:
| Source | Used for |
|---|---|
HAMMERKIT_TOKEN_COMMAND | Every server, so a CI job or an agent can bring its own identity. |
HAMMERKIT_TOKEN | Every server. |
remote add --token-command | The one server it is registered with. |
remote login | The one server it signed in to. |
A server with a token command needs no remote login, and remote login says so. A server
that offers no sign-in for its issuer (an issuer without a clientId in the server's config)
can only be reached with a token from elsewhere, and remote login points you to
--token-command.
The command lives in your host config only, like the server's URL: a build file can't name
one, since whoever writes it decides what runs on your machine. For the same reason keep the
host config writable by you only: whoever may edit it, an agent too, can make hammerkit run
any command, also in the agent plugins. remote add and
remote list print the command, so don't put a secret in it; point it at a script that
holds one instead. Make it print a token of a service account, see
Service accounts on Google Cloud, not of yourself.