diff --git a/.github/Dockerfiles/Ubuntu.jammy-non-free.Dockerfile b/.github/Dockerfiles/Ubuntu.jammy-non-free.Dockerfile index 4498fa0b92..cd9e1317ee 100644 --- a/.github/Dockerfiles/Ubuntu.jammy-non-free.Dockerfile +++ b/.github/Dockerfiles/Ubuntu.jammy-non-free.Dockerfile @@ -29,7 +29,8 @@ FROM neurodebian:jammy-non-free LABEL org.opencontainers.image.description "NOT INTENDED FOR USE OTHER THAN AS A STAGE IMAGE IN A MULTI-STAGE BUILD \ Ubuntu Jammy base image" LABEL org.opencontainers.image.source https://github.com/FCP-INDI/C-PAC -ARG DEBIAN_FRONTEND=noninteractive +ARG BIDS_VALIDATOR_VERSION=1.14.6 \ + DEBIAN_FRONTEND=noninteractive ENV TZ=America/New_York \ PATH=$PATH:/.local/bin \ PYTHONPATH=$PYTHONPATH:/.local/lib/python3.10/site-packages @@ -61,7 +62,10 @@ RUN groupadd -r c-pac \ && echo $TZ > /etc/timezone \ && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ - && update-locale LANG="en_US.UTF-8" + && update-locale LANG="en_US.UTF-8" \ + # # install bids-validator + && curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts \ + && npm install -g "bids-validator@${BIDS_VALIDATOR_VERSION}" COPY --from=c-pac_templates /cpac_templates /cpac_templates COPY --from=dcan-hcp /opt/dcan-tools/pipeline/global /opt/dcan-tools/pipeline/global diff --git a/CHANGELOG.md b/CHANGELOG.md index 0403952e92..2f87bd9d3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Disabled variant image builds. - Made orientation configurable (was hard-coded as "RPI"). +### Fixed + +- Restored `bids-validator` functionality. + ### Removed - Variant image recipes. diff --git a/CPAC/utils/tests/test_bids_utils.py b/CPAC/utils/tests/test_bids_utils.py index 0c6cabebbd..e701568815 100644 --- a/CPAC/utils/tests/test_bids_utils.py +++ b/CPAC/utils/tests/test_bids_utils.py @@ -1,5 +1,7 @@ """Tests for bids_utils""" import os +from subprocess import run + import pytest import yaml from CPAC.utils.bids_utils import bids_gen_cpac_sublist, \ @@ -45,7 +47,12 @@ def _prefix_entities(paths, path): ])), 'w') -@pytest.mark.parametrize('only_one_anat', [True, False]) +def test_bids_validator() -> None: + """Test subprocess call to `bids-validator`.""" + run(["bids-validator", "--version"], check=True) + + +@pytest.mark.parametrize("only_one_anat", [True, False]) def test_create_cpac_data_config_only_one_anat(tmp_path, only_one_anat): """Function to test 'only_one_anat' parameter of 'create_cpac_data_config' function""" diff --git a/CPAC/utils/versioning/dependencies.py b/CPAC/utils/versioning/dependencies.py index 115160336a..d95add1961 100644 --- a/CPAC/utils/versioning/dependencies.py +++ b/CPAC/utils/versioning/dependencies.py @@ -119,9 +119,12 @@ def requirements() -> dict: REPORTED = dict(sorted({ - **cli_version('ldd --version', formatting=first_line), - 'Python': sys.version.replace('\n', ' ').replace(' ', ' '), - **cli_version('3dECM -help', delimiter='_', - formatting=lambda _: last_line(_).split('{')[-1].rstrip('}')) + **cli_version("bids-validator --version", dependency="bids-validator", + in_result=False, formatting=first_line), + **cli_version("ldd --version", formatting=first_line), + "Python": sys.version.replace("\n", " ").replace(" ", " "), + **cli_version("3dECM -help", delimiter="_", + formatting=lambda _: last_line(_).split("{")[-1].rstrip("}")) }.items(), key=_version_sort)) + REQUIREMENTS = requirements()