I have declarative parametrized pipeline from SCM, something like this:
parameters {
string(name: 'USER', defaultValue: params.USER ?:'default_value', trim: true)
password(name: 'PASSWORD', defaultValue: params.PASSWORD ?:'default_value')
< ... and bunch of params more ... >
}
Idea is to use same Jenkinsfile for several environments/projects, and override those values manually in UI accordingly. If there's a value defined already - skip it during the next build.
string
parameter does exactly what I want, as described here.
Problem is that Elvis operator ?:
acts strange with password
parameter type.
It basically erases existing password value on first build if it finds it there. If I try a second build (when password is already erased during previous build), then it provides default value. And over and over…
Does anybody have any idea why that works for string
parameter but not for password
parameter, and how to override that issue? Except creating password parameter manually in UI, and kicking it out from Jenkinsfile, of course.
Thanks.