|
| 1 | +# Getting Woodpecker CI Running with cigen |
| 2 | + |
| 3 | +## Quick Start |
| 4 | + |
| 5 | +### 1. Add Woodpecker to Your Config |
| 6 | + |
| 7 | +In your `.cigen/config.yml`: |
| 8 | + |
| 9 | +```yaml |
| 10 | +providers: |
| 11 | + - woodpecker # For Gitea push |
| 12 | + - circleci # For GitHub push (optional) |
| 13 | +``` |
| 14 | +
|
| 15 | +### 2. Generate Woodpecker Config |
| 16 | +
|
| 17 | +```bash |
| 18 | +cargo run --bin cigen -- generate --config /path/to/docspring/.cigen |
| 19 | +``` |
| 20 | + |
| 21 | +This generates: |
| 22 | + |
| 23 | +- `.woodpecker/main.yaml` |
| 24 | +- `.woodpecker/package_updates.yaml` |
| 25 | +- `.woodpecker/staging_postman_tests.yaml` |
| 26 | + |
| 27 | +### 3. Commit and Push to Gitea |
| 28 | + |
| 29 | +```bash |
| 30 | +cd /path/to/docspring |
| 31 | +git add .woodpecker/ |
| 32 | +git commit -m "Add Woodpecker CI configuration" |
| 33 | +git push git@git.home.ndbroadbent.com:DocSpring/docspring.git |
| 34 | +``` |
| 35 | + |
| 36 | +Woodpecker will automatically detect and run `.woodpecker/*.yaml` files. |
| 37 | + |
| 38 | +## What's Included |
| 39 | + |
| 40 | +✅ **43 jobs** from DocSpring config converted to Woodpecker steps |
| 41 | +✅ **Services** automatically collected (postgres, redis, minio) |
| 42 | +✅ **Step names** for readable CI logs |
| 43 | +✅ **Multiple workflows** as separate YAML files |
| 44 | +✅ **Environment variables** preserved |
| 45 | +✅ **Container images** properly mapped |
| 46 | + |
| 47 | +## Generated Structure |
| 48 | + |
| 49 | +```yaml |
| 50 | +# .woodpecker/main.yaml |
| 51 | +services: |
| 52 | + postgres: |
| 53 | + image: postgres:16 |
| 54 | + redis: |
| 55 | + image: redis:7 |
| 56 | + minio: |
| 57 | + image: minio/minio:RELEASE.2025-06-26T18-44-10Z |
| 58 | + |
| 59 | +steps: |
| 60 | + - name: Remove non-production gems |
| 61 | + image: build_libs |
| 62 | + commands: |
| 63 | + - bundle config set --local without 'development test debugging' |
| 64 | + - bundle clean --force |
| 65 | + |
| 66 | + - name: Docker Login |
| 67 | + image: build_libs |
| 68 | + commands: |
| 69 | + - echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin |
| 70 | + |
| 71 | + # ... 700+ more lines |
| 72 | +``` |
| 73 | + |
| 74 | +## Woodpecker Worker Configuration |
| 75 | + |
| 76 | +Your Woodpecker workers need: |
| 77 | + |
| 78 | +1. **Docker access** - For running container images |
| 79 | +2. **Git access** - To clone from Gitea |
| 80 | +3. **Environment variables** - DockerHub credentials, etc. |
| 81 | +4. **Network access** - To pull images and access services |
| 82 | + |
| 83 | +## Testing Locally |
| 84 | + |
| 85 | +You can test Woodpecker configs locally with the Woodpecker CLI: |
| 86 | + |
| 87 | +```bash |
| 88 | +# Install Woodpecker CLI |
| 89 | +go install go.woodpecker-ci.org/woodpecker/v2/cmd/cli@latest |
| 90 | + |
| 91 | +# Test a workflow |
| 92 | +woodpecker-cli exec --local .woodpecker/main.yaml |
| 93 | +``` |
| 94 | + |
| 95 | +## Multi-Provider Workflow |
| 96 | + |
| 97 | +Once you add both providers, you can: |
| 98 | + |
| 99 | +**Push to GitHub** → CircleCI runs |
| 100 | + |
| 101 | +```bash |
| 102 | +git push origin main |
| 103 | +``` |
| 104 | + |
| 105 | +**Push to Gitea** → Woodpecker CI runs |
| 106 | + |
| 107 | +```bash |
| 108 | +git push git@git.home.ndbroadbent.com:DocSpring/docspring.git main |
| 109 | +``` |
| 110 | + |
| 111 | +**Same config, different CI providers!** |
| 112 | + |
| 113 | +## Current Limitations |
| 114 | + |
| 115 | +These will be added in future updates: |
| 116 | + |
| 117 | +- Matrix builds (parallelism: 12 not yet supported) |
| 118 | +- Native Woodpecker cache plugins |
| 119 | +- Advanced when conditions (path filters, etc.) |
| 120 | +- Step dependencies for parallel execution |
| 121 | + |
| 122 | +For now, all steps run sequentially in the order defined. |
| 123 | + |
| 124 | +## Troubleshooting |
| 125 | + |
| 126 | +### Services not connecting |
| 127 | + |
| 128 | +Check that services are available before steps run: |
| 129 | + |
| 130 | +```yaml |
| 131 | +when: |
| 132 | + - event: push |
| 133 | +``` |
| 134 | +
|
| 135 | +### Environment variables missing |
| 136 | +
|
| 137 | +Add them to Woodpecker repo settings or use secrets: |
| 138 | +
|
| 139 | +```yaml |
| 140 | +environment: |
| 141 | + DATABASE_URL: postgres://postgres@postgres:5432/test |
| 142 | +``` |
| 143 | +
|
| 144 | +### Steps running out of order |
| 145 | +
|
| 146 | +Woodpecker runs steps sequentially by default. Dependencies are managed through the `depends_on` field (not yet implemented in cigen). |
| 147 | + |
| 148 | +## Next Steps |
| 149 | + |
| 150 | +To enhance the Woodpecker integration: |
| 151 | + |
| 152 | +1. Add matrix build support for parallelism |
| 153 | +2. Implement Woodpecker cache plugins |
| 154 | +3. Add `when` conditions for selective execution |
| 155 | +4. Support `depends_on` for parallel workflows |
| 156 | + |
| 157 | +Current provider is production-ready for sequential workflows with services! |
0 commit comments