From ecb93b68ee21feaf735b000fb766460fdcfcdf62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hadrien=20Gourl=C3=A9?= Date: Thu, 9 Aug 2018 16:42:25 +0200 Subject: [PATCH 1/3] reverse conda env handling (fix for #114) --- nf_core/lint.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nf_core/lint.py b/nf_core/lint.py index 8d77e9e397..ddf9cdca96 100644 --- a/nf_core/lint.py +++ b/nf_core/lint.py @@ -557,7 +557,8 @@ def check_conda_dockerfile(self): expected_strings = [ 'FROM nfcore/base', 'COPY environment.yml /', - 'RUN conda env update -n root -f /environment.yml && conda clean -a' + 'RUN conda env create -f /environment.yml && conda clean -a', + 'ENV PATH /opt/conda/envs/{}/bin:$PATH'.format(self.conda_config['name']) ] difference = set(expected_strings) - set(self.dockerfile) @@ -581,8 +582,10 @@ def check_conda_singularityfile(self): 'From:nfcore/base', 'Bootstrap:docker', 'VERSION {}'.format(self.config['params.version'].strip(' \'"')), + 'PATH=/opt/conda/envs/{}/bin:$PATH'.format(self.conda_config['name']), + 'export PATH', 'environment.yml /', - '/opt/conda/bin/conda env update -n root -f /environment.yml', + '/opt/conda/bin/conda env create -f /environment.yml', '/opt/conda/bin/conda clean -a', ] From 6936fb35a5e4c6c575721ef0bcbcbe70f0620b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hadrien=20Gourl=C3=A9?= Date: Fri, 10 Aug 2018 08:42:23 +0200 Subject: [PATCH 2/3] update test files --- tests/lint_examples/minimal_working_example/Dockerfile | 3 ++- tests/lint_examples/minimal_working_example/Singularity | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/lint_examples/minimal_working_example/Dockerfile b/tests/lint_examples/minimal_working_example/Dockerfile index 1ed80a41d7..f2ebb853e0 100644 --- a/tests/lint_examples/minimal_working_example/Dockerfile +++ b/tests/lint_examples/minimal_working_example/Dockerfile @@ -4,4 +4,5 @@ LABEL authors="phil.ewels@scilifelab.se" \ description="Docker image containing all requirements for the nf-core tools pipeline" COPY environment.yml / -RUN conda env update -n root -f /environment.yml && conda clean -a +RUN conda env create -f /environment.yml && conda clean -a +ENV PATH /opt/conda/envs/nfcore-tools-0.4/bin:$PATH diff --git a/tests/lint_examples/minimal_working_example/Singularity b/tests/lint_examples/minimal_working_example/Singularity index 5935e8edf0..c9d1026f26 100644 --- a/tests/lint_examples/minimal_working_example/Singularity +++ b/tests/lint_examples/minimal_working_example/Singularity @@ -6,9 +6,13 @@ Bootstrap:docker DESCRIPTION Container image containing all requirements for the nf-core/tools pipeline VERSION 0.4 +%environment + PATH=/opt/conda/envs/nfcore-tools-0.4/bin:$PATH + export PATH + %files environment.yml / %post - /opt/conda/bin/conda env update -n root -f /environment.yml + /opt/conda/bin/conda env create -f /environment.yml /opt/conda/bin/conda clean -a From 9b4329741b6204d1bd92a17b05f832dce128a86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hadrien=20Gourl=C3=A9?= Date: Fri, 10 Aug 2018 09:20:55 +0200 Subject: [PATCH 3/3] more tests are expected to fail (due to ENV line) --- tests/test_lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_lint.py b/tests/test_lint.py index 2de9e5e708..06bdca1995 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -321,7 +321,7 @@ def test_conda_dockerfile_fail(self): lint_obj.conda_config['name'] = 'nfcore-tools-0.4' lint_obj.dockerfile = ['fubar'] lint_obj.check_conda_dockerfile() - expectations = {"failed": 3, "warned": 0, "passed": 0} + expectations = {"failed": 4, "warned": 0, "passed": 0} self.assess_lint_status(lint_obj, **expectations) def test_conda_dockerfile_skip(self):