I have a jenkins pipeline in groovy and i have the following variables
x=100
y=0.2 * ${x}
but this is not working and getting message "WorkflowScript: 60: Environment variable values can only be joined together with ‘+’s. @ "
I tried with
def y = 0.2 * ${x}
also
def y = 0.2 * "${x}"
No luck
i am getting value x from jenkins input and would like to have value Y 20% of X
Any ideas ?
To be clear ( this is a contextually confusing post )
Where is this being attempted?
groovy
Jenkins
Somewhere else ( bash/ksh/csh/...)
A combination ( be explicit/ concise )
if its 'groovy' , try
cat eh.groovy
x = 100
y = 0.2 * x
// println y //uncomment if you want/need the result
groovy eh.groovy
20.0
#
#or
#
groovy -e 'x=100;y=0.2*x; println y'
20.0
Its in Jenkins Pipeline script
can u supply the script please
I ran the following through jenkins ... , results at the end of this msg
cat pipeline.groovy
pipeline {
agent any
stages {
stage('rflopsyTest') {
steps {
script {
def x = 100
def y = 0.2 * x
println "x: ${x}"
println "y: ${y}"
}
}
}
}
}
