I might be doing something wrong but I am unable to run the codebuild.sh file on Windows using gitbash. Sadly I am using a Windows machine at the moment and I absolutely need it. I went ahead and added winpty prerfix
docker_command="**winpty** docker run -it -v //var/run/docker.sock:/var/run/docker.sock -e \
\"IMAGE_NAME=$image_name\" -e \
\"ARTIFACTS=$(allOSRealPath $artifact_dir)\" -e \
\"SOURCE=$source_dir\""
But now I am getting the following Error -
ERROR: Volume C:/localbuild/local_codebuild/sample-web-app/:/codebuild/local:ro has incorrect format, should be external:internal[:mode]
That is because there is ':' added by windows. I tried running it on the powershell without winpty but nothing happens.
Thanks for reporting the issue. We are trying to reproduce this issue on our end, before rolling out a fix. We'll keep this thread updated.
Hi @vibhuyadav , please use latest version of the codebuild_build.sh and the local agent. SHA: 48ba3698faa293af409ba7ed1435fbb6e3e65984e60a1904399896dfb7ab4236
@awszhen Thanks for sharing this. This did help get rid off the earlier errors and modifications I had to do. I am still getting a couple of errors using git bash after updating the local agent from Dockerhub and the codebuild_build.sh from Github.
Command
$ ./codebuild_build.sh -i aws/codebuild/java:openjdk-8 -a ~/work/ -s ~/sample-web-app/
Output
`docker run -it -v //var/run/docker.sock:/var/run/docker.sock -e "IMAGE_NAME=aws/codebuild/java:openjdk-8" -e "ARTIFACTS=//H//work/" -e "SOURCE=//H//sample-web-app/" amazon/aws-codebuild-local:latest
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'`
Command
winpty ./codebuild_build.sh -i aws/codebuild/java:openjdk-8 -a ~/work/ -s ~/sample-web-app/
Output
winpty: error: cannot start 'H:/aws-codebuild-docker-images/local_builds/codebuild_build.sh -i aws/codebuild/java:openjdk-8 -a H:/work -s H:/sample-web-app': %1 is not a valid Win32 application. (error 0xc1)
I saw this that might help - https://github.com/shipping-docker/vessel/issues/84
regarding if [ "$MACHINE" == "mingw64" ];
@vibhuyadav - are you able to try that locally by modifying the codebuild_build.sh script? If you could confirm that fixed the issue, that would be great.
Hi @vibhuyadav , please add winpty in front of the docker run command.
This does not appear to work:
$ winpty ./codebuild_build.sh -i ...
winpty: error: cannot start 'C:/.../codebuild_build.sh -i ...': %1 is not a valid Win32 application. (error 0xc1)
however modifying the script's internal docker command does.
This does not appear to work:
$ winpty ./codebuild_build.sh -i ...
winpty: error: cannot start 'C:/.../codebuild_build.sh -i ...': %1 is not a valid Win32 application. (error 0xc1)however modifying the script's internal docker command does.
Any workaround? I am having the same issue.
Any update on this ? Git bash is not tty and winpty generates the following error:
error: cannot start 'C:/../codebuild_build.sh -i aws/codebuild/standard:4.0 -a ./outputdir': %1 is not a valid Win32 application. (error 0xc1)
Most helpful comment
Thanks for reporting the issue. We are trying to reproduce this issue on our end, before rolling out a fix. We'll keep this thread updated.