Skip to content

Commit

Permalink
Improve code blocks in docu (#2879)
Browse files Browse the repository at this point in the history
  • Loading branch information
micash545 authored Nov 26, 2023
1 parent 26b77ed commit b31b3e9
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 87 deletions.
12 changes: 4 additions & 8 deletions docs/docs/10-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"]
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions docs/docs/20-usage/20-workflow-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 4 additions & 12 deletions docs/docs/20-usage/25-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -44,9 +42,7 @@ steps:
- sleep 5
```
.woodpecker/.deploy.yml
```yaml
```yaml title=".woodpecker/.deploy.yml"
steps:
deploy:
image: debian:stable-slim
Expand All @@ -59,9 +55,7 @@ depends_on:
- test
```
.woodpecker/.test.yml
```yaml
```yaml title=".woodpecker/.test.yml"
steps:
test:
image: debian:stable-slim
Expand All @@ -73,9 +67,7 @@ depends_on:
- build
```
.woodpecker/.lint.yml
```yaml
```yaml title=".woodpecker/.lint.yml"
steps:
lint:
image: debian:stable-slim
Expand Down
21 changes: 7 additions & 14 deletions docs/docs/30-administration/00-deployment/10-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
21 changes: 7 additions & 14 deletions docs/docs/30-administration/10-server-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions docs/docs/30-administration/11-forges/30-gitea.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions docs/docs/30-administration/11-forges/40-gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions docs/docs/30-administration/11-forges/50-bitbucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions docs/docs/30-administration/15-agent-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
11 changes: 3 additions & 8 deletions docs/docs/30-administration/22-backends/20-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions docs/docs/30-administration/30-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
Loading

0 comments on commit b31b3e9

Please sign in to comment.