我想在Gitlab CI-CD进程中激活conda环境。 我在本地计算机(UNIX)上向Shell Executor注册了Gitlab runner(v13.10),与我的工作笔记本电脑不同 我试图通过repo中存在的环境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
我面临的问题是它抛出了一个错误:CONDA命令未找到
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文件中,作为环境路径变量。但我不确定我是否做对了
我的问题是:
一种对我有效的方法是使用conda docker映像,并执行命令
conda init bash
、source ~/.bashrc
和conda activate env_name
。这将是.gitlab-ci.yml文件的内容:相关问题 更多 >
编程相关推荐