Consistent and reliable plugin settings parsing #2507
Unanswered
Taywee
asked this question in
Request a Feature
Replies: 3 comments 3 replies
-
all exept base types are converted into json ... this is a feature, so you can have advanced config structures interpreted by the plugin ... e.g. see buildx plugin and the logins |
Beta Was this translation helpful? Give feedback.
1 reply
-
this I would say is an error ... I would expect an empty env var ... e.g. |
Beta Was this translation helpful? Give feedback.
1 reply
-
like that idea ... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Plugin settings have some unpredictable behavior. Given this settings block:
I get these environment variables:
It looks like strings, booleans, and numbers turn into strings, arrays turn into comma-separated strings, and maps turn into json-encoded objects.
null
causes an error and refuses to run the pipeline entirely.This is useful for very simple cases, and when you know exactly what the incoming structure is, but it doesn't let you discern top-level booleans from strings, or array arguments with embedded commas vs separate array elements. If you want case-sensitivity or to distinguish between hyphens or underscores, you're out of luck. Additionally, if you want to allow a setting to be a string, array, or object, it makes it extra fiddly to reliably parse it, compared to just having everything json-encoded.
It would be cool to have another variable, named something like
WOODPECKER_PLUGIN_SETTINGS
that just contains the entire settings block encoded to a json object. Leave the existing ones for backward compatibility with existing plugins (and for easier use from shell script entrypoints), and let the plugin author decide what level of convenience and control they want.Beta Was this translation helpful? Give feedback.
All reactions