随着Snap-CI的消失我一直在试图让我们的构建工作在AWS CodeBuild上。我建立了buildspec.yml,但更改目录似乎不起作用。有没有办法在AWS codebuild上更改目录
version: 0.1
phases:
install:
commands:
- apt-get update -y
- apt-get install -y node
- apt-get install -y npm
build:
commands:
- cd MyDir //Expect to be in MyDir now
- echo `pwd` //Shows /tmp/blablabla/ instead of /tmp/blablabla/MyDir
- npm install //Fails because I'm not in the right directory
- bower install
- npm run ci
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- MyDir/MyFile.war
discard-paths: yes
看起来这应该是相当简单的,但到目前为止我还没有运气得到这个工作。
我刚刚碰到同样的问题..在每一行可惜cd'ing没有帮助: '''[容器] 2017年7月2日12时46分55秒Command未成功退出cd dealer-ai && npm install退出状态1''' '''[容器] 2017/07/02 12:46:55阶段完成:INSTALL成功:false''' ''' '[Container] 2017/07/02 12:46:55相位上下文状态码:COMMAND_EXECUTION_ERROR消息:执行命令时出错:cd dealer-ai && npm install。原因:退出状态1''' –
CodeBuild自推出buildspec v0.2以来不再需要这种解决方法。 http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-versions – awsnitin