[INFRA-1032] ${user.name} might contain metacharacters.

This commit is contained in:
Jesse Glick 2017-06-26 15:19:27 -04:00
parent 78a42d5a4a
commit 7b69fe5be6
2 changed files with 15 additions and 2 deletions

2
Jenkinsfile vendored
View File

@ -44,7 +44,7 @@ for(i = 0; i < buildTypes.size(); i++) {
sh mvnCmd
sh 'test `git status --short | tee /dev/stderr | wc --bytes` -eq 0'
} else {
bat "$mvnCmd -Duser.name=yay" // INFRA-1032 workaround
bat mvnCmd
}
}
}

15
pom.xml
View File

@ -282,6 +282,19 @@ THE SOFTWARE.
</configuration>
</execution>
<execution>
<id>user.name</id>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>user.name.escaped</name>
<value>${user.name}</value>
<regex>([$\\])</regex>
<replacement>\\$1</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
<execution>
<id>version-property</id>
<goals>
<goal>regex-property</goal>
@ -290,7 +303,7 @@ THE SOFTWARE.
<name>build.version</name>
<value>${project.version}</value>
<regex>-SNAPSHOT</regex>
<replacement>-SNAPSHOT (${build.type}-${now}-${user.name})</replacement>
<replacement>-SNAPSHOT (${build.type}-${now}-${user.name.escaped})</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>