2024-01-08 17:40:43 +00:00
---
toc_max_heading_level: 3
---
2022-04-06 15:15:28 +00:00
# Local backend
2022-04-07 15:50:37 +00:00
2022-04-29 10:30:50 +00:00
:::danger
2022-04-07 15:50:37 +00:00
The local backend will execute the pipelines on the local system without any isolation of any kind.
2022-04-29 10:30:50 +00:00
:::
:::note
2023-12-31 17:36:23 +00:00
Currently we do not support services for this backend.
[Read more here ](https://github.com/woodpecker-ci/woodpecker/issues/3095 ).
2022-04-29 10:30:50 +00:00
:::
2022-04-07 15:50:37 +00:00
2022-08-14 14:43:06 +00:00
Since the code runs directly in the same context as the agent (same user, same
filesystem), a malicious pipeline could be used to access the agent
configuration especially the `WOODPECKER_AGENT_SECRET` variable.
2022-04-07 15:50:37 +00:00
2022-08-14 14:43:06 +00:00
It is recommended to use this backend only for private setup where the code and
pipeline can be trusted. You shouldn't use it for a public facing CI where
anyone can submit code or add new repositories. You shouldn't execute the agent
as a privileged user (root).
The local backend will use a random directory in $TMPDIR to store the cloned
code and execute commands.
In order to use this backend, you need to download (or build) the
[binary ](https://github.com/woodpecker-ci/woodpecker/releases/latest ) of the
agent, configure it and run it on the host machine.
2024-01-11 17:43:54 +00:00
## Usage
2022-08-14 14:43:06 +00:00
2024-01-11 17:43:54 +00:00
To enable the local backend, add this to your configuration:
2022-08-14 14:43:06 +00:00
```ini
2024-01-11 17:43:54 +00:00
WOODPECKER_BACKEND=local
2022-08-14 14:43:06 +00:00
```
2024-01-11 17:43:54 +00:00
### Shell
2022-08-14 14:43:06 +00:00
The `image` entry is used to specify the shell, such as Bash or Fish, that is
used to run the commands.
2024-01-11 17:43:54 +00:00
```yaml title=".woodpecker.yaml"
2023-06-07 10:04:37 +00:00
steps:
2022-08-14 14:43:06 +00:00
build:
image: bash
2023-10-24 12:42:05 +00:00
commands: [...]
2022-08-14 14:43:06 +00:00
```
2024-01-11 17:43:54 +00:00
### Plugins
Plugins are just executable binaries:
2023-08-22 20:00:32 +00:00
```yaml
steps:
build:
image: /usr/bin/tree
```
2023-10-17 08:31:08 +00:00
If no commands are provided, we treat them as plugins in the usual manner.
2023-08-22 20:00:32 +00:00
In the context of the local backend, plugins are simply executable binaries, which can be located using their name if they are listed in `$PATH` , or through an absolute path.
2024-01-11 17:43:54 +00:00
### Options
2022-08-14 14:43:06 +00:00
2024-01-11 17:43:54 +00:00
#### `WOODPECKER_BACKEND_LOCAL_TEMP_DIR`
2023-11-02 14:45:18 +00:00
2024-01-11 17:43:54 +00:00
> Default: default temp directory
2023-11-02 14:45:18 +00:00
2024-01-11 17:43:54 +00:00
Directory to create folders for workflows.