containerize: ensure bootstrap images contain all system dependencies (#36818)

This also makes `spack bootstrap status` exit 1 if some dependency is missing
This commit is contained in:
Jonathon Anderson 2023-08-09 02:46:59 -05:00 committed by GitHub
parent 3d733da70a
commit 9aa3b4619b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 3 deletions

View file

@ -165,6 +165,7 @@ jobs:
- name: Install Python packages - name: Install Python packages
run: | run: |
pip install --upgrade pip setuptools pytest coverage[toml] pytest-cov clingo pytest-xdist pip install --upgrade pip setuptools pytest coverage[toml] pytest-cov clingo pytest-xdist
pip install --upgrade flake8 "isort>=4.3.5" "mypy>=0.900" "click" "black"
- name: Setup git configuration - name: Setup git configuration
run: | run: |
# Need this for the git tests to succeed. # Need this for the git tests to succeed.

View file

@ -32,9 +32,14 @@ can't be found. You can readily check if any prerequisite for using Spack is mis
Spack will take care of bootstrapping any missing dependency marked as [B]. Dependencies marked as [-] are instead required to be found on the system. Spack will take care of bootstrapping any missing dependency marked as [B]. Dependencies marked as [-] are instead required to be found on the system.
% echo $?
1
In the case of the output shown above Spack detected that both ``clingo`` and ``gnupg`` In the case of the output shown above Spack detected that both ``clingo`` and ``gnupg``
are missing and it's giving detailed information on why they are needed and whether are missing and it's giving detailed information on why they are needed and whether
they can be bootstrapped. Running a command that concretize a spec, like: they can be bootstrapped. The return code of this command summarizes the results, if any
dependencies are missing the return code is ``1``, otherwise ``0``. Running a command that
concretizes a spec, like:
.. code-block:: console .. code-block:: console
@ -44,7 +49,7 @@ they can be bootstrapped. Running a command that concretize a spec, like:
==> Installing "clingo-bootstrap@spack%apple-clang@12.0.0~docs~ipo+python build_type=Release arch=darwin-catalina-x86_64" from a buildcache ==> Installing "clingo-bootstrap@spack%apple-clang@12.0.0~docs~ipo+python build_type=Release arch=darwin-catalina-x86_64" from a buildcache
[ ... ] [ ... ]
triggers the bootstrapping of clingo from pre-built binaries as expected. automatically triggers the bootstrapping of clingo from pre-built binaries as expected.
Users can also bootstrap all the dependencies needed by Spack in a single command, which Users can also bootstrap all the dependencies needed by Spack in a single command, which
might be useful to setup containers or other similar environments: might be useful to setup containers or other similar environments:

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path import os.path
import shutil import shutil
import sys
import tempfile import tempfile
import llnl.util.filesystem import llnl.util.filesystem
@ -326,6 +327,7 @@ def _status(args):
if missing: if missing:
print(llnl.util.tty.color.colorize(legend)) print(llnl.util.tty.color.colorize(legend))
print() print()
sys.exit(1)
def _add(args): def _add(args):

View file

@ -10,6 +10,7 @@ RUN yum update -y \
gcc-gfortran \ gcc-gfortran \
git \ git \
gnupg2 \ gnupg2 \
hg \
hostname \ hostname \
iproute \ iproute \
make \ make \
@ -18,6 +19,7 @@ RUN yum update -y \
python3-pip \ python3-pip \
python3-setuptools \ python3-setuptools \
unzip \ unzip \
zstd \
&& pip3 install boto3 \ && pip3 install boto3 \
&& rm -rf /var/cache/yum \ && rm -rf /var/cache/yum \
&& yum clean all && yum clean all

View file

@ -39,7 +39,9 @@ WORKDIR /root
SHELL ["docker-shell"] SHELL ["docker-shell"]
# Creates the package cache # Creates the package cache
RUN spack bootstrap now && spack spec hdf5+mpi RUN spack bootstrap now \
&& spack bootstrap status --optional \
&& spack spec hdf5+mpi
ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"] ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"]
CMD ["interactive-shell"] CMD ["interactive-shell"]

View file

@ -13,6 +13,7 @@ RUN yum update -y \
git \ git \
gnupg2 \ gnupg2 \
hostname \ hostname \
hg \
iproute \ iproute \
make \ make \
patch \ patch \
@ -20,6 +21,7 @@ RUN yum update -y \
python3-pip \ python3-pip \
python3-setuptools \ python3-setuptools \
unzip \ unzip \
zstd \
&& pip3 install boto3 \ && pip3 install boto3 \
&& rm -rf /var/cache/yum \ && rm -rf /var/cache/yum \
&& yum clean all && yum clean all

View file

@ -15,13 +15,16 @@ RUN dnf update -y \
gcc-gfortran \ gcc-gfortran \
git \ git \
gnupg2 \ gnupg2 \
hg \
hostname \ hostname \
iproute \ iproute \
make \ make \
svn \
patch \ patch \
python3.11 \ python3.11 \
python3.11-setuptools \ python3.11-setuptools \
unzip \ unzip \
zstd \
&& python3.11 -m ensurepip \ && python3.11 -m ensurepip \
&& pip3.11 install boto3 \ && pip3.11 install boto3 \
&& rm -rf /var/cache/dnf \ && rm -rf /var/cache/dnf \

View file

@ -9,12 +9,16 @@ RUN zypper ref && \
gcc-c++\ gcc-c++\
gcc-fortran\ gcc-fortran\
make\ make\
mercurial\
git\ git\
gzip\ gzip\
patch\ patch\
python3-base \ python3-base \
python3-boto3\ python3-boto3\
subversion\
tar\ tar\
unzip\
xz\ xz\
zstd\
&& zypper clean && zypper clean
{% endblock %} {% endblock %}

View file

@ -22,10 +22,13 @@ RUN apt-get -yqq update \
iproute2 \ iproute2 \
locales \ locales \
make \ make \
mercurial \
subversion \
python3 \ python3 \
python3-pip \ python3-pip \
python3-setuptools \ python3-setuptools \
unzip \ unzip \
zstd \
&& locale-gen en_US.UTF-8 \ && locale-gen en_US.UTF-8 \
&& pip3 install boto3 \ && pip3 install boto3 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*