If you want to start development or updating docs as easy as possible you can use our preconfigured setup for Woodpecker using Gitpod. Gitpod starts a complete development setup in the cloud containing:
- An IDE in the browser or bridged to your local VS-Code or Jetbrains
- A preconfigured Gitea instance as forge
- A preconfigured Woodpecker server
- A single preconfigured Woodpecker agent node
- Our docs preview server
Simply start Woodpecker in Gitpod by clicking on the following badge. You can login with
Preparation for local development
Install Golang (>=1.20) as described by this guide.
GNU Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files (https://www.gnu.org/software/make/).
Install make on:
Install Node.js & pnpm
Install Node.js (>=14) if you want to build Woodpeckers UI or documentation.
For dependencies installation (node_modules) for the UI and documentation of Woodpecker the package-manager pnpm is used. The installation of pnpm is described by this guide.
.env file with your development configuration
Similar to the environment variables you can set for your production setup of Woodpecker, you can create a
.env in the root of the Woodpecker project and add any need config to it.
A common config for debugging would look like this:
# if you want to test webhooks with an online forge like GitHub this address needs to be accessible from public server
# github (sample for a forge config - see /docs/administration/forge/overview for other forges)
# enable if you want to develop the UI
# used so you can login without using a public address
# disable health-checks while debugging (normally not needed while developing)
Create an O-Auth app for your forge as describe in the forges documentation. If you set
WOODPECKER_DEV_OAUTH_HOST=http://localhost:8000 you can use that address with the path as explained for the specific forge to login without the need for a public address. For example for GitHub you would use
http://localhost:8000/authorize as authorization callback URL.
Developing with VS-Code
You can use different methods for debugging the Woodpecker applications. One of the currently recommended ways to debug and test the Woodpecker application is using VS-Code or VS-Codium (Open-Source binaries of VS-Code) as most maintainers are using it and Woodpecker already includes the needed debug configurations for it.
To launch all needed services for local development you can use "Woodpecker CI" debugging configuration that will launch UI, server and agent in debugging mode. Then open
http://localhost:8000 to access it.
The Woodpecker source code already includes launch configurations for the Woodpecker server and agent. To start debugging you can click on the debug icon in the navigation bar of VS-Code (ctrl-shift-d). On that page you will see the existing launch jobs at the top. Simply select the agent or server and click on the play button. You can set breakpoints in the source files to stop at specific points.
Testing & linting code
To test or lint parts of Woodpecker you can run one of the following commands:
# test server code
# test agent code
# test cli code
# test datastore / database related code like migrations of the server
# lint go code
# lint UI code
# test UI code
If you want to test a specific go file you can also use:
go test -race -timeout 30s go.woodpecker-ci.org/woodpecker/v2/<path-to-the-package-or-file-to-test>
Or you can open the test-file inside VS-Code and run or debug the test by clicking on the inline commands:
Run applications from terminal
If you want to run a Woodpecker applications from your terminal you can use one of the following commands from the base of the Woodpecker project. They will execute Woodpecker in a similar way as described in debugging Woodpecker without the ability to really debug it in your editor.
go run ./cmd/server
go run ./cmd/agent
go run ./cmd/cli [command]