Skip to content

Add config to change default pipeline config paths and extensions#6580

Merged
6543 merged 8 commits into
woodpecker-ci:mainfrom
jolheiser:feat/default-pipeline-config
May 26, 2026
Merged

Add config to change default pipeline config paths and extensions#6580
6543 merged 8 commits into
woodpecker-ci:mainfrom
jolheiser:feat/default-pipeline-config

Conversation

@jolheiser

@jolheiser jolheiser commented May 14, 2026

Copy link
Copy Markdown
Member

Based on discussion from #6576

It feels awkward to set a variable in a package called constant 😅
But this seemed like the least intrusive way to make this change without having to push the CLI flag all around in a bigger refactor.

closes #5428

Signed-off-by: jolheiser <git@jolheiser.com>
@qwerty287

qwerty287 commented May 14, 2026

Copy link
Copy Markdown
Contributor

I would not change that constant, rather add a new field to server/config.go

Signed-off-by: jolheiser <git@jolheiser.com>
@jolheiser jolheiser force-pushed the feat/default-pipeline-config branch from b520343 to 225cd68 Compare May 14, 2026 15:25
@jolheiser

Copy link
Copy Markdown
Member Author

Alright, moved to server/config.go

Comment thread cli/common/pipeline.go Outdated
@6543

6543 commented May 14, 2026

Copy link
Copy Markdown
Member

beside cli this looks good :)

jolheiser added 2 commits May 14, 2026 10:53
Signed-off-by: jolheiser <git@jolheiser.com>
Signed-off-by: jolheiser <git@jolheiser.com>
@jolheiser

Copy link
Copy Markdown
Member Author

Still seems to have an import cycle in forge, but I am less sure how to deal with this one.

@jolheiser

Copy link
Copy Markdown
Member Author

Open to suggestions here, a572dd8 was fairly simple albeit a bit hacky.

Seems that moving it to server means plumbing it through as extra args to avoid import cycles unless there is a better alternative I'm not seeing.

@qwerty287

Copy link
Copy Markdown
Contributor

Not sure, but in the ui we show the default values if the field is empty, right? This would be wrong if the config is changed.

@jolheiser

Copy link
Copy Markdown
Member Author

Hm, yes it would be. The translation could be changed to just that prefix "By default:" and then dynamically create the "x -> y -> z" although it may get too long depending on how it's set.

@6543

6543 commented May 14, 2026

Copy link
Copy Markdown
Member

@qwerty287

Copy link
Copy Markdown
Contributor

Hm, yes it would be. The translation could be changed to just that prefix "By default:" and then dynamically create the "x -> y -> z" although it may get too long depending on how it's set.

I think that's OK, it's unlikely that someone will set hundreds of files there.

@6543

6543 commented May 15, 2026

Copy link
Copy Markdown
Member

just thunking ... if you wana have jsonnet and multiworkflow files ... this patcher do not work, you we also need to be able to change file extensions we do filter upon

@jolheiser

Copy link
Copy Markdown
Member Author

This patch would work, because it parses out extensions bases on the paths given.
There is an edge case, however, where if you only give it directory paths it would not work.
But if it's set to e.g. .woodpecker.jsonnet,.woodpecker/ it would parse all jsonnet files in the .woodpecker dir still.

I can update the translation, however I still have the issue that all the things I've tried after moving to server/config.go lead to import cycles. Plumbing it all the way through seems like a lot of churn, is that preferred over modifying (or adding to) constants?

@qwerty287

Copy link
Copy Markdown
Contributor

Which import cycles? This should not happen at all I think. Where do you want to use the configs? In packages like api etc. this shouldn't give you import cycles.

I think for the file extensions I would actually prefer a separate env var to configure that instead of inferring from the paths.

@jolheiser

Copy link
Copy Markdown
Member Author

https://ci.woodpecker-ci.org/repos/3780/pipeline/34580/10

package go.woodpecker-ci.org/woodpecker/v3/cmd/server
imports go.woodpecker-ci.org/woodpecker/v3/server from grpc_server.go
imports go.woodpecker-ci.org/woodpecker/v3/server/services from config.go
imports go.woodpecker-ci.org/woodpecker/v3/server/services/config from manager.go
imports go.woodpecker-ci.org/woodpecker/v3/server from forge.go: import cycle not allowed

@woodpecker-bot

woodpecker-bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Surge PR preview deployment was removed

@qwerty287

Copy link
Copy Markdown
Contributor

Ah I see, then we probably should not store that globally. The services indeed shouldn't use the global config. Maybe you could store the config diretly in the forgeFetcher struct instead? And pass it using NewForge below.

Signed-off-by: jolheiser <git@jolheiser.com>
@6543 6543 added server enhancement improve existing features labels May 26, 2026
@6543 6543 marked this pull request as ready for review May 26, 2026 15:28
@6543 6543 requested a review from qwerty287 May 26, 2026 15:29
@qwerty287

Copy link
Copy Markdown
Contributor

@6543 you wanted to add this to the cli as well, right? Beside that also lgtm.

@6543 6543 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thx yes cli should also have this flag ...

also test fails ...

Signed-off-by: jolheiser <git@jolheiser.com>
@jolheiser

Copy link
Copy Markdown
Member Author

afaict the exec command doesn't touch the config extension, so wiring it up doesn't do much currently. Do you still want it plumbed for a potential future enhancement?

Signed-off-by: jolheiser <git@jolheiser.com>
@6543

6543 commented May 26, 2026

Copy link
Copy Markdown
Member

afaict the exec command doesn't touch the config extension, so wiring it up doesn't do much currently. Do you still want it plumbed for a potential future enhancement?

aww ... in this case we can wait till we have a proper exec ... I'm currently refactoring the bases to make it work propperly anyway

@6543 6543 enabled auto-merge (squash) May 26, 2026 17:48
@6543 6543 changed the title feat: allow admins to set default pipeline config paths Allow admins to set default pipeline config paths May 26, 2026
@6543 6543 changed the title Allow admins to set default pipeline config paths Add config to change default pipeline config paths and extensions May 26, 2026
@6543 6543 disabled auto-merge May 26, 2026 17:49
@6543 6543 enabled auto-merge (squash) May 26, 2026 17:49
@6543 6543 merged commit 2310215 into woodpecker-ci:main May 26, 2026
7 checks passed
@woodpecker-bot woodpecker-bot mentioned this pull request May 26, 2026
1 task
@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.71%. Comparing base (8363eff) to head (62e7804).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6580      +/-   ##
==========================================
+ Coverage   41.60%   41.71%   +0.11%     
==========================================
  Files         432      433       +1     
  Lines       28805    28889      +84     
==========================================
+ Hits        11983    12050      +67     
- Misses      15747    15751       +4     
- Partials     1075     1088      +13     

☔ 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.

@jolheiser jolheiser deleted the feat/default-pipeline-config branch May 26, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improve existing features server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support global configuration for pipeline file path

4 participants