An open API service indexing awesome lists of open source software.

https://github.com/thiagola92/learning-woodpecker


https://github.com/thiagola92/learning-woodpecker

ci codeberg continuous-integration woodpecker-ci

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

          

# learning-woodpecker-ci
Using self-hosted [Woodpecker CI](https://woodpecker-ci.org/) with [Codeberg](https://codeberg.org/).

Good to know:
- Codeberg is built with [Forgejo](https://forgejo.org/).
- Forgejo have their own [Actions](https://forgejo.org/docs/latest/user/actions/overview/).
- [Runner](https://forgejo.org/docs/latest/user/actions/overview/#runners) is responsible for executing CI workflows.

A "Forgejo Runner" is equivalent to "Woodpecker Agent".

# application
- Create an application at your organization "Settings > Applications"
- **Redirect URIs**: `http://:/authorize`
- I'm using http just for learning
- Remember to have your modem configured to accept connection to your port (search for "port forward").
- An example of redirect uri: `http://127.0.0.1:8000/authorize`.

After creation, it will give you a "Client ID" and "Client Secret" (save it to use with woodpecker-ci).

# woodpecker-ci
https://woodpecker-ci.org/docs/administration/installation/docker-compose
https://woodpecker-ci.org/docs/administration/configuration/forges/forgejo

- Replace
- GITHUB by FORGEJO
- `8000:8000` by `:8000`
- `${WOODPECKER_HOST}` by `http://:`
- `${WOODPECKER_GITHUB_CLIENT}` by the application "Client ID"
- `${WOODPECKER_GITHUB_SECRET}` by the application "Client Secret"
- `${WOODPECKER_AGENT_SECRET}` by the random string generated by `openssl rand -hex 32`
- Add
- `WOODPECKER_FORGEJO_URL` with `https://codeberg.org`
- Directory to store woodpecker server data after `woodpecker-server-data: `
- Directory to store woodpecker agent data after `woodpecker-agent-config: `

```
services:
woodpecker-server:
image: woodpeckerci/woodpecker-server:v3
ports:
- 8000:8000
volumes:
- woodpecker-server-data:/var/lib/woodpecker/
environment:
- WOODPECKER_OPEN=true
- WOODPECKER_HOST=${WOODPECKER_HOST}
- WOODPECKER_FORGEJO=true
- WOODPECKER_FORGEJO_URL=https://codeberg.org
- WOODPECKER_FORGEJO_CLIENT=${WOODPECKER_GITHUB_CLIENT}
- WOODPECKER_FORGEJO_SECRET=${WOODPECKER_GITHUB_SECRET}
- WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}

woodpecker-agent:
image: woodpeckerci/woodpecker-agent:v3
command: agent
restart: always
depends_on:
- woodpecker-server
volumes:
- woodpecker-agent-config:/etc/woodpecker
- /var/run/docker.sock:/var/run/docker.sock
environment:
- WOODPECKER_SERVER=woodpecker-server:9000
- WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}

volumes:
woodpecker-server-data:
woodpecker-agent-config:
```

# docker
```
sudo docker compose up
```

- When ready access your woodpecker-ci `http:://:`.
- If you are on same machine as woodpecker-ci, use `http://127.0.0.1:` instead.
- If you are on same lan as woodpecker-ci, use `http://:` instead.
- When attempting to login, it will redirect you to codeberg and ask you permission.
- After accepting, codeberg will redirect you to `http:://:`.
- if you are on same machine as woodpecker-ci, after failing change it to `http://127.0.0.1:`.
- if you are on same machine as woodpecker-ci, after failing change it to `http://:`.

# references
https://codeberg.org/dkarakasilis/self-hosted-ci
https://codeberg.org/actions/meta