Alex Caston 85c71fb01e Kubernetes: precreate workingDir as nonroot when required (#6322)
### Problem
When the working directory is set to a directory that doesn't exists (for example, as `plugin-git` does), kubelet will pre-create it with ownership set to `root:root` and permissions `0755` . This makes pods running as non-root unable to write to it, causing permission errors.

### Solution
Added a `podInitContainer` function that conditionally creates an init container to pre-create the working directory with the correct permissions before the main step container starts.

### Behavior
- If the pod runs as root (`RunAsUser == 0` or unset), no init container is created. Kubelet handles directory creation automatically
- If the working directory matches a volume mount path exactly, no init container is needed. `FSGroupChangePolicy` handles permissions
- An init container is only created when the working directory is nested within a volume mount path
- The init container uses `busybox:stable-musl` with minimal resource limits (5m CPU, 5Mi memory) and drops all capabilities.

### Related issues and PRs
- Solves the error mentioned in https://github.com/woodpecker-ci/woodpecker/issues/5346#issuecomment-3211408746 without requiring a previous step.
- In addition to #6307 and #6310, this will make it easier to run woodpecker ci workloads in a namespace that enforces [Pod Security Standards](https://kubernetes.io/docs/concepts/security/pod-security-standards/)
2026-04-28 17:21:45 +02:00
2025-09-28 22:05:56 +02:00
2026-04-27 09:11:33 +02:00
2026-03-24 01:21:04 +01:00
2024-11-23 09:17:19 +01:00
2026-04-28 14:32:22 +00:00
2026-03-23 11:54:07 +01:00
2026-04-17 00:46:53 +02:00
2025-10-21 12:19:39 +02:00
2022-06-17 12:03:34 +02:00
2024-01-11 18:43:54 +01:00
2024-12-28 15:36:23 +01:00
2023-12-30 15:10:31 +01:00
2026-04-27 14:51:13 +02:00
2026-04-17 00:46:53 +02:00
2026-04-17 00:46:53 +02:00

Woodpecker

Woodpecker


Pipeline Status Code coverage Translation status Matrix space Go Report Card go reference GitHub release Docker pulls License: Apache-2.0 OpenSSF best practices pre-commit.ci


Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.

woodpecker

Installation & Resources

Woodpecker can be installed in various ways (see the Installation Instructions) and runs with SQLite as database by default. It requires around 100 MB of RAM (Server) and 30 MB (Agent) at runtime in idle mode.

Support

You can support the project by becoming a backer on Open Collective or via GitHub Sponsors.

Open Collective backers

Documentation

Our documentation can be found at https://woodpecker-ci.org/docs/intro.

Translation

We have a self-hosted Weblate instance at translate.woodpecker-ci.org.

An overview of the current translation state is available at https://translate.woodpecker-ci.org/projects/woodpecker-ci/#languages.

Public Woodpecker Instances

Woodpecker is used as the main CI/CD engine at Codeberg, an alternative Git hosting platform with a focus on privacy and free software development.

Plugins

Woodpecker can be extended via plugins. The plugin overview website helps browsing available plugins. It combines both plugins by the Woodpecker core team and community-maintained ones.

Star History

Star History Chart

License

Woodpecker is Apache 2.0 licensed. The source files have a header indicating which license they are under and what copyrights apply.

Everything in docs/ is licensed under the Creative Commons Attribution-ShareAlike 4.0 International Public License.

Languages
Go 86.2%
Vue 8.7%
TypeScript 2.6%
CSS 1.7%
Makefile 0.6%