|
1 | 1 | #!/bin/bash
|
2 | 2 | #
|
3 | 3 | #
|
4 |
| -# Script to compile a languge version and upload it to the cache. |
| 4 | +# Script to compile a language version and upload it to the cache. |
5 | 5 | #
|
6 | 6 | # This script automates the process to build and upload a Python/Node/Rust/Go
|
7 | 7 | # version and upload it to S3 making it available for the builders. When a
|
8 | 8 | # pre-compiled version is available in the cache, builds are faster because they
|
9 | 9 | # don't have to donwload and compile.
|
10 | 10 | #
|
| 11 | +# |
11 | 12 | # LOCAL DEVELOPMENT ENVIRONMENT
|
| 13 | +# |
12 | 14 | # https://docs.readthedocs.io/en/latest/development/install.html
|
13 | 15 | #
|
14 | 16 | # You can run this script from you local environment to create cached version
|
|
25 | 27 | # it's required to set the following environment variables for an IAM user with
|
26 | 28 | # permissions on ``build-tools`` S3's bucket:
|
27 | 29 | #
|
| 30 | +# AWS_REGION |
28 | 31 | # AWS_ACCESS_KEY_ID
|
29 | 32 | # AWS_SECRET_ACCESS_KEY
|
30 |
| -# AWS_ENDPOINT_URL |
| 33 | +# AWS_BUILD_TOOLS_BUCKET_NAME |
| 34 | +# |
| 35 | +# Note that in production we need to install `aws` Python package. We can do that by: |
| 36 | +# |
| 37 | +# virtualenv venv |
| 38 | +# source venv/bin/activate |
| 39 | +# pip install awscli==1.20.34 |
31 | 40 | #
|
32 | 41 | #
|
33 | 42 | # USAGE
|
@@ -95,9 +104,17 @@ docker container kill $CONTAINER_ID
|
95 | 104 | # Upload the .tar.gz to S3
|
96 | 105 | AWS_ENDPOINT_URL="${AWS_ENDPOINT_URL:-http://localhost:9000}"
|
97 | 106 | AWS_BUILD_TOOLS_BUCKET="${AWS_BUILD_TOOLS_BUCKET:-build-tools}"
|
98 |
| -AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-admin}" \ |
99 |
| -AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-password}" \ |
100 |
| -aws --endpoint-url $AWS_ENDPOINT_URL s3 cp $OS-$TOOL-$VERSION.tar.gz s3://$AWS_BUILD_TOOLS_BUCKET |
| 107 | +AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-admin}" |
| 108 | +AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-password}" |
| 109 | + |
| 110 | +if [[ -z $AWS_REGION ]] |
| 111 | +then |
| 112 | + # Development environment |
| 113 | + aws --endpoint-url $AWS_ENDPOINT_URL s3 cp $OS-$TOOL-$VERSION.tar.gz s3://$AWS_BUILD_TOOLS_BUCKET |
| 114 | +else |
| 115 | + # Production environment does not requires `--endpoint-url` |
| 116 | + aws s3 cp $OS-$TOOL-$VERSION.tar.gz s3://$AWS_BUILD_TOOLS_BUCKET |
| 117 | +fi |
101 | 118 |
|
102 | 119 | # Delete the .tar.gz file from the host
|
103 | 120 | rm $OS-$TOOL-$VERSION.tar.gz
|
0 commit comments