问题
I was having issues with escaping quotes for a shell command in Jenkins pipeline, so I asked in How to escape quotes in a AWS CLI in a Jenkins pipeline?, which was answered and the quotes are now escaped correctly when I run the command.
However I get the following in Jenkins when I execute the following aws elbv2 CLI command in a pipeline
+ aws elbv2 modify-listener --listener-arn arn:aws:elasticloadbalancing:us-east-1:1234567890:listener/app/my-alb/123456789 --default-actions '[{"Type": "redirect", "RedirectConfig": {"Protocol": "HTTPS", "Port": "443", "Host": "#{host}", "Query": "#{query}", "Path": "/#{path}", "StatusCode": "HTTP_301"}}]'
Error parsing parameter '--default-actions': Expected: '=', received: ''' for input:
'[{"Type":"redirect","RedirectConfig":{"Protocol":"HTTPS","Port":"443","Host":"#{host}","Query":"#{query}","Path":"/#{path}","StatusCode":"HTTP_301"}}]'
If I put an "=" sign after --default-actions, like the error message says, I get the same error.
If I copy/paste the command I execute in Jenkins into a terminal, it works!
来源:https://stackoverflow.com/questions/52846705/why-is-jenkins-flagging-an-error-with-correct-aws-cli-syntax