Update docusaurus to v3 (#2732)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: pat-s <patrick.schratz@gmail.com>
This commit is contained in:
qwerty287 2023-11-05 10:43:44 +01:00 committed by GitHub
parent 45a5a2dde5
commit 8946d2099c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 2104 additions and 417 deletions

View file

@ -44,7 +44,7 @@ Keep in mind the name is optional, if not added the steps will be numerated.
Woodpecker gives the ability to skip individual commits by adding `[SKIP CI]` or `[CI SKIP]` to the commit message. Note this is case-insensitive. Woodpecker gives the ability to skip individual commits by adding `[SKIP CI]` or `[CI SKIP]` to the commit message. Note this is case-insensitive.
```sh ```bash
git commit -m "updated README [CI SKIP]" git commit -m "updated README [CI SKIP]"
``` ```
@ -139,7 +139,7 @@ Commands of every step are executed serially as if you would enter them into you
There is no magic here. The above commands are converted to a simple shell script. The commands in the above example are roughly converted to the below script: There is no magic here. The above commands are converted to a simple shell script. The commands in the above example are roughly converted to the below script:
```sh ```bash
#!/bin/sh #!/bin/sh
set -e set -e
@ -149,7 +149,7 @@ go test
The above shell script is then executed as the container entrypoint. The below docker command is an (incomplete) example of how the script is executed: The above shell script is then executed as the container entrypoint. The below docker command is an (incomplete) example of how the script is executed:
```sh ```bash
docker run --entrypoint=build.sh golang docker run --entrypoint=build.sh golang
``` ```
@ -538,7 +538,7 @@ The base attribute defines a shared base volume available to all steps. This ens
This would be equivalent to the following docker commands: This would be equivalent to the following docker commands:
```sh ```bash
docker volume create my-named-volume docker volume create my-named-volume
docker run --volume=my-named-volume:/go golang:latest docker run --volume=my-named-volume:/go golang:latest

View file

@ -6,7 +6,7 @@ The below configuration composes database and cache containers.
Services are accessed using custom hostnames. Services are accessed using custom hostnames.
In the example below, the MySQL service is assigned the hostname `database` and is available at `database:3306`. In the example below, the MySQL service is assigned the hostname `database` and is available at `database:3306`.
```diff ```yaml
steps: steps:
build: build:
image: golang image: golang
@ -82,7 +82,7 @@ services:
## Complete Pipeline Example ## Complete Pipeline Example
```yml ```yaml
services: services:
database: database:
image: mysql image: mysql

View file

@ -10,7 +10,7 @@ You can use [YAML anchors & aliases](https://yaml.org/spec/1.2.2/#3222-anchors-a
To convert this: To convert this:
```yml ```yaml
steps: steps:
test: test:
image: golang:1.18 image: golang:1.18
@ -103,7 +103,7 @@ steps:
One can create a file containing environment variables, and then source it in each step that needs them. One can create a file containing environment variables, and then source it in each step that needs them.
```yml ```yaml
steps: steps:
init: init:
image: bash image: bash
@ -122,7 +122,7 @@ steps:
As described in [Global environment variables](./50-environment.md#global-environment-variables), one can define global variables: As described in [Global environment variables](./50-environment.md#global-environment-variables), one can define global variables:
```yml ```yaml
services: services:
woodpecker-server: woodpecker-server:
# ... # ...

View file

@ -13,7 +13,7 @@ You need to trust the external config service as it is getting secret informatio
## Config ## Config
```shell ```bash
# Server # Server
# ... # ...
WOODPECKER_CONFIG_SERVICE_ENDPOINT=https://example.com/ciconfig WOODPECKER_CONFIG_SERVICE_ENDPOINT=https://example.com/ciconfig

View file

@ -3,7 +3,7 @@
Woodpecker comes with built-in support for GitHub and GitHub Enterprise. Woodpecker comes with built-in support for GitHub and GitHub Enterprise.
To use Woodpecker with GitHub the following environment variables should be set for the server component: To use Woodpecker with GitHub the following environment variables should be set for the server component:
```sh ```bash
WOODPECKER_GITHUB=true WOODPECKER_GITHUB=true
WOODPECKER_GITHUB_CLIENT=YOUR_GITHUB_CLIENT_ID WOODPECKER_GITHUB_CLIENT=YOUR_GITHUB_CLIENT_ID
WOODPECKER_GITHUB_SECRET=YOUR_GITHUB_CLIENT_SECRET WOODPECKER_GITHUB_SECRET=YOUR_GITHUB_CLIENT_SECRET

View file

@ -51,12 +51,12 @@ The following commands **are destructive** and **irreversible** it is highly rec
### Remove all unused images ### Remove all unused images
```sh ```bash
docker image rm $(docker images --filter "dangling=true" -q --no-trunc) docker image rm $(docker images --filter "dangling=true" -q --no-trunc)
``` ```
### Remove Woodpecker Volumes ### Remove Woodpecker Volumes
```sh ```bash
docker volume rm $(docker volume ls --filter name=^wp_* --filter dangling=true -q) docker volume rm $(docker volume ls --filter name=^wp_* --filter dangling=true -q)
``` ```

View file

@ -99,9 +99,8 @@ In the context of the local backend, plugins are simply executable binaries, whi
### Using labels to filter tasks ### Using labels to filter tasks
You can use the [agent configuration You can use the [agent configuration options](../15-agent-config.md#woodpecker_filter_labels)
options](../15-agent-config.md#woodpecker_filter_labels) and the and the [pipeline syntax](../../20-usage/20-workflow-syntax.md#labels) to only run certain
[pipeline syntax](../../20-usage/20-workflow-syntax.md#labels) to only run certain
pipelines on certain agents. Example: pipelines on certain agents. Example:
Define a `label` `type` with value `exec` for a particular agent: Define a `label` `type` with value `exec` for a particular agent:

View file

@ -12,7 +12,7 @@ The kubernetes backend executes steps inside standalone pods. A temporary PVC is
These env vars can be set in the `env:` sections of both `server` and `agent`. These env vars can be set in the `env:` sections of both `server` and `agent`.
They do not need to be set for both but only for the part to which it is relevant to. They do not need to be set for both but only for the part to which it is relevant to.
```yml ```yaml
server: server:
env: env:
WOODPECKER_SESSION_EXPIRES: "300h" WOODPECKER_SESSION_EXPIRES: "300h"
@ -56,7 +56,7 @@ We recommend to add a `resources` definition to all steps to ensure efficient sc
Here is an example definition with an arbitrary `resources` definition below the `backend_options` section: Here is an example definition with an arbitrary `resources` definition below the `backend_options` section:
```yml ```yaml
steps: steps:
'My kubernetes step': 'My kubernetes step':
image: alpine image: alpine
@ -90,7 +90,7 @@ To overwrite this, one needs to set the label in the `nodeSelector` section of t
A practical example for this is when running a matrix-build and delegating specific elements of the matrix to run on a specific architecture. A practical example for this is when running a matrix-build and delegating specific elements of the matrix to run on a specific architecture.
In this case, one must define an arbitrary key in the matrix section of the respective matrix element: In this case, one must define an arbitrary key in the matrix section of the respective matrix element:
```yml ```yaml
matrix: matrix:
include: include:
- NAME: runner1 - NAME: runner1
@ -99,7 +99,7 @@ matrix:
And then overwrite the `nodeSelector` in the `backend_options` section of the step(s) using the name of the respective env var: And then overwrite the `nodeSelector` in the `backend_options` section of the step(s) using the name of the respective env var:
```yml ```yaml
[...] [...]
backend_options: backend_options:
kubernetes: kubernetes:
@ -164,7 +164,7 @@ steps:
CRI-O users currently need to configure the workspace for all workflows in order for them to run correctly. Add the following at the beginning of your configuration: CRI-O users currently need to configure the workspace for all workflows in order for them to run correctly. Add the following at the beginning of your configuration:
```yml ```yaml
workspace: workspace:
base: '/woodpecker' base: '/woodpecker'
path: '/' path: '/'

View file

@ -66,7 +66,7 @@ to use while encrypting new data.
Keyset generation example: Keyset generation example:
```shell ```bash
tinkey create-keyset --key-template AES256_GCM --out-format json --out keyset.json tinkey create-keyset --key-template AES256_GCM --out-format json --out keyset.json
``` ```
@ -74,7 +74,7 @@ tinkey create-keyset --key-template AES256_GCM --out-format json --out keyset.js
Use `tinkey` to rotate encryption keys in your existing keyset: Use `tinkey` to rotate encryption keys in your existing keyset:
```shell ```bash
tinkey rotate-keyset --in keyset_v1.json --out keyset_v2.json --key-template AES256_GCM tinkey rotate-keyset --in keyset_v1.json --out keyset_v2.json --key-template AES256_GCM
``` ```

View file

@ -4,7 +4,7 @@
This guide provides a brief overview for installing Woodpecker server behind the Apache2 web-server. This is an example configuration: This guide provides a brief overview for installing Woodpecker server behind the Apache2 web-server. This is an example configuration:
```nohighlight ```apacheconf
ProxyPreserveHost On ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https" RequestHeader set X-Forwarded-Proto "https"
@ -112,7 +112,7 @@ Set `WOODPECKER_HOST` (for example in `docker-compose.yml`) to the ngrok URL (us
To install the Woodpecker server behind a [Traefik](https://traefik.io/) load balancer, you must expose both the `http` and the `gRPC` ports. Here is a comprehensive example, considering you are running Traefik with docker swarm and want to do TLS termination and automatic redirection from http to https. To install the Woodpecker server behind a [Traefik](https://traefik.io/) load balancer, you must expose both the `http` and the `gRPC` ports. Here is a comprehensive example, considering you are running Traefik with docker swarm and want to do TLS termination and automatic redirection from http to https.
```yml ```yaml
version: '3.8' version: '3.8'
services: services:

View file

@ -54,19 +54,19 @@ More enhanced information you can find here <https://github.com/swaggo/swag/blob
#### generate the server's Go code containing the Swagger #### generate the server's Go code containing the Swagger
```shell ```bash
make generate-swagger make generate-swagger
``` ```
##### update the Markdown in the ./docs folder ##### update the Markdown in the ./docs folder
```shell ```bash
make docs make docs
``` ```
##### auto-format swagger related godoc ##### auto-format swagger related godoc
```shell ```bash
go run github.com/swaggo/swag/cmd/swag@latest fmt -g server/api/z.go go run github.com/swaggo/swag/cmd/swag@latest fmt -g server/api/z.go
``` ```

View file

@ -1,8 +1,9 @@
const codeThemes = require('prism-react-renderer').themes; import { themes } from 'prism-react-renderer';
const path = require('path'); import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import * as path from 'path';
/** @type {import('@docusaurus/types').Config} */ const config: Config = {
module.exports = {
title: 'Woodpecker CI', title: 'Woodpecker CI',
tagline: 'Woodpecker is a simple CI engine with great extensibility.', tagline: 'Woodpecker is a simple CI engine with great extensibility.',
url: 'https://woodpecker-ci.org', url: 'https://woodpecker-ci.org',
@ -14,7 +15,6 @@ module.exports = {
projectName: 'woodpecker-ci.github.io', projectName: 'woodpecker-ci.github.io',
trailingSlash: false, trailingSlash: false,
themeConfig: themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({ ({
navbar: { navbar: {
title: 'Woodpecker', title: 'Woodpecker',
@ -137,8 +137,9 @@ module.exports = {
copyright: `Copyright © ${new Date().getFullYear()} Woodpecker CI. Built with Docusaurus.`, copyright: `Copyright © ${new Date().getFullYear()} Woodpecker CI. Built with Docusaurus.`,
}, },
prism: { prism: {
theme: codeThemes.github, theme: themes.github,
darkTheme: codeThemes.dracula, darkTheme: themes.dracula,
additionalLanguages: ['diff', 'json', 'docker', 'javascript', 'css', 'bash', 'nginx', 'apacheconf'],
}, },
announcementBar: { announcementBar: {
id: 'github-star', id: 'github-star',
@ -153,7 +154,7 @@ module.exports = {
colorMode: { colorMode: {
respectPrefersColorScheme: true, respectPrefersColorScheme: true,
}, },
}), } satisfies Preset.ThemeConfig),
plugins: [ plugins: [
() => ({ () => ({
name: 'docusaurus-plugin-favicon', name: 'docusaurus-plugin-favicon',
@ -205,7 +206,6 @@ module.exports = {
presets: [ presets: [
[ [
'@docusaurus/preset-classic', '@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({ ({
docs: { docs: {
sidebarPath: require.resolve('./sidebars.js'), sidebarPath: require.resolve('./sidebars.js'),
@ -235,7 +235,7 @@ module.exports = {
theme: { theme: {
customCss: require.resolve('./src/css/custom.css'), customCss: require.resolve('./src/css/custom.css'),
}, },
}), } satisfies Preset.Options),
], ],
[ [
'redocusaurus', 'redocusaurus',
@ -264,4 +264,9 @@ module.exports = {
}, },
}), }),
}, },
markdown: {
format: 'detect'
}
}; };
export default config;

View file

@ -14,18 +14,18 @@
"write-heading-ids": "docusaurus write-heading-ids" "write-heading-ids": "docusaurus write-heading-ids"
}, },
"dependencies": { "dependencies": {
"@docusaurus/core": "^2.4.1", "@docusaurus/core": "^3.0.0",
"@docusaurus/preset-classic": "^2.4.1", "@docusaurus/preset-classic": "^3.0.0",
"@easyops-cn/docusaurus-search-local": "^0.36.0", "@easyops-cn/docusaurus-search-local": "^0.36.0",
"@mdx-js/react": "^1.6.22", "@mdx-js/react": "^3.0.0",
"@svgr/webpack": "^8.0.0", "@svgr/webpack": "^8.0.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"esbuild-loader": "^4.0.0", "esbuild-loader": "^4.0.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"prism-react-renderer": "^2.0.0", "prism-react-renderer": "^2.1.0",
"react": "^18.0.0", "react": "^18.2.0",
"react-dom": "^18.0.0", "react-dom": "^18.2.0",
"redocusaurus": "^1.6.3", "redocusaurus": "^2.0.0",
"url-loader": "^4.1.1" "url-loader": "^4.1.1"
}, },
"browserslist": { "browserslist": {
@ -41,8 +41,10 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.1", "@docusaurus/module-type-aliases": "^3.0.0",
"@tsconfig/docusaurus": "^2.0.0", "@docusaurus/tsconfig": "3.0.0",
"@docusaurus/types": "^3.0.0",
"@types/node": "^20.0.0",
"@types/react": "^18.2.31", "@types/react": "^18.2.31",
"@types/react-helmet": "^6.1.6", "@types/react-helmet": "^6.1.6",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "^5.3.3",
@ -53,5 +55,11 @@
"trim": "^0.0.3", "trim": "^0.0.3",
"got": "^11.8.5" "got": "^11.8.5"
} }
},
"overrides": {
"@easyops-cn/docusaurus-search-local": {
"@docusaurus/core": "^3.0.0",
"@docusaurus/theme-common": "^3.0.0"
}
} }
} }

View file

@ -10,9 +10,9 @@
"style": "mkdir -p dist/theme/ && cp src/theme/style.css dist/theme/style.css" "style": "mkdir -p dist/theme/ && cp src/theme/style.css dist/theme/style.css"
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.1", "@docusaurus/module-type-aliases": "^3.0.0",
"@docusaurus/theme-classic": "^2.4.1", "@docusaurus/theme-classic": "^3.0.0",
"@docusaurus/types": "^2.4.1", "@docusaurus/types": "^3.0.0",
"@tsconfig/docusaurus": "^2.0.0", "@tsconfig/docusaurus": "^2.0.0",
"@types/marked": "^5.0.0", "@types/marked": "^5.0.0",
"@types/node": "^20.0.0", "@types/node": "^20.0.0",

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
{ {
"extends": "@tsconfig/docusaurus/tsconfig.json", "extends": "@docusaurus/tsconfig",
"include": ["src/"] "include": ["src/"]
} }

View file

@ -90,9 +90,8 @@ steps:
### Using labels to filter tasks ### Using labels to filter tasks
You can use the [agent configuration You can use the [agent configuration options](../15-agent-config.md#woodpecker_filter_labels)
options](../15-agent-config.md#woodpecker_filter_labels) and the and the [pipeline syntax](../../20-usage/20-pipeline-syntax.md#labels) to only run certain
[pipeline syntax](../../20-usage/20-pipeline-syntax.md#labels) to only run certain
pipelines on certain agents. Example: pipelines on certain agents. Example:
Define a `label` `type` with value `exec` for a particular agent: Define a `label` `type` with value `exec` for a particular agent: