@@ -40,6 +40,7 @@ function usage {
40
40
echo " * Use additional (-s) in <sourceIdentifier>:<sourceLocation> format for secondary source"
41
41
echo " * For sourceIdentifier, use a value that is fewer than 128 characters and contains only alphanumeric characters and underscores"
42
42
echo " -c Use the AWS configuration and credentials from your local host. This includes ~/.aws and any AWS_* environment variables."
43
+ echo " -p Used to specify the AWS CLI Profile."
43
44
echo " -b FILE Used to specify a buildspec override file. Defaults to buildspec.yml in the source directory."
44
45
echo " -m Used to mount the source directory to the customer build container directly."
45
46
echo " -e FILE Used to specify a file containing environment variables."
@@ -57,7 +58,7 @@ artifact_flag=false
57
58
awsconfig_flag=false
58
59
mount_src_dir_flag=false
59
60
60
- while getopts " cmi:a:s:b:e:l:h" opt; do
61
+ while getopts " cmi:a:s:b:e:l:p: h" opt; do
61
62
case $opt in
62
63
i ) image_flag=true; image_name=$OPTARG ;;
63
64
a ) artifact_flag=true; artifact_dir=$OPTARG ;;
@@ -67,6 +68,7 @@ while getopts "cmi:a:s:b:e:l:h" opt; do
67
68
s ) source_dirs+=(" $OPTARG " );;
68
69
e ) environment_variable_file=$OPTARG ;;
69
70
l ) local_agent_image=$OPTARG ;;
71
+ p ) aws_profile=$OPTARG ;;
70
72
h ) usage; exit ;;
71
73
\? ) echo " Unknown option: -$OPTARG " >&2 ; exit 1;;
72
74
: ) echo " Missing option argument for -$OPTARG " >&2 ; exit 1;;
@@ -144,6 +146,12 @@ then
144
146
else
145
147
docker_command+=" -e \" AWS_CONFIGURATION=NONE\" "
146
148
fi
149
+
150
+ if [ -n " $aws_profile " ]
151
+ then
152
+ docker_command+=" -e \" AWS_PROFILE=$aws_profile \" "
153
+ fi
154
+
147
155
docker_command+=" $( env | grep ^AWS_ | while read -r line; do echo " -e \" $line \" " ; done ) "
148
156
fi
149
157
0 commit comments