我有以下内容bitbucket.pipelines.yml
:
image: python:3.5.1
pipelines:
branches:
master:
- step:
script:
- apt-get update
- apt-get install nodejs -y
- npm install
- npm run build
- python get-pip.py
- pip install boto3==1.3.0
- python s3_upload.py io-master.fromthiscomesthat.co.uk dist io-master
安装节点后,构建尝试运行失败npm
:
+ npm install
bash: npm: command not found
我想这是因为npm
不在路径中。或者其他的东西。我的 Ubuntu/UNIX 技能不是最好的。
如何将安装添加到路径?
更新
好的,经过大量的摆弄,我的 YAML 现在看起来像这样:
image: python:3.5.1
pipelines:
branches:
master:
- step:
script:
- apt-get update
- apt-get install lsb-release -y
- curl --silent https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
- VERSION=node_5.x
- DISTRO="$(lsb-release -s -c)" # <--- error here
- echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list
- echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list
- apt-get update
- apt-get install nodejs -y
- npm install
- npm run build
- python get-pip.py
- pip install boto3==1.3.0
- python s3_upload.py io-master.fromthiscomesthat.co.uk dist io-master
现在我有一个小问题。lsb-release
即使安装程序正确安装,也找不到。这是路径问题吗?当我不知道它被安装到哪里时,我该如何执行它?很难调试,因为它在 Bitbucket 上的 docker 实例中运行。