mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 00:46:30 +00:00
Improve code blocks in docu (#2879)
This commit is contained in:
parent
26b77ed677
commit
b31b3e9a86
13 changed files with 41 additions and 87 deletions
|
@ -11,8 +11,7 @@ If you are already using containers in your daily workflow, you'll for sure love
|
|||
- Pipeline steps can be named as you like
|
||||
- Run any command in the commands section
|
||||
|
||||
```yaml
|
||||
# .woodpecker.yml
|
||||
```yaml title=".woodpecker.yml"
|
||||
steps:
|
||||
build:
|
||||
image: debian
|
||||
|
@ -45,8 +44,7 @@ steps:
|
|||
- Woodpecker clones the source code in the beginning
|
||||
- File changes are persisted throughout individual steps as the same volume is being mounted in all steps
|
||||
|
||||
```yaml
|
||||
# .woodpecker.yml
|
||||
```yaml title=".woodpecker.yml"
|
||||
steps:
|
||||
build:
|
||||
image: debian
|
||||
|
@ -65,8 +63,7 @@ steps:
|
|||
- And make the yaml declarative
|
||||
- Plugins are Docker images with your script as an entrypoint
|
||||
|
||||
```Dockerfile
|
||||
# Dockerfile
|
||||
```yaml title="Dockerfile"
|
||||
FROM laszlocloud/kubectl
|
||||
COPY deploy /usr/local/deploy
|
||||
ENTRYPOINT ["/usr/local/deploy"]
|
||||
|
@ -77,8 +74,7 @@ ENTRYPOINT ["/usr/local/deploy"]
|
|||
kubectl apply -f $PLUGIN_TEMPLATE
|
||||
```
|
||||
|
||||
```yaml
|
||||
# .woodpecker.yml
|
||||
```yaml title=".woodpecker.yml"
|
||||
steps:
|
||||
deploy-to-k8s:
|
||||
image: laszlocloud/my-k8s-plugin
|
||||
|
|
|
@ -67,8 +67,7 @@ The associated commit is checked out with git to a workspace which is mounted to
|
|||
- Woodpecker clones the source code in the beginning of the workflow
|
||||
- Changes to files are persisted through steps as the same volume is mounted to all steps
|
||||
|
||||
```yaml
|
||||
# .woodpecker.yml
|
||||
```yaml title=".woodpecker.yml"
|
||||
steps:
|
||||
build:
|
||||
image: debian
|
||||
|
|
|
@ -33,9 +33,7 @@ If you still need to pass artifacts between the workflows you need use some stor
|
|||
└── .test.yml
|
||||
```
|
||||
|
||||
.woodpecker/.build.yml
|
||||
|
||||
```yaml
|
||||
```yaml title=".woodpecker/.build.yml"
|
||||
steps:
|
||||
build:
|
||||
image: debian:stable-slim
|
||||
|
@ -44,9 +42,7 @@ steps:
|
|||
- sleep 5
|
||||
```
|
||||
|
||||
.woodpecker/.deploy.yml
|
||||
|
||||
```yaml
|
||||
```yaml title=".woodpecker/.deploy.yml"
|
||||
steps:
|
||||
deploy:
|
||||
image: debian:stable-slim
|
||||
|
@ -59,9 +55,7 @@ depends_on:
|
|||
- test
|
||||
```
|
||||
|
||||
.woodpecker/.test.yml
|
||||
|
||||
```yaml
|
||||
```yaml title=".woodpecker/.test.yml"
|
||||
steps:
|
||||
test:
|
||||
image: debian:stable-slim
|
||||
|
@ -73,9 +67,7 @@ depends_on:
|
|||
- build
|
||||
```
|
||||
|
||||
.woodpecker/.lint.yml
|
||||
|
||||
```yaml
|
||||
```yaml title=".woodpecker/.lint.yml"
|
||||
steps:
|
||||
lint:
|
||||
image: debian:stable-slim
|
||||
|
|
|
@ -4,8 +4,7 @@ The below [docker-compose](https://docs.docker.com/compose/) configuration can b
|
|||
|
||||
It relies on a number of environment variables that you must set before running `docker-compose up`. The variables are described below.
|
||||
|
||||
```yaml
|
||||
# docker-compose.yml
|
||||
```yaml title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -43,8 +42,7 @@ volumes:
|
|||
|
||||
Woodpecker needs to know its own address. You must therefore provide the public address of it in `<scheme>://<hostname>` format. Please omit trailing slashes:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -58,8 +56,7 @@ services:
|
|||
Woodpecker can also have its port's configured. It uses a separate port for gRPC and for HTTP. The agent performs gRPC calls and connects to the gRPC port.
|
||||
They can be configured with ADDR variables:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
services:
|
||||
woodpecker-server:
|
||||
|
@ -72,8 +69,7 @@ services:
|
|||
|
||||
Reverse proxying can also be [configured for gRPC](../proxy#caddy). If the agents are connecting over the internet, it should also be SSL encrypted. The agent then needs to be configured to be secure:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
services:
|
||||
woodpecker-server:
|
||||
|
@ -86,8 +82,7 @@ services:
|
|||
|
||||
As agents run pipeline steps as docker containers they require access to the host machine's Docker daemon:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -100,8 +95,7 @@ services:
|
|||
|
||||
Agents require the server address for agent-to-server communication. The agent connects to the server's gRPC port:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -113,8 +107,7 @@ services:
|
|||
|
||||
The server and agents use a shared secret to authenticate communication. This should be a random string of your choosing and should be kept private. You can generate such string with `openssl rand -hex 32`:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -8,8 +8,7 @@ Registration is closed by default (`WOODPECKER_OPEN=false`). If registration is
|
|||
|
||||
To open registration:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -27,8 +26,7 @@ by open registration and **filter by organization** membership through the `WOOD
|
|||
|
||||
### To close registration, but allow specific admin users
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -42,8 +40,7 @@ services:
|
|||
|
||||
### To only allow registration of users, who are members of approved organizations
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -59,8 +56,7 @@ services:
|
|||
|
||||
Administrators should also be enumerated in your configuration.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -77,8 +73,7 @@ Woodpecker operates with the user's OAuth permission. Due to the coarse permissi
|
|||
|
||||
Use the `WOODPECKER_REPO_OWNERS` variable to filter which GitHub user's repos should be synced only. You typically want to put here your company's GitHub name.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -94,8 +89,7 @@ services:
|
|||
If you want to make available a specific private registry to all pipelines, use the `WOODPECKER_DOCKER_CONFIG` server configuration.
|
||||
Point it to your server's docker config.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -117,8 +111,7 @@ For docker-compose you can use a .env file next to your compose configuration to
|
|||
|
||||
Alternatively use docker-secrets. As it may be difficult to use docker secrets for environment variables woodpecker allows to read sensible data from files by providing a `*_FILE` option of all sensible configuration variables. Woodpecker will try to read the value directly from this file. Keep in mind that when the original environment variable gets specified at the same time it will override the value read from the file.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
Woodpecker comes with built-in support for Gitea and the "soft" fork Forgejo. To enable Gitea you should configure the Woodpecker container using the following environment variables:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -28,8 +27,7 @@ Otherwise, the communication should go via the `docker0` gateway (usually 172.17
|
|||
|
||||
To configure the Docker network if the network's name is `gitea`, configure it like this:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
Woodpecker comes with built-in support for the GitLab version 8.2 and higher. To enable GitLab you should configure the Woodpecker container using the following environment variables:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
Woodpecker comes with built-in support for Bitbucket Cloud. To enable Bitbucket Cloud you should configure the Woodpecker container using the following environment variables:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
Agents are configured by the command line or environment variables. At the minimum you need the following information:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -25,8 +24,7 @@ The following are automatically set and can be overridden:
|
|||
|
||||
By default, the maximum workflows that are executed in parallel on an agent is 1. If required, you can add `WOODPECKER_MAX_WORKFLOWS` to increase your parallel processing for an agent.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -32,8 +32,7 @@ agent, configure it and run it on the host machine.
|
|||
Enable connection to the server from the outside of the docker environment by
|
||||
exposing the port 9000:
|
||||
|
||||
```yaml
|
||||
# docker-compose.yml for the server
|
||||
```yaml title="docker-compose.yml" for the server
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -77,9 +76,7 @@ manual clone step.
|
|||
The `image` entry is used to specify the shell, such as Bash or Fish, that is
|
||||
used to run the commands.
|
||||
|
||||
```yaml
|
||||
# .woodpecker.yml
|
||||
|
||||
```yaml title=".woodpecker.yml"
|
||||
steps:
|
||||
build:
|
||||
image: bash
|
||||
|
@ -114,9 +111,7 @@ WOODPECKER_FILTER_LABELS=type=exec
|
|||
Then, use this `label` `type` with value `exec` in the pipeline definition, to
|
||||
only run on this agent:
|
||||
|
||||
```yaml
|
||||
# .woodpecker.yml
|
||||
|
||||
```yaml title=".woodpecker.yml"
|
||||
labels:
|
||||
type: exec
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ The default database engine of Woodpecker is an embedded SQLite database which r
|
|||
|
||||
By default Woodpecker uses a SQLite database stored under `/var/lib/woodpecker/`. You can mount a [data volume](https://docs.docker.com/storage/volumes/#create-and-manage-volumes) to persist the SQLite database.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -22,8 +21,7 @@ services:
|
|||
The below example demonstrates MySQL database configuration. See the official driver [documentation](https://github.com/go-sql-driver/mysql#dsn-data-source-name) for configuration options and examples.
|
||||
The minimum version of MySQL/MariaDB required is determined by the `go-sql-driver/mysql` - see [it's README](https://github.com/go-sql-driver/mysql#requirements) for more information.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -39,8 +37,7 @@ services:
|
|||
The below example demonstrates Postgres database configuration. See the official driver [documentation](https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING) for configuration options and examples.
|
||||
Please use Postgres versions equal or higher than **11**.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -9,8 +9,7 @@ Woodpecker supports automated SSL configuration and updates using Let's Encrypt.
|
|||
|
||||
You can enable Let's Encrypt by making the following modifications to your server configuration:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -44,8 +43,7 @@ Woodpecker uses the official Go acme library which will handle certificate upgra
|
|||
|
||||
Woodpecker supports SSL configuration by mounting certificates into your container.
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -66,8 +64,7 @@ services:
|
|||
|
||||
Update your configuration to expose the following ports:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -81,8 +78,7 @@ services:
|
|||
|
||||
Update your configuration to mount your certificate and key:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```diff title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
@ -99,8 +95,7 @@ services:
|
|||
|
||||
Update your configuration to provide the paths of your certificate and key:
|
||||
|
||||
```diff
|
||||
# docker-compose.yml
|
||||
```yaml title="docker-compose.yml"
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -138,7 +138,7 @@ const config: Config = {
|
|||
prism: {
|
||||
theme: themes.github,
|
||||
darkTheme: themes.dracula,
|
||||
additionalLanguages: ['diff', 'json', 'docker', 'javascript', 'css', 'bash', 'nginx', 'apacheconf'],
|
||||
additionalLanguages: ['diff', 'json', 'docker', 'javascript', 'css', 'bash', 'nginx', 'apacheconf', 'ini', 'nix'],
|
||||
},
|
||||
announcementBar: {
|
||||
id: 'github-star',
|
||||
|
|
Loading…
Reference in a new issue