本文介绍了有没有办法在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将保留其设置.在版本: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上更改目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!