jenkinsci / jenkinsci/gitlab-plugin
support omitting clientBuilderId, connectionTimeout, and readTimeout in JCasC
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 615
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 10
Description
### What feature do you want to see added?
We use JCasC to configure our Jenkins GitLab connection. Here's the snippet I'm using:
```yaml
unclassified:
gitLabConnectionConfig:
useAuthenticatedEndpoint: false
connections:
- name: gitlab.example
url: "https://gitlab.example.com/"
apiTokenId: my-jenkins-gitlab-token
ignoreCertificateErrors: false
```
When I configure this via the web UI, I don't need to set `clientBuilderId`, `connectionTimeout`, or `readTimeout`, since the web UI sets those to `autodetect`, `10` and `10`. **So I omitted those from our JCasC as well, thinking the plugin will use the default values.**
It turns out my assumption was incorrect. With JCasC, Jenkins sets no default values for those. In fact, when I omit `clientBuilderId`, Jenkins fails to start entirely, because `client-builder-id` is `null`:
```
Caused by: java.util.NoSuchElementException: unknown client-builder-id: null
at com.dabsquared.gitlabjenkins.gitlab.api.GitLabClientBuilder.getGitLabClientBuilderById(GitLabClientBuilder.java:26)
at com.dabsquared.gitlabjenkins.connection.GitLabConnection.(GitLabConnection.java:85)
... 33 more
```
It would be great if we did not have to duplicate these default `clientBuilderId`, `connectionTimeout`, or `readTimeout` values in our own configuration.
Would you please support JCasC configurations where users omit those settings? This would make it easier to use this GitLab plugin with JCasC.
### Upstream changes
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.