jenkinsci / jenkinsci/configuration-as-code-plugin
Merging global node environment variables from multiple config files
- Dominant language
- Java
- Stars
- 2.8k
- Forks
- 756
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 10
Description
### Your checklist for this issue
- [x] Jenkins version `2.223`
- [x] Plugin version `1.35`
- [x] OS `Ubuntu 18.04`
### Description
When having multiple .casc files to configure different aspects of Jenkins, if multiple files have global environment variables configuration, they are not merged, but stored as a separate envVars sections:
config1.yaml
```yaml
jenkins:
globalNodeProperties:
- envVars:
env:
- key: VARIABLE1
value: foo
```
config2.yaml
```yaml
jenkins:
globalNodeProperties:
- envVars:
env:
- key: VARIABLE2
value: bar
```
resulting config in Jenkins:
```yaml
jenkins:
globalNodeProperties:
- envVars:
env:
- key: VARIABLE1
value: foo
- envVars:
env:
- key: VARIABLE2
value: bar
```
While tests show that all variables still end up in environment, when you go to Manage Jenkins -> Configure System, it only shows contents of first "envVars" block.
Expected: all global variables end up in a single "envVars" block thus avoiding visualization problem
```yaml
jenkins:
globalNodeProperties:
- envVars:
env:
- key: VARIABLE1
value: foo
- key: VARIABLE2
value: bar
```
PS It seems that originally it is not expected to have multiple instances of the same type of global node properties descriptors.
Contributor guide
Assessment
This issue has not been assessed yet.