woodpecker/docs/versioned_docs/version-2.7/30-administration/22-backends/20-local.md

68 lines
1.8 KiB
Markdown
Raw Normal View History

2024-03-19 07:36:20 +00:00
---
toc_max_heading_level: 3
---
# Local backend
:::danger
2024-07-18 12:57:03 +00:00
The local backend executes pipelines on the local system without any isolation.
2024-03-19 07:36:20 +00:00
:::
:::note
2024-07-18 12:57:03 +00:00
Currently we do not support [services](../../20-usage/60-services.md) for this backend.
2024-03-19 07:36:20 +00:00
[Read more here](https://github.com/woodpecker-ci/woodpecker/issues/3095).
:::
2024-07-18 12:57:03 +00:00
Since the commands run directly in the same context as the agent (same user, same
2024-03-19 07:36:20 +00:00
filesystem), a malicious pipeline could be used to access the agent
configuration especially the `WOODPECKER_AGENT_SECRET` variable.
It is recommended to use this backend only for private setup where the code and
2024-07-18 12:57:03 +00:00
pipeline can be trusted. It should not be used in a public instance where
anyone can submit code or add new repositories. The agent should not run as a privileged user (root).
2024-03-19 07:36:20 +00:00
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
2024-07-18 12:57:03 +00:00
[agent](https://github.com/woodpecker-ci/woodpecker/releases/latest), configure it and run it on the host machine.
2024-03-19 07:36:20 +00:00
## Usage
2024-07-18 12:57:03 +00:00
To enable the local backend, set the following:
2024-03-19 07:36:20 +00:00
```ini
WOODPECKER_BACKEND=local
```
### Shell
2024-07-18 12:57:03 +00:00
The `image` entrypoint is used to specify the shell, such as `bash` or `fish`, that is
2024-03-19 07:36:20 +00:00
used to run the commands.
```yaml title=".woodpecker.yaml"
steps:
- name: build
image: bash
commands: [...]
```
### Plugins
```yaml
steps:
- name: build
image: /usr/bin/tree
```
2024-07-18 12:57:03 +00:00
If no commands are provided, plugins are treated in the usual manner.
2024-03-19 07:36:20 +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.
### Options
#### `WOODPECKER_BACKEND_LOCAL_TEMP_DIR`
> Default: default temp directory
Directory to create folders for workflows.