How can I download a folder from s3 to local in the bitbucket pipeline?
How I can execute a shell script in the pipeline?
Hi @NIJO
We use Python to Achieve this
`python /tmp/s3_artifact_downloader.py`
Downloader, looks something like:
```
import sysimport boto3
def download_from_s3(aws_public_key, aws_private_key, s3bucket, from_key, to_file): boto3.client( 's3', aws_access_key_id = aws_public_key, aws_secret_access_key = aws_private_key ).download_file(s3bucket, from_key, to_file)
if __name__ == "__main__": hg_bucket = 'build-artifacts' hg_key = 'master/latest' # get key from commnd line if necessary if len(sys.argv) > 1: hg_key = sys.argv[1].replace('/', '-') + '/latest' aws_public_key = sys.argv[2] aws_private_key = sys.argv[3]
print('Downloadingfrom s3://{}/{}'.format(hg_bucket, hg_key))
download_from_s3( aws_public_key = aws_public_key, aws_private_key = aws_private_key, s3bucket = hg_bucket, from_key = hg_key, to_file = 'HG.zip')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.