Before you start
- You run the runner. A managed runner has no destinations. For a managed build, use a proxied build variable.
- The tool can be pointed at another address. If it cannot, see When a secret must be a variable.
Other ways a build gets a variable
A destination is not the only way. A self-hosted build can also get the plain build variables of the factory. The runner’s owner and an Owner or Admin must both approve this once. See Build variables on a self-hosted runner. A variable the factory sends to a service reaches no self-hosted build yet.Add a destination
A destination’s header names a variable of the runner’s own environment, such as${NPM_TOKEN}. The runner refuses to start while that variable is unset.
So store the secret first.
1
Store the secret in the runner's environment
Under the service that
outerlayer runner init sets up, the runner’s
environment is the file runner.env beside the config file. That is
~/.outerlayer-runner/runner.env when you followed
Set up your first host, and ~/.outerlayer/runner.env under
an account of its own.read -rs keeps the secret off the screen and out of your shell history. The
umask and chmod make the file readable by your account only. On macOS and
Windows, run the commands inside the Linux VM or the WSL2 distribution.A runner in the runner image reads the secret from the file that you pass with
--env-file. Put the line in that file. See
Start the runner.2
Add the destination to the config file
List destinations in
runner.build.destinations:3
Restart the runner
The service reads If you gave the service another name with
runner.env only when it starts:--unit-name, restart that unit.
For a runner in the runner image, create the container again.outerlayer work status --json, under claims.
outerlayer runner check reads a header’s variables from your shell, not from
runner.env. It reports <VAR> is not set in the runner's environment unless
your shell holds the variable.
The keys of a destination
A runner takes at most 17 destinations. It refuses a key that is not in this table.
The runner refuses these variable names:
- In
env, a name that the runner sets itself, that another destination sets, or thatbuild.variablesnames. - In
header, a variable thatenvorbuild.variablesalso names. The build could then read the secret.
The local address
The local address depends on how the build runs:- A container or microVM build reaches the first
destination in the list at
http://127.0.0.1:3129/, the second at port3130, and so on. - With your own hooks, a command run through an
execuses the same ports. The hook must relay each port withouterlayer broker-relay --forward. See The tunnel and the proxy. - With your own hooks and no
exec, the command reaches the destination on a loopback port that the runner chooses.
What the runner forwards
The runner sets the destination’s header on each request. It drops theAuthorization, Proxy-Authorization and Cookie headers that the build
sends. It passes every other header as sent.
These limits apply:
- The runner does not rewrite answers. A tool that follows an absolute URL in
an answer leaves the local address, and reaches the upstream with no
credential. Set the tool to stay on the local address, such as npm’s
NPM_CONFIG_REPLACE_REGISTRY_HOST=alwaysabove. pip and Cargo have no such setting. - A WebSocket connection does not pass.
- The runner drops a request when the upstream sends nothing for 10 minutes.
Settings for common tools
Each row is a destination with the tool’s own variable inenv:
When a request fails
When the runner cannot forward a request, it answers502 with a short text
that names the destination:
If a new destination does not appear in builds, read the runner’s log. A
config re-read rejected line that names the destination’s header means its
variable is unset. The runner then keeps its earlier config, and applies no
other edit to the file. Store the variable and restart the runner.
When a secret must be a variable
A destination works only when the tool can be pointed at another address. The runner does not decrypt HTTPS traffic from the build. So a tool that reaches only the service’s real address cannot use a destination, such as a SaaS client with the address compiled in. For such a tool, name the secret inbuild.variables. It is then in the build’s
environment. The build’s record names the variable, never its value.