Skip to content

Add external secret extension implementation#6252

Merged
6543 merged 21 commits into
woodpecker-ci:mainfrom
mofr93:feature/secret-extension
Mar 26, 2026
Merged

Add external secret extension implementation#6252
6543 merged 21 commits into
woodpecker-ci:mainfrom
mofr93:feature/secret-extension

Conversation

@mofr93

@mofr93 mofr93 commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Add external secret extension support

Adds support for fetching secrets from an external HTTP service, mirroring the existing config service extension pattern (WOODPECKER_CONFIG_EXTENSION_ENDPOINT).

New environment variables

  • WOODPECKER_SECRET_EXTENSION_ENDPOINT - URL of the external secret service
  • WOODPECKER_SECRET_EXTENSION_NETRC - Send netrc if needed

Per-repo override

Repos can set their own secret_extension_endpoint

How it works

The external service receives a signed POST request with {repo, pipeline, netrc} and returns []*model.Secret. Requests use the same ed25519-signed HTTP client and WOODPECKER_EXTENSIONS_ALLOWED_HOSTS allowlist as the config extension.

  • 200 OK — use returned secrets
  • 204 No Content — no external secrets (DB secrets still used if not exclusive)

When not exclusive, DB and external secrets are merged, with external secrets overriding DB secrets by name.

closes #929

@woodpecker-bot

woodpecker-bot commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Surge PR preview deployment succeeded. View it at https://woodpecker-ci-woodpecker-pr-6252.surge.sh

@6543 6543 added server feature add new functionality labels Mar 16, 2026
@qwerty287

Copy link
Copy Markdown
Contributor

Thanks! Please check out the tests and linters ;)

I also don't think we need the exclusive setting here. This is only required for the config because you can then move that fully to the extension. But as we always have the DB, it's fine to always query the secrets from there as well I think.

@mofr93

mofr93 commented Mar 19, 2026

Copy link
Copy Markdown
Contributor Author

Okay, that sounds fine. I will update the PR. Thanks

@6543

6543 commented Mar 19, 2026

Copy link
Copy Markdown
Member

also have a look at https://woodpecker-ci.org/docs/next/usage/extensions and add a documentation for it :)

location of this docs is at https://github.com/woodpecker-ci/woodpecker/tree/main/docs/docs/20-usage/72-extensions

Comment thread web/src/assets/locales/en.json Outdated
@mofr93

mofr93 commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

Hey guys, Changes made to accommodate your requests. Also streamlined more with the registry extension. docs etc. :)

Comment thread server/services/secret/combined_test.go Outdated
Comment thread server/services/secret/http.go Outdated
Comment thread server/services/secret/http.go Outdated

@qwerty287 qwerty287 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Some more points, now with a more detailed look at the code.

Comment thread server/services/manager.go Outdated

@qwerty287 qwerty287 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that I have more and more to add…

In the meantime I also updated the example extension to align with this: woodpecker-ci/example-extensions#97

Comment thread docs/docs/20-usage/72-extensions/55-secret-extension.md
Comment thread cmd/server/flags.go Outdated
Comment thread docs/docs/20-usage/72-extensions/55-secret-extension.md Outdated
@qwerty287

Copy link
Copy Markdown
Contributor

Besides those two points it looks good for me now. Thanks again :)

Comment thread server/services/secret/combined_test.go Outdated

@qwerty287 qwerty287 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry again 🙈

I'm adapting your combined_test.go for the registry extension and found more.

(If you get tired of fixing this just say then I can do it as well…)

Comment thread server/services/secret/http.go Outdated
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Comment thread server/services/secret/combined_test.go Outdated
@6543

6543 commented Mar 26, 2026

Copy link
Copy Markdown
Member

we had some renames to make the extention feature more clear, could you please resolve the conflict :)

@codecov

codecov Bot commented Mar 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.42268% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.85%. Comparing base (b9ba31e) to head (59224d4).

Files with missing lines Patch % Lines
server/services/secret/combined.go 45.00% 32 Missing and 1 partial ⚠️
server/api/repo.go 0.00% 6 Missing ⚠️
server/services/manager.go 0.00% 5 Missing ⚠️
server/services/setup.go 0.00% 4 Missing ⚠️
server/services/secret/http.go 85.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6252      +/-   ##
==========================================
+ Coverage   33.80%   33.85%   +0.04%     
==========================================
  Files         420      422       +2     
  Lines       28333    28425      +92     
==========================================
+ Hits         9578     9622      +44     
- Misses      17862    17908      +46     
- Partials      893      895       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@6543 6543 merged commit def714c into woodpecker-ci:main Mar 26, 2026
9 checks passed
@woodpecker-bot woodpecker-bot mentioned this pull request Mar 26, 2026
1 task
6543 pushed a commit to woodpecker-ci/example-extensions that referenced this pull request Mar 31, 2026
@woodpecker-bot woodpecker-bot mentioned this pull request Apr 1, 2026
1 task
@woodpecker-bot woodpecker-bot mentioned this pull request Apr 15, 2026
1 task
@woodpecker-bot woodpecker-bot mentioned this pull request Apr 27, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature add new functionality server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hashicorp vault as secret storage integration

4 participants