@@ -35,7 +35,10 @@ function usage {
3535 echo " -a Used to specify an artifact output directory."
3636 echo " Options:"
3737 echo " -l IMAGE Used to override the default local agent image."
38- echo " -s DIR Used to specify a source directory. Defaults to the current working directory."
38+ echo " -s Used to specify source information. Defaults to the current working directory for primary source."
39+ echo " * First (-s) is for primary source"
40+ echo " * Use additional (-s) in <sourceIdentifier>:<sourceLocation> format for secondary source"
41+ echo " * For sourceIdentifier, use a value that is fewer than 128 characters and contains only alphanumeric characters and underscores"
3942 echo " -c Use the AWS configuration and credentials from your local host. This includes ~/.aws and any AWS_* environment variables."
4043 echo " -b FILE Used to specify a buildspec override file. Defaults to buildspec.yml in the source directory."
4144 echo " -m Used to mount the source directory to the customer build container directly."
@@ -61,7 +64,7 @@ while getopts "cmi:a:s:b:e:l:h" opt; do
6164 b ) buildspec=$OPTARG ;;
6265 c ) awsconfig_flag=true;;
6366 m ) mount_src_dir_flag=true;;
64- s ) source_dir= $OPTARG ;;
67+ s ) source_dirs+=( " $OPTARG " ) ;;
6568 e ) environment_variable_file=$OPTARG ;;
6669 l ) local_agent_image=$OPTARG ;;
6770 h ) usage; exit ;;
8689 exit 1
8790fi
8891
89- if [ -z " $source_dir " ]
90- then
91- source_dir=$( allOSRealPath $PWD )
92- else
93- source_dir=$( allOSRealPath $source_dir )
94- fi
95-
9692docker_command=" docker run -it "
9793if isOSWindows
9894then
10298fi
10399
104100docker_command+=" \" IMAGE_NAME=$image_name \" -e \
105- \" ARTIFACTS=$( allOSRealPath $artifact_dir ) \" -e \
106- \" SOURCE=$source_dir \" "
101+ \" ARTIFACTS=$( allOSRealPath $artifact_dir ) \" "
102+
103+ if [ -z " $source_dirs " ]
104+ then
105+ docker_command+=" -e \" SOURCE=$( allOSRealPath $PWD ) \" "
106+ else
107+ for index in " ${! source_dirs[@]} " ; do
108+ if [ $index -eq 0 ]
109+ then
110+ docker_command+=" -e \" SOURCE=$( allOSRealPath ${source_dirs[$index]} ) \" "
111+ else
112+ identifier=${source_dirs[$index]%%:* }
113+ src_dir=$( allOSRealPath ${source_dirs[$index]#*: } )
114+
115+ docker_command+=" -e \" SECONDARY_SOURCE_$index =$identifier :$src_dir \" "
116+ fi
117+ done
118+ fi
107119
108120if [ -n " $buildspec " ]
109121then
@@ -162,4 +174,4 @@ echo ""
162174echo $exposed_command
163175echo " "
164176
165- eval $docker_command
177+ eval $docker_command
0 commit comments