Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

"Unknown options" Bitbucket Repository Variable _ Is it a bug?

Tuan Nguyen August 1, 2020

Hello,

I'm trying to upload a zip file from bitbucket pipeline to AWS S3.

The step is in bitbucket-pipelines.yml like below:

      - step: #dev-int-module-sam-s3bucket 
name: Deploy to DevEnv
image: amazon/aws-cli
script:
- echo $POC_DEPLOY_S3_BUCKET
- aws s3 cp dev-int-module-sam.zip s3://$POC_DEPLOY_S3_BUCKET/dev-int-module-sam.zip

 My pipeline failed at this step and the output:

+ echo $POC_DEPLOY_S3_BUCKET
dev-int-module-sam-s3bucket

+ aws s3 cp dev-int-module-sam.zip s3://$POC_DEPLOY_S3_BUCKET/dev-int-module-sam.zip
Unknown options: /dev-int-module-sam.zip

The echo returns the right value but cannot use it in "aws s3 cp" command, It's weird.

Other variables works well, such as AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY.

Many thanks for any suggestion.

Thanks,

NAT

1 answer

1 accepted

1 vote
Answer accepted
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2020

This looks as if there is a space or similar non-printable character at the end of `$POC_DEPLOY_S3_BUCKET`. You could verify with the echo:

echo "---$POC_DEPLOY_S3_BUCKET---"

And for the AWS CLI command, quoting might preserve it (and make the error more visible):

aws s3 cp dev-int-module-sam.zip "s3://$POC_DEPLOY_S3_BUCKET/dev-int-module-sam.zip"

Quoting is most often a good idea when doing variable interpolation to keep arguments together.

Tuan Nguyen August 10, 2020

Yes, you are right there is a space in the end of S3 bucket name.

When I click on that variable, the mouse pointer appears at the end of string and I cannot see any space on GUI.

Thanks,

NAT

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events