Closed strakh-alex closed 6 years ago
Hi,
Have you tried to use underscores instead to prevent substituting the variable with its value?
${bamboo_buildNumber}
You can find more information regarding this in our Wiki: https://github.com/mibexsoftware/bamboo-plan-dsl-plugin/wiki/FAQ#how-to-prevent-bamboo-variables-from-being-substituted
Hope this helps.
Best regards, Michael
Hi. If I using ${bamboo_buildNumber} I get .${bamboo.BuildVersion}.${bamboo_buildNumber} in artifacts definition.
Code where I use this variable: artifacts { definition(name: """Project.${bamboo.BuildVersion}.${bamboo_buildNumber}""", copyPattern: 'Project.*.zip') { location '' shared true } }
Found a way to escape variable using quotes " and slashes \: "Project.\${bamboo.BuildVersion}.\${bamboo.buildNumber}" But have another issue with escaping this variable into multiline string e.g.: script() { description '' inline { interpreter: ScriptInterpreter POWERSHELL scriptBody """ $packageName = Project.\${bamboo.BuildVersion}.\${bamboo.buildNumber}.zip try{ ... } catch { Throw ("ERROR: " + $error[0].Exception.Message) } """ } }
Hi,
What worked for me is to use single quotes in the multi-line string to prevent Bamboo from substituting the variables:
script() {
description ''
inline {
interpreter: ScriptInterpreter POWERSHELL
scriptBody '''
$packageName = Project.${bamboo.BuildVersion}.${bamboo.buildNumber}.zip
try{
} catch {
} '''
}
}
Does that help you?
Best regards, Michael
Hi. Yes, using 3 single quotes helps me. But symbols "\" and "$" should be escaped. Thank you!
I'm trying to create a task which use variable ${bamboo.buildNumber} as a script argument. But this variable transforms to its value. And I can not find out a way to avoid this transformation. Tried to wrap up with $/ ,,, .$ but get an error: "No such property: bamboo for class: ch.mibex.bamboo.plandsl.dsl.jobs.Artifacts"