CasC allows duplicate entries for single valued Describables without warning.
Jenkins and plugins versions report
Environment
from https://github.com/jenkinsci/oic-auth-plugin/issues/436 , otherwise unknown
What Operating System are you using (both controller, and any agents involved in the problem)?
N/A
Reproduction steps
- Create a config as code snippet with 2 different conflicting options for a describable.
e.g.
jenkins:
securityRealm:
oic:
serverConfiguration:
# Automatic config of endpoint
wellKnown:
wellKnownOpenIDConfigurationUrl: "https://myid.com/.well-known/openid-configuration"
# Manual config of endpoint
manual:
authorizationServerUrl: "https://myid.com/authorize"
issuer: "https://myid.com/"
jwksServerUrl: "https://myid.com/jwks"
tokenServerUrl: "https://myid.com/token"
userInfoServerUrl: "https://myid.com/userInfo"
useRefreshTokens: false
# Credentials
clientId: "myclient-01"
clientSecret: "supersecret"
# claims
- start Jenkins with this casc file
serverConfiguration is a single valued Describable, yet the config contains two conflicting values for the above.
Expected Results
the startup should error or warn as the configuration is invalid
Actual Results
no warning / error
Anything else?
No response
You don't happen to have the merge strategy enabled?
https://github.com/jenkinsci/configuration-as-code-plugin/blob/8b9efc1b9026942064d5248c92bf89cb00f83ea0/docs/features/mergeStrategy.md
is this issue open ? assign me if open
Assign to me? I will work on it.
We don't assign issues to users, just open a pull request instead and it will be reviewed
ok. so I started working on this issue.
Thank you for the opportunity to contribute to this project. I've implemented a solution that addresses issue #2589 by detecting duplicate entries in single-valued Describables and providing appropriate feedback to users.
The fix should help prevent confusion when users accidentally include multiple configuration options (like both well-known and manual in the OIC plugin example) for components that should only have one configuration approach.
I've included comprehensive tests to verify both the warning behavior in normal mode and the exception throwing in strict mode. Please let me know if you'd like to see any adjustments to the implementation approach.