如何解决使用 Shell Executor 在 GitLab Config yml 文件中为 CI-CD 激活 Conda 环境
我想在我的 Gitlab CI-CD 过程中激活 conda 环境。 我在不同于我的工作笔记本电脑的本地机器 (UNIX) 上使用 Shell Executor 注册了 Gitlab runner (v13.10) 我正在尝试通过我的存储库中存在的环境 yml 文件激活 conda 环境,但它失败并显示未找到 conda 命令!
我像这样编辑了 .gitlab-ci.yml 文件:
stages:
- build
build stage:
stage: build
before_script:
- which python
- export PIP_CACHE_DIR="/opt/cache/pip"
- conda env create -f environment.yml
- source activate env_work
script:
- echo "Building"
- cd parent_dir
- python main.py new_studies/first_study
artifacts:
paths:
- out/
only:
- master
Running with gitlab-runner 13.10.0 (5421146)
on rig ci runner gZzdceA
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:00
Running on rig-machine...
Getting source from Git repository
00:04
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /home/gitlab-runner/builds/gZzdceA/0/company/gg/product/repo/.git/
Checking out 883ga36 as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:00
$ export PIP_CACHE_DIR="/opt/cache/pip"
$ conda env create -f environment.yml
bash: line 120: conda: command not found
Cleaning up file based variables
00:00
ERROR: Job Failed: exit status 1
我提到了发布的各种问题,例如 here 和 here。另外,我尝试将 anaconda 路径添加到环境路径变量的 bash 文件中。但我不确定我是否正确
我的问题是:
- 既然它在 shell executor 上运行,而且我已经在运行 conda,为什么它无法拾取它。如何在我的 GitLab 配置文件中解决此问题
- 我对 docker 镜像的使用有限制,我想坚持使用 Shell 执行器
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。