jenkinsci / jenkinsci/datadog-plugin
CasC: default values are not respected
- Dominant language
- Java
- Stars
- 37
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
If CasC is used to configure Datadog plugin, settings which are not explicitly set in CasC will not be changed, so settings from existing config (from global configuration page) will persist after applying CasC.
**To Reproduce**
Steps to reproduce the behavior:
1. Setup CasC config w/o some optional settings for Datadog plugin (w/o `enableCiVisibility` for example)
```
datadogGlobalConfiguration:
emitSecurityEvents: true
emitSystemEvents: true
hostname: "host"
reportWith: "DSD"
targetHost: "localhost"
targetPort: "8125"
targetTraceCollectionPort: "8126"
```
2. Apply CasC config
3. Go to global configuration
4. Ensure that Datadog plugin has default values in all unset settings (CI Visibility is disabled)
5. Change on of unset settings via UI on global configuration page (enable CI Visibility for example)

6. Apply and save changes.
7. Apply CasC config again
8. Go to global configuration
9. See that settings are not changed (CI Visibility is still enabled)
**Expected behavior**
After applying CasC I'd expect overriding unset settings with default values. In other words I want to make sure that if CasC config is used, it is the single source of truth for Datadog plugin settings.
**Environment and Versions (please complete the following information):**
CasC plugin: [1512.vb_79d418d5fc8](https://plugins.jenkins.io/configuration-as-code)
datadog plugin: [5.0.0](https://plugins.jenkins.io/datadog)
Jenkins LTS: [2.361.1](https://www.jenkins.io/)
Contributor guide
Research direction
Reproduce the issue with the Datadog CasC configuration shown in the report, then inspect how the plugin applies CasC settings to Jenkins global configuration. Verify the behavior through the Jenkins global configuration page; done means reapplying CasC resets omitted settings to their defaults, including disabled CI Visibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100