C++ 在gitlab CI/CD中使用devtoolset

C++ 在gitlab CI/CD中使用devtoolset,c++,gitlab,gitlab-ci,gitlab-ci-runner,devtoolset,C++,Gitlab,Gitlab Ci,Gitlab Ci Runner,Devtoolset,我已经创建了一个CentOS 7映像,其中包含在gitlab.com上运行CI/CD管道所需的相关软件包。要求之一是使用gcc 8。我使用的是devtoolset-8。图像存储在dockerhub上。我在/etc/profile中添加了以下内容: source /opt/rh/devtoolset-8/enable 如果我手动拉取此图像并在docker中运行此图像,则一切正常: root@xxxxxx~]# docker run -i -t yyyyyy/zzzz:latest ... [ro

我已经创建了一个CentOS 7映像,其中包含在gitlab.com上运行CI/CD管道所需的相关软件包。要求之一是使用gcc 8。我使用的是devtoolset-8。图像存储在dockerhub上。我在/etc/profile中添加了以下内容:

source /opt/rh/devtoolset-8/enable
如果我手动拉取此图像并在docker中运行此图像,则一切正常:

root@xxxxxx~]# docker run -i -t yyyyyy/zzzz:latest
...
[root@3463ccd63d42 build]# cmake -DCMAKE_BUILD_TYPE=Debug ..
-- The C compiler identification is GNU 8.3.1
-- The CXX compiler identification is GNU 8.3.1
但是,当我在gitlab.com上的CI/CD管道中使用该映像时,似乎没有启用devtoolset。我还尝试在script:section中手动执行此操作。作业输出:

Pulling docker image yyyyyy/zzzz:latest
...
Executing "step_script" stage of the job script
$ scl enable devtoolset-8 bash
..
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
-- The C compiler identification is GNU 4.8.5

你知道问题是什么吗?

我今天遇到了这个问题

我不确定这个问题背后的机制是什么,但解决方法是使用,例如:

scl enable devtoolset-8 'cmake .. && make all'
…如果您想使用cmake构建一些东西