Merge global defaults for jobs also

Currently, global defaults are merged to custom defaults for job
templates, but not for jobs.
Unify this behaviour.

Change-Id: I26fb2678df7f4225571bf7c3cd4be7041ce99217
This commit is contained in:
Vsevolod Fedorov 2023-11-22 13:19:55 +03:00
parent 18efe5066b
commit b669001eaa
3 changed files with 9 additions and 9 deletions

View File

@ -80,7 +80,7 @@ class RootBase:
expanded_contents["description"] = amended_description
return expanded_contents
def _pick_defaults(self, name, merge_global=True):
def _pick_defaults(self, name):
try:
defaults = self._defaults[name]
except KeyError:
@ -93,16 +93,13 @@ class RootBase:
)
if name == "global":
return defaults
if merge_global:
return defaults.merged_with_global(self._pick_defaults("global"))
else:
return defaults
return defaults.merged_with_global(self._pick_defaults("global"))
class NonTemplateRootMixin:
def top_level_generate_items(self):
try:
defaults = self._pick_defaults(self.defaults_name, merge_global=False)
defaults = self._pick_defaults(self.defaults_name)
item_params = LocDict.merge(
defaults.params,
self.params,

View File

@ -5,7 +5,7 @@
<keepDependencies>false</keepDependencies>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<concurrentBuild>true</concurrentBuild>
<canRoam>true</canRoam>
<properties/>
<scm class="hudson.scm.NullSCM"/>
@ -15,5 +15,7 @@
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
<buildWrappers>
<hudson.plugins.timestamper.TimestamperBuildWrapper/>
</buildWrappers>
</project>

View File

@ -1,4 +1,5 @@
# Global defaults are not used, not merged to custom ones if used from a job.
# Global defaults are merged to custom ones if used from jobs,
# not just from job templates.
- defaults:
name: global