Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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


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

ci codeberg continuous-integration woodpecker-ci

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

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

# runner
https://forgejo.org/docs/next/admin/actions/#forgejo-runner

Forgejo give almost everything that you need
```
wget -O forgejo-runner https://code.forgejo.org/forgejo/runner/releases/download/v3.3.0/forgejo-runner-3.3.0-linux-amd64
chmod +x forgejo-runner
wget -O forgejo-runner.asc https://code.forgejo.org/forgejo/runner/releases/download/v3.3.0/forgejo-runner-3.3.0-linux-amd64.asc
gpg --keyserver keys.openpgp.org --recv EB114F5E6C0DC2BCDD183550A4B61A2DC5923710
gpg --verify forgejo-runner.asc forgejo-runner
```

But doesn't tell you that you need to register too
```
./forgejo-runner register
```

- **Forgejo instance URL**: https://codeberg.org
- **Runner token**: Get at your organization "Settings > Actions > Runners"
- Rest is up to you to fill or not

Start runner with:
```
sudo ./forgejo-runner daemon
```

# 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.
- 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
[Using there docker-compose as base](https://woodpecker-ci.org/docs/administration/deployment/docker-compose)
[And instruction for forgejo](https://woodpecker-ci.org/docs/administration/forges/gitea)
[Add more server configurations](https://woodpecker-ci.org/docs/administration/server-config)

- Replace
- GITHUB by GITEA
- `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_GITEA_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: `

```
version: '3'

services:
woodpecker-server:
image: woodpeckerci/woodpecker-server:latest
ports:
- 8000:8000
volumes:
- woodpecker-server-data:/var/lib/woodpecker/
environment:
- WOODPECKER_OPEN=true
- WOODPECKER_HOST=${WOODPECKER_HOST}
- WOODPECKER_GITEA=true
- WOODPECKER_GITEA_URL=https://codeberg.org
- WOODPECKER_GITEA_CLIENT=${WOODPECKER_GITHUB_CLIENT}
- WOODPECKER_GITEA_SECRET=${WOODPECKER_GITHUB_SECRET}
- WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}

woodpecker-agent:
image: woodpeckerci/woodpecker-agent:latest
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