woodpecker/docs/docs/10-intro.md

90 lines
2.3 KiB
Markdown
Raw Normal View History

2019-11-13 14:47:14 +00:00
# Welcome to Woodpecker
2019-11-13 11:26:38 +00:00
Woodpecker is a simple yet powerful CI/CD engine with great extensibility. It focuses on executing pipelines inside [containers](https://opencontainers.org/).
If you are already using containers in your daily workflow, you'll for sure love Woodpecker.
2019-11-13 11:26:38 +00:00
![woodpecker](woodpecker.png)
2019-11-15 10:13:16 +00:00
## `.woodpecker.yaml`
2019-11-13 11:26:38 +00:00
- Place your pipeline in a file named `.woodpecker.yaml` in your repository
2019-11-13 14:47:14 +00:00
- Pipeline steps can be named as you like
- Run any command in the commands section
2019-11-13 11:26:38 +00:00
```yaml title=".woodpecker.yaml"
steps:
2024-01-22 07:18:50 +00:00
- name: build
2019-11-13 14:47:14 +00:00
image: debian
commands:
- echo "This is the build step"
2024-01-22 07:18:50 +00:00
- name: a-test-step
2019-11-13 14:47:14 +00:00
image: debian
commands:
- echo "Testing.."
```
### Steps are containers
2019-11-13 14:47:14 +00:00
- Define any container image as context
- either use your own and install the needed tools in a custom image
- or search for available images that are already tailored for your needs in image registries like [Docker Hub](https://hub.docker.com/search?type=image)
- List the commands that should be executed in the container
2019-11-13 14:47:14 +00:00
```diff
steps:
2024-01-22 07:18:50 +00:00
- name: build
- image: debian
+ image: mycompany/image-with-awscli
commands:
- aws help
2019-11-13 14:47:14 +00:00
```
2019-11-13 18:50:54 +00:00
### File changes are incremental
2019-11-13 14:47:14 +00:00
- 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
2019-11-13 14:47:14 +00:00
```yaml title=".woodpecker.yaml"
steps:
2024-01-22 07:18:50 +00:00
- name: build
2019-11-13 14:47:14 +00:00
image: debian
commands:
- touch myfile
2024-01-22 07:18:50 +00:00
- name: a-test-step
2019-11-13 14:47:14 +00:00
image: debian
commands:
- cat myfile
```
## Plugins are straightforward
2019-11-13 14:47:14 +00:00
- If you copy the same shell script from project to project
- Pack it into a plugin instead
- And make the yaml declarative
- Plugins are Docker images with your script as an entrypoint
```dockerfile title="Dockerfile"
2019-11-13 14:47:14 +00:00
FROM laszlocloud/kubectl
COPY deploy /usr/local/deploy
ENTRYPOINT ["/usr/local/deploy"]
```
```bash title="deploy"
2019-11-13 14:47:14 +00:00
kubectl apply -f $PLUGIN_TEMPLATE
```
```yaml title=".woodpecker.yaml"
steps:
2024-04-15 07:39:58 +00:00
- name: deploy-to-k8s
2019-11-13 14:47:14 +00:00
image: laszlocloud/my-k8s-plugin
settings:
template: config/k8s/service.yaml
2019-11-13 14:47:14 +00:00
```
2019-11-13 11:26:38 +00:00
See [plugin docs](./20-usage/51-plugins/51-overview.md).
2023-02-28 16:30:25 +00:00
## Continue reading
- [Create a Woodpecker pipeline for your repository](./20-usage/10-intro.md)
- [Setup your own Woodpecker instance](./30-administration/00-deployment/00-overview.md)