Moved all, will break pipelines up a bit more

This commit is contained in:
Laszlo Fogas
2019-11-15 11:35:48 +01:00
parent e155bb18af
commit 6ec3e2ede2
7 changed files with 17 additions and 64 deletions

1
docs/LICENSE Normal file
View File

@@ -0,0 +1 @@
Files in this folder are licensed under Creative Commons Attribution-ShareAlike 4.0 International Public License. It is a derivative work of the https://github.com/drone/docs git repository.

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@@ -82,3 +82,4 @@ pipeline:
template: config/k8s/service.yml
```
See a [detailed plugin example](/usage/bash-plugin).

1343
docs/docs/pipeline.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
# Writing a plugin
This provides a brief tutorial for creating a Woodpecker webhook plugin, using simple shell scripting, to make an http requests during the build pipeline.
## What end users will see
The below example demonstrates how we might configure a webhook plugin in the Yaml file:
```yaml
pipeline:
webhook:
image: foo/webhook
url: http://foo.com
method: post
body: |
hello world
```
## Write the logic
Create a simple shell script that invokes curl using the Yaml configuration parameters, which are passed to the script as environment variables in uppercase and prefixed with `PLUGIN_`.
```bash
#!/bin/sh
curl \
-X ${PLUGIN_METHOD} \
-d ${PLUGIN_BODY} \
${PLUGIN_URL}
```
## Package it
Create a Dockerfile that adds your shell script to the image, and configures the image to execute your shell script as the main entrypoint.
```dockerfile
FROM alpine
ADD script.sh /bin/
RUN chmod +x /bin/script.sh
RUN apk -Uuv add curl ca-certificates
ENTRYPOINT /bin/script.sh
```
Build and publish your plugin to the Docker registry. Once published your plugin can be shared with the broader Woodpecker community.
```nohighlight
docker build -t foo/webhook .
docker push foo/webhook
```
Execute your plugin locally from the command line to verify it is working:
```nohighlight
docker run --rm \
-e PLUGIN_METHOD=post \
-e PLUGIN_URL=http://foo.com \
-e PLUGIN_BODY="hello world" \
foo/webhook
```

View File

@@ -5,6 +5,7 @@ copyright: 'Creative Commons Attribution-ShareAlike 4.0 International Public Lic
nav:
- Home: index.md
- Server setup: server-setup.md
- Pipelines: pipeline.md
theme:
name: 'material'
logo: 'images/favicon.svg'