Merge "Fix default value regex pattern"
This commit is contained in:
commit
b8355edd0f
@ -85,7 +85,7 @@ class CustomFormatter(Formatter):
|
||||
(?<!{){({{)* # non-pair opening {
|
||||
(?:obj:)? # obj:
|
||||
(?P<key>\w+) # key
|
||||
(?:\|(?P<default>[\w\s]*))? # default fallback
|
||||
(?:\|(?P<default>[^}]*))? # default fallback
|
||||
}(}})*(?!}) # non-pair closing }
|
||||
"""
|
||||
|
||||
|
32
tests/yamlparser/fixtures/variable_default_values.xml
Normal file
32
tests/yamlparser/fixtures/variable_default_values.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<actions/>
|
||||
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||
<concurrentBuild>false</concurrentBuild>
|
||||
<canRoam>true</canRoam>
|
||||
<properties>
|
||||
<jenkins.model.BuildDiscarderProperty>
|
||||
<strategy class="hudson.tasks.LogRotator">
|
||||
<daysToKeep>+1</daysToKeep>
|
||||
<numToKeep>7</numToKeep>
|
||||
<artifactDaysToKeep>-1</artifactDaysToKeep>
|
||||
<artifactNumToKeep>7</artifactNumToKeep>
|
||||
</strategy>
|
||||
</jenkins.model.BuildDiscarderProperty>
|
||||
</properties>
|
||||
<scm class="hudson.scm.NullSCM"/>
|
||||
<builders>
|
||||
<hudson.tasks.Shell>
|
||||
<command>echo "{defined_var|+1}"
|
||||
echo "{defined_var|-1}"
|
||||
echo "{undefined_var|+1}"
|
||||
echo "{undefined_var|-1}"
|
||||
</command>
|
||||
</hudson.tasks.Shell>
|
||||
</builders>
|
||||
<publishers/>
|
||||
<buildWrappers/>
|
||||
</project>
|
23
tests/yamlparser/fixtures/variable_default_values.yaml
Normal file
23
tests/yamlparser/fixtures/variable_default_values.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
- project:
|
||||
name: test_variable_default_values
|
||||
jobs:
|
||||
- 'variable_default_values':
|
||||
defined_var: '7'
|
||||
|
||||
- job-template:
|
||||
name: 'variable_default_values'
|
||||
properties:
|
||||
- build-discarder:
|
||||
days-to-keep: '{undefined_var|+1}'
|
||||
num-to-keep: '{defined_var|+1}'
|
||||
artifact-days-to-keep: '{undefined_var|-1}'
|
||||
artifact-num-to-keep: '{defined_var|-1}'
|
||||
builders:
|
||||
- shell: |
|
||||
echo "{{defined_var|+1}}"
|
||||
echo "{{defined_var|-1}}"
|
||||
echo "{{undefined_var|+1}}"
|
||||
echo "{{undefined_var|-1}}"
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user