使用CircleCI AWS-S3 orb执行sync命令时遇参数错误求助
I ran into this error during my CircleCI build:
#!/bin/sh -eo pipefail # 调用工作流 'build-deploy' 出错 # 调用任务 'build_test_es' 出错 # 调用命令 'aws-s3/sync' 出错 # Unexpected argument(s): arguments # # ------- # 警告:此配置为自动生成,仅用于显示上述消息。 # 请勿重新运行此任务,重新运行无效。 false 退出码1
Here's the relevant part of my config.yml (some content omitted):
version: 2.1 orbs: aws-s3: circleci/aws-s3@1.0.0 jobs: build_test_es: docker: - image: circleci/node:10.15 steps: # ... other steps omitted ... - aws-s3/sync: from: bucket to: 's3://my-s3-bucket-name/prefix' arguments: | --acl public-read \ --cache-control "max-age=86400" overwrite: true
I followed the official docs for the sync command, so is this an orb issue or did I make a typo somewhere?
The issue isn't with the orb itself—it's a parameter name mismatch in your config.
Looking at the circleci/aws-s3@1.0.0 orb's sync command specification, the parameter for passing extra AWS CLI arguments is named extra_args, not arguments. Newer versions of the orb might use arguments, but the 1.0.0 version you're using relies on the older parameter name.
To fix the error, just rename the arguments key to extra_args in your sync step:
- aws-s3/sync: from: bucket to: 's3://my-s3-bucket-name/prefix' extra_args: | --acl public-read \ --cache-control "max-age=86400" overwrite: true
This should resolve the "Unexpected argument(s): arguments" error, as the orb will recognize the extra_args parameter correctly and pass those flags to the underlying aws s3 sync command.
内容的提问来源于stack exchange,提问作者Borjante

