有没有办法在 AWS codebuild 上更改目录 [英] Is there a way to change directory on AWS codebuild
本文介绍了有没有办法在 AWS codebuild 上更改目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
随着 Snap-CI 的消失,我一直在尝试让我们的构建在 AWS CodeBuild 上运行.我已经构建了 buildspec.yml,但更改目录似乎不起作用.
With Snap-CI going away I've been trying to get our builds working on AWS CodeBuild. I have my buildspec.yml built out, but changing directories doesn't seem to work.
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
看起来这应该相当简单,但到目前为止我还没有任何运气让它工作.
It seems like this should be fairly simple, but so far I haven't had any luck getting this to work.
推荐答案
如果您将 buildspec.yml 版本更改为 0.2,那么 shell 会保留其设置.在 version: 0.1 中,每个命令都有一个干净的 shell.
If you change the buildspec.yml version to 0.2 then the shell keeps its settings. In version: 0.1 you get a clean shell for each command.
享受 ;)
这篇关于有没有办法在 AWS codebuild 上更改目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文