由于我们运行的测试越来越长,我认为从 Travis CI 切换到 Jenkins(在我的本地计算机上)是个好主意。设置 Jenkins 相对简单,但让我的 Jenkinsfile“工作”却不是那么简单。我正在尝试下载 miniconda -> 安装 miniconda -> 安装环境 -> 激活环境 -> 从该环境运行命令。这是我到目前为止得到的:
environment {
PATH = "$WORKSPACE/miniconda/bin:$PATH"
}
stages {
stage('setup miniconda') {
steps {
sh '''#!/usr/bin/env bash
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $WORKSPACE/miniconda
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
# Useful for debugging any issues with conda
conda info -a
conda config --add channels defaults
conda config --add channels conda-forge
conda config --add channels bioconda
# create snakemake-workflows env
conda init bash
conda env create -f envs/snakemake-workflows.yaml
'''
}
}
stage('Test downloading') {
steps {
sh '''#!/usr/bin/env bash
conda init bash
conda activate miniconda/envs/snakemake-workflows/
snakemake -s workflows/download_fastq/Snakefile --directory workflows/download_fastq -n -j 48 --quiet
'''
}
}
miniconda 的安装似乎可以工作,但是阶段测试下载的下一步会导致错误:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
我该如何继续?我需要初始化我的 conda,但它似乎没有效果(我在创建环境时以及尝试激活它时执行此操作)。
如果 conda 以静默模式安装(-b 标志),那么它不会编辑您的 bashrc (请参阅https://docs.anaconda.com/anaconda/install/silent-mode/ https://docs.anaconda.com/anaconda/install/silent-mode/)。所以在Test downloading
阶段您将必须再次手动初始化它。
这应该有效:
stage('Test downloading') {
steps {
sh '''#!/usr/bin/env bash
source $WORKSPACE/miniconda/etc/profile.d/conda.sh
conda activate miniconda/envs/snakemake-workflows/
snakemake -s workflows/download_fastq/Snakefile --directory workflows/download_fastq -n -j 48 --quiet
'''
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)