Skip to content

Commit 3f5f6e7

Browse files
committed
Update codebuild_build.sh script
1 parent 2ce8861 commit 3f5f6e7

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

test/integration/codebuild-local/codebuild_build.sh

+15-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function usage {
3636
echo " -a Used to specify an artifact output directory."
3737
echo "Options:"
3838
echo " -l IMAGE Used to override the default local agent image."
39+
echo " -r Used to specify a report output directory."
3940
echo " -s Used to specify source information. Defaults to the current working directory for primary source."
4041
echo " * First (-s) is for primary source"
4142
echo " * Use additional (-s) in <sourceIdentifier>:<sourceLocation> format for secondary source"
@@ -61,10 +62,11 @@ awsconfig_flag=false
6162
mount_src_dir_flag=false
6263
docker_privileged_mode_flag=false
6364

64-
while getopts "cmdi:a:s:b:e:l:p:h" opt; do
65+
while getopts "cmdi:a:r:s:b:e:l:p:h" opt; do
6566
case $opt in
6667
i ) image_flag=true; image_name=$OPTARG;;
6768
a ) artifact_flag=true; artifact_dir=$OPTARG;;
69+
r ) report_dir=$OPTARG;;
6870
b ) buildspec=$OPTARG;;
6971
c ) awsconfig_flag=true;;
7072
m ) mount_src_dir_flag=true;;
@@ -95,7 +97,7 @@ then
9597
exit 1
9698
fi
9799

98-
docker_command="docker run "
100+
docker_command="docker run -it "
99101
if isOSWindows
100102
then
101103
docker_command+="-v //var/run/docker.sock:/var/run/docker.sock -e "
@@ -106,6 +108,11 @@ fi
106108
docker_command+="\"IMAGE_NAME=$image_name\" -e \
107109
\"ARTIFACTS=$(allOSRealPath "$artifact_dir")\""
108110

111+
if [ -n "$report_dir" ]
112+
then
113+
docker_command+=" -e \"REPORTS=$(allOSRealPath "$report_dir")\""
114+
fi
115+
109116
if [ -z "$source_dirs" ]
110117
then
111118
docker_command+=" -e \"SOURCE=$(allOSRealPath "$PWD")\""
@@ -176,7 +183,12 @@ else
176183
docker_command+=" -e \"INITIATOR=$USER\""
177184
fi
178185

179-
docker_command+=" amazon/aws-codebuild-local:latest"
186+
if [ -n "$local_agent_image" ]
187+
then
188+
docker_command+=" $local_agent_image"
189+
else
190+
docker_command+=" public.ecr.aws/codebuild/local-builds:latest"
191+
fi
180192

181193
# Note we do not expose the AWS_SECRET_ACCESS_KEY or the AWS_SESSION_TOKEN
182194
exposed_command=$docker_command

0 commit comments

Comments
 (0)