CircleCI-Public / aws-s3-orb

Integrate Amazon AWS S3 with your CircleCI CI/CD pipeline easily with the aws-s3 orb.
https://circleci.com/orbs/registry/orb/circleci/aws-s3
MIT License
10 stars 20 forks source link

Question: How to dynamically set the "to" field in /sync #25

Closed tmadison-gpsw closed 2 years ago

tmadison-gpsw commented 3 years ago

I am curious how to dynamically set the "to" field https://github.com/CircleCI-Public/aws-s3-orb/blob/master/src/examples/sync_and_copy.yml#L16 as we would like to change buckets etc based on CIRCLE_SHA1 etc.

Thanks

gmemstr commented 3 years ago

@tmadison-gpsw You could store the bucket name as an environment variable in a prior step, and use that in the argument.

tymik commented 3 years ago

~@gmemstr I'm just doing it that way and it doesn't work - when I'm passing the variable to the orb as a parameter from the job and I pass ENV VAR to the job in workflow, it doesn't evaluate the variable, just puts it there as a string. Doing the test by placing the ENV VAR directly in the job instead of passing it as the parameter and the issue remains the same.~

~It results in:~

#!/bin/bash -eo pipefail
aws s3 sync \
  dist s3://${STAGING_AWS_S3_BUCKET}  \
  --acl private \
--cache-control "max-age=86400"
--delete

The user-provided path dist does not exist.

Exited with code exit status 255
CircleCI received exit code 255

Apparently I got fixated on the target and the issue was with the source, apologies for raising the issue that's not there.