Skip to content

Commit

Permalink
feat: Add --mulled-conda-image (#867)
Browse files Browse the repository at this point in the history
This patch try to add `--mulled-conda-image` to bioconda-utils, after
this patch, users can specify customized mulled test image. Such as
multi-arch case, users can sepcified multi-arch image.

Related: #706

Signed-off-by: Yikun Jiang <yikunkero@gmail.com>
Co-authored-by: Björn Grüning <bjoern@gruenings.eu>
  • Loading branch information
Yikun and bgruening authored Apr 10, 2023
1 parent b6b674c commit 1923d24
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 8 additions & 4 deletions bioconda_utils/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def build(recipe: str, pkg_paths: List[str] = None,
channels: List[str] = None,
docker_builder: docker_utils.RecipeBuilder = None,
raise_error: bool = False,
linter=None) -> BuildResult:
linter=None,
mulled_conda_image: str = pkg_test.MULLED_CONDA_IMAGE) -> BuildResult:
"""
Build a single recipe for a single env
Expand Down Expand Up @@ -149,7 +150,8 @@ def build(recipe: str, pkg_paths: List[str] = None,
mulled_images = []
for pkg_path in pkg_paths:
try:
pkg_test.test_package(pkg_path, base_image=base_image)
pkg_test.test_package(pkg_path, base_image=base_image,
conda_image=mulled_conda_image)
except sp.CalledProcessError:
logger.error('TEST FAILED: %s', recipe)
return BuildResult(False, None)
Expand Down Expand Up @@ -225,7 +227,8 @@ def build_recipes(recipe_folder: str, config_path: str, recipes: List[str],
lint_exclude: List[str] = None,
n_workers: int = 1,
worker_offset: int = 0,
keep_old_work: bool = False):
keep_old_work: bool = False,
mulled_conda_image: str = pkg_test.MULLED_CONDA_IMAGE):
"""
Build one or many bioconda packages.
Expand Down Expand Up @@ -343,7 +346,8 @@ def build_recipes(recipe_folder: str, config_path: str, recipes: List[str],
mulled_test=mulled_test,
channels=config['channels'],
docker_builder=docker_builder,
linter=linter)
linter=linter,
mulled_conda_image=mulled_conda_image)

if not res.success:
failed.append(recipe)
Expand Down
9 changes: 7 additions & 2 deletions bioconda_utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from . import cran_skeleton
from . import update_pinnings
from . import graph
from . import pkg_test
from .githandler import BiocondaRepo, install_gpg_key

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -379,6 +380,8 @@ def do_lint(recipe_folder, config, packages="*", cache=None, list_checks=False,
help='Build packages in docker container.')
@arg('--mulled-test', action='store_true', help="Run a mulled-build test on the built package")
@arg('--mulled-upload-target', help="Provide a quay.io target to push mulled docker images to.")
@arg('--mulled-conda-image', help='''Conda Docker image to install the package with during
the mulled based tests.''')
@arg('--build_script_template', help='''Filename to optionally replace build
script template used by the Docker container. By default use
docker_utils.BUILD_SCRIPT_TEMPLATE. Only used if --docker is True.''')
Expand Down Expand Up @@ -428,7 +431,8 @@ def build(recipe_folder, config, packages="*", git_range=None, testonly=False,
force=False, docker=None, mulled_test=False, build_script_template=None,
pkg_dir=None, anaconda_upload=False, mulled_upload_target=None,
build_image=False, keep_image=False, lint=False, lint_exclude=None,
check_channels=None, n_workers=1, worker_offset=0, keep_old_work=False):
check_channels=None, n_workers=1, worker_offset=0, keep_old_work=False,
mulled_conda_image=pkg_test.MULLED_CONDA_IMAGE):
cfg = utils.load_config(config)
setup = cfg.get('setup', None)
if setup:
Expand Down Expand Up @@ -476,7 +480,8 @@ def build(recipe_folder, config, packages="*", git_range=None, testonly=False,
label=label,
n_workers=n_workers,
worker_offset=worker_offset,
keep_old_work=keep_old_work)
keep_old_work=keep_old_work,
mulled_conda_image=mulled_conda_image)
exit(0 if success else 1)


Expand Down
1 change: 0 additions & 1 deletion bioconda_utils/pkg_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

logger = logging.getLogger(__name__)

# TODO: Make this configurable in bioconda_utils.build and bioconda_utils.cli.
MULLED_CONDA_IMAGE = "quay.io/bioconda/create-env:latest"


Expand Down

0 comments on commit 1923d24

Please sign in to comment.