我想让 CI Runner 使用 G++ 4.8 进行 npm 安装步骤。我在搞乱 .gitlab-ci.yml - 这是我当前的版本:
before_script:
- . /etc/profile.d/_environment.sh
- . /etc/profile.d/runner.sh
- nvm use v5.3.0
build:
script:
- scl enable devtoolset-2 bash
- g++ --version
- npm install
- gulp build
tags:
- shell
style-analysis:
script:
- gulp style
tags:
- shell
不幸的是,我的构建失败了。步骤“scl enable devtoolset-2 bash”应该切换到 G++ 4.8,当我直接在控制台上运行它时它会这样做。下一行“g++ --version”用于捕获版本,以便我可以调试这里发生的事情。它不是显示版本 4.8 而是 4.4。这将导致我的构建失败。这是输出的“头”
gitlab-ci-multi-runner 0.7.2 (998cf5d)
Using Shell executor...
Running on hqdevrunner01...
Fetching changes...
Removing node_modules/
HEAD is now at 082a6fa remove allow failure
From https://hqdevgit01.services.com/operations/-technical-operations-portal
082a6fa..9e36ed9 master -> origin/master
Checking out 9e36ed91 as master...
Previous HEAD position was 082a6fa... remove allow failure
HEAD is now at 9e36ed9... g++4.8 and c++ 11 feaures enabled as part of build
$ . /etc/profile.d/_environment.sh
$ . /etc/profile.d/runner.sh
$ nvm use v5.3.0
Now using node v5.3.0 (npm v3.3.12)
$ scl enable devtoolset-2 bash
$ npm install
npm WARN deprecated lodash@1.0.2: lodash@<2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN engine xmlbuilder@2.4.4: wanted: {"node":"0.8.x || 0.10.x || 0.11.x"} (current: {"node":"5.3.0","npm":"3.3.12"})
npm WARN deprecated lodash-node@2.4.1: This package is no longer maintained. See its readme for upgrade details.
> ursa@0.9.1 install /home/gitlab-runner/builds/6acc3401/0/operations/-technical-operations-portal/node_modules/chef-api/node_modules/ursa
> node-gyp rebuild
make: Entering directory `/home/gitlab-runner/builds/6acc3401/0/operations/-technical-operations-portal/node_modules/chef-api/node_modules/ursa/build'
CXX(target) Release/obj.target/ursaNative/src/ursaNative.o
In file included from ../src/ursaNative.h:10,
from ../src/ursaNative.cc:3:
../node_modules/nan/nan.h:41:3: error: #error This version of node/NAN/v8 requires a C++11 compiler
In file included from /home/gitlab-runner/.node-gyp/5.3.0/include/node/node.h:42,
from ../src/ursaNative.h:9,
from ../src/ursaNative.cc:3:
看起来好像来自一个步骤的值没有结转到下一步。例如 - 就好像它们发生在自己的外壳中一样。