Hi Mike, it looks like the variables are actually strings with a line break at the end, and not integers?
HTH Reinhold From: [email protected] <[email protected]> On Behalf Of Mike Craig Sent: Montag, 11. März 2019 23:33 To: Jenkins Users <[email protected]> Subject: Jenkins Pipeline: Variable expansion issues Hello, The following snippet from my pipeline is acting very strangely, the values from the print statements are correct print "asgName: $asgName" print "asgMax: $asgMax" print "asgMin: $asgMin" asgIncrease = (asgMax * 2) print "Setting ASG size to ${asgIncrease}" sh ("aws autoscaling update-auto-scaling-group --min-size ${asgMin} --max-size ${asgMax} --region ${region} --auto-scaling-group-name ${asgName} ") output 15:27:13 ecs_service_name: lab-us-west-2-lab-rat [Pipeline] sh 15:27:14 + aws autoscaling describe-auto-scaling-groups --region us-west-2 15:27:14 + jq .AutoScalingGroupName 15:27:14 + jq '.AutoScalingGroups[]' 15:27:14 + jq 'select (.AutoScalingGroupName | contains ("lab-us-west-2-lab-rat"))' [Pipeline] sh 15:27:18 + aws autoscaling describe-auto-scaling-groups --region us-west-2 15:27:18 + jq 'select (.AutoScalingGroupName | contains ("lab-us-west-2-lab-rat"))' 15:27:18 + jq .MaxSize 15:27:18 + jq '.AutoScalingGroups[]' [Pipeline] sh 15:27:22 + jq 'select (.AutoScalingGroupName | contains ("lab-us-west-2-lab-rat"))' 15:27:22 + jq .MinSize 15:27:22 + jq '.AutoScalingGroups[]' 15:27:22 + aws autoscaling describe-auto-scaling-groups --region us-west-2 [Pipeline] echo 15:27:26 asgName: "lab-us-west-2-lab-rat-serviceInstanceAutoscalingGroup" 15:27:26 [Pipeline] echo 15:27:26 asgMax: 1 15:27:26 [Pipeline] echo 15:27:26 asgMin: 1 15:27:26 [Pipeline] echo 15:27:26 Setting ASG size to 1 15:27:26 1 15:27:26 [Pipeline] sh 15:27:26 + aws autoscaling update-auto-scaling-group --min-size 1 15:27:27 usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters] 15:27:27 To see help text, you can run: 15:27:27 15:27:27 aws help 15:27:27 aws <command> help 15:27:27 aws <command> <subcommand> help 15:27:27 aws: error: argument --auto-scaling-group-name is required 2 things here, 1. the asgIncrease variable should evaluate to 2, as I'm doubling the original variable. 2 The line where the "aws autoscaling" command is executed does not expand and execute the entire line. I have tried hardcoding values here, and that seems to work, but how to use variables?? What am I doing wrong? Thank you! -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f6560954-54e3-4afd-a8cf-f76bd9de11c8%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/f6560954-54e3-4afd-a8cf-f76bd9de11c8%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/VI1P190MB0111F889B7E1A8AF55D5EFACF7490%40VI1P190MB0111.EURP190.PROD.OUTLOOK.COM. For more options, visit https://groups.google.com/d/optout.
