-
-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamline docs for new users #3803
Merged
Merged
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
baea413
improve docs flow
anbraten b4ab0c9
update images
anbraten 6546e51
fix config
anbraten b984e1a
text
anbraten 88ed26c
Merge remote-tracking branch 'origin/main' into docs-getting-started
anbraten 2f7059f
Merge remote-tracking branch 'upstream/main' into docs-getting-started
anbraten 637bc07
improve docs
anbraten aa4958f
[pre-commit.ci] auto fixes from pre-commit.com hooks [CI SKIP]
pre-commit-ci[bot] 32e5bf9
review + fixes
anbraten dab8f1b
Merge branch 'docs-getting-started' of github.com:anbraten/woodpecker…
anbraten 2a7a5c0
Merge branch 'main' into docs-getting-started
anbraten 1070c9a
Merge branch 'main' into docs-getting-started
anbraten 9c4b152
Merge branch 'main' into docs-getting-started
anbraten a2c84f0
Merge branch 'main' into docs-getting-started
6543 b165f25
Merge branch 'main' into docs-getting-started
6543 26aee41
prettier
6543 11aa334
prettier2
6543 5145c76
fix pre-commit issue
6543 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 4 additions & 3 deletions
7
...k/2024-1-1-continuous-deployment/index.md → ...2024-01-01-continuous-deployment/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Welcome to Woodpecker | ||
|
||
Woodpecker is a CI/CD tool. It is designed to be lightweight, simple to use and fast. Before we dive into the details, let's have a look at some of the basics. | ||
|
||
## Have you ever heard of CI/CD or pipelines? | ||
|
||
Don't worry if you haven't. We'll guide you through the basics. CI/CD stands for Continuous Integration and Continuous Deployment. It's basically like a conveyor belt that moves your code from development to production doing all kinds of | ||
checks, tests and routines along the way. A typical pipeline might include the following steps: | ||
|
||
1. Running tests | ||
2. Building your application | ||
3. Deploying your application | ||
|
||
[Have a deeper look into the idea of CI/CD](https://www.redhat.com/en/topics/devops/what-is-ci-cd) | ||
|
||
## Do you know containers? | ||
|
||
If you are already using containers in your daily workflow, you'll for sure love Woodpecker. If not yet, you'll be amazed how easy it is to get started with [containers](https://opencontainers.org/). | ||
|
||
## Already have access to a Woodpecker instace? | ||
|
||
Then you might want to jump directly into it and [start creating your first pipelines](../20-usage/10-intro.md). | ||
|
||
## Want to start from scratch and deploy your own Woodpecker instance? | ||
|
||
Woodpecker is [pretty lightweight](../30-administration/00-getting-started.md#hardware-requirements) and will even run on your Raspberry Pi. You can follow the [deployment guide](../30-administration/00-getting-started.md) to set up your own Woodpecker instance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,108 @@ | ||
# Getting started | ||
# Your first pipeline | ||
|
||
## Repository Activation | ||
Let's get started and create your first pipeline. | ||
|
||
To activate your project navigate to your account settings. You will see a list of repositories which can be activated with a simple toggle. When you activate your repository, Woodpecker automatically adds webhooks to your forge (e.g. GitHub, Gitea, ...). | ||
## 1. Repository Activation | ||
|
||
Webhooks are used to trigger pipeline executions. When you push code to your repository, open a pull request, or create a tag, your forge will automatically send a webhook to Woodpecker which will in turn trigger the pipeline execution. | ||
To activate your repository in Woodpecker navigate to the repository list and `New repository`. You will see a list of repositories from your forge (GitHub, Gitlab, ...) which can be activated with a simple click. | ||
|
||
![repository list](repo-list.png) | ||
![new repository list](repo-new.png) | ||
|
||
## Required Permissions | ||
To enable a repository in Woodpecker you must have `Admin` rights on that repository, so that Woodpecker can add something | ||
that is called a webhook (Woodpecker needs it to know about actions like pushes, pull requests, tags, etc.). | ||
|
||
The user who enables a repo in Woodpecker must have `Admin` rights on that repo, so that Woodpecker can add the webhook. | ||
## 2. Define first workflow | ||
|
||
:::note | ||
Note that manually creating webhooks yourself is not possible. | ||
This is because webhooks are signed using a per-repository secret key which is not exposed to end users. | ||
::: | ||
After enabling a repository Woodpecker will listen for changes in your repository. When a change is detected, Woodpecker will check for a pipeline configuration. So let's create a file at `.woodpecker/my-first-workflow.yaml` inside your repository: | ||
|
||
## Configuration | ||
```yaml title=".woodpecker/my-first-workflow.yaml" | ||
when: | ||
- event: push | ||
branch: main | ||
|
||
To configure your pipeline you must create a `.woodpecker.yaml` file in the root of your repository. The `.woodpecker.yaml` file is used to define your pipeline steps. | ||
|
||
:::note | ||
We support most of YAML 1.2, but preserve some behavior from 1.1 for backward compatibility. | ||
Read more at: [https://github.com/go-yaml/yaml](https://github.com/go-yaml/yaml/tree/v3) | ||
::: | ||
|
||
Example pipeline configuration: | ||
|
||
```yaml | ||
steps: | ||
- name: build | ||
image: golang | ||
image: debian | ||
commands: | ||
- go get | ||
- go build | ||
- go test | ||
|
||
services: | ||
- name: postgres | ||
image: postgres:9.4.5 | ||
environment: | ||
- POSTGRES_USER=myapp | ||
- echo "This is the build step" | ||
- echo "binary-data-123" > executable | ||
- name: a-test-step | ||
image: golang:1.16 | ||
commands: | ||
- echo "Testing ..." | ||
- ./executable | ||
``` | ||
|
||
Example pipeline configuration with multiple, serial steps: | ||
__So what did we do here?__ | ||
|
||
```yaml | ||
steps: | ||
- name: backend | ||
image: golang | ||
commands: | ||
- go get | ||
- go build | ||
- go test | ||
1. We defined your first workflow file `my-first-workflow.yaml`. | ||
2. This workflow will be executed when a push event happens on the `main` branch, | ||
because we added a filter using the `when` section: | ||
```diff | ||
+ when: | ||
+ - event: push | ||
+ branch: main | ||
|
||
- name: frontend | ||
image: node:6 | ||
commands: | ||
- npm install | ||
- npm test | ||
... | ||
qwerty287 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
1. We defined two steps: `build` and `a-test-step` | ||
|
||
The steps are executed in the order they are defined, so `build` will be executed first and then `a-test-step`. | ||
|
||
In the `build` step we use the `debian` image and build a "binary file" called `executable`. | ||
|
||
In the `a-test-step` we use the `golang:1.16` image and run the `executable` file to test it. | ||
|
||
You can use any image from registries like the [Docker Hub](https://hub.docker.com/search?type=image) you have access to: | ||
|
||
```diff | ||
steps: | ||
- name: build | ||
- image: debian | ||
+ image: mycompany/image-with-awscli | ||
commands: | ||
- aws help | ||
``` | ||
|
||
- name: notify | ||
## 3. Push the file and trigger first pipeline | ||
|
||
If you push this file to your repository now, Woodpecker will already execute your first pipeline. | ||
|
||
You can check the pipeline execution in the Woodpecker UI by navigating to the `Pipelines` section of your repository. | ||
|
||
![pipeline view](./pipeline.png) | ||
|
||
As you probably noticed, there is another step in called `clone` which is executed before your steps. This step clones your repository into a folder called `workspace` which is available throughout all steps. | ||
|
||
This for example allows the first step to build your application using your source code and as the second step will receive | ||
the same workspace it can use the previously built binary and test it. | ||
|
||
## 4. Use a plugin for reusable tasks | ||
|
||
Sometimes you have some tasks that you need to do in every project. For example, deploying to Kubernetes or sending a Slack message. Therefore you can use one of the [official and community plugins](/plugins) or simply [create your own](./51-plugins/20-creating-plugins.md). | ||
|
||
If you want to get a Slack notification after your pipeline has finished, you can add a Slack plugin to your pipeline: | ||
|
||
```yaml | ||
... | ||
|
||
- name: notify me on Slack | ||
image: plugins/slack | ||
settings: | ||
channel: developers | ||
username: woodpecker | ||
password: | ||
from_secret: slack_token | ||
when: | ||
status: [ success, failure ] # This will execute the step on success and failure | ||
``` | ||
|
||
## Execution | ||
To configure a plugin you can use the `settings` section. | ||
|
||
Sometime you need to provide secrets to the plugin. You can do this by using the `from_secret` key. The secret must be defined in the Woodpecker UI. You can find more information about secrets [here](./40-secrets.md). | ||
|
||
Similar to the `when` section at the top of the file which is for the complete workflow, you can use the `when` section for each step to define when a step should be executed. | ||
|
||
Learn more about [plugins](./51-plugins/51-overview.md). | ||
|
||
To trigger your first pipeline execution you can push code to your repository, open a pull request, or push a tag. Any of these events triggers a webhook from your forge and execute your pipeline. | ||
As you now have a basic understanding of how to create a pipeline, you can dive deeper into the [workflow syntax](./20-workflow-syntax.md) and [plugins](./51-plugins/51-overview.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to leave it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree about it as this somehow is our "official" blog and a community post is not official in any way. The cookbook was the right place for it, but it was never used… Maybe we can just keep it in gh discussions ("show and tell" category)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs future discusssion but for now it is good to go on my side.
I like the itterative aproach :)