summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2023-10-12 12:12:15 +0200
committerGitHub <noreply@github.com>2023-10-12 12:12:15 +0200
commit3935e047c612f3c20c2fa7f55f762a2ef529a0c0 (patch)
tree1a44f3fa6a83bf1e3874ad782829a6e20ce9b9fa
parent0fd2427d9b1c27c02d16075a0cc8fa2626e7ae73 (diff)
downloadspack-3935e047c612f3c20c2fa7f55f762a2ef529a0c0.tar.gz
spack-3935e047c612f3c20c2fa7f55f762a2ef529a0c0.tar.bz2
spack-3935e047c612f3c20c2fa7f55f762a2ef529a0c0.tar.xz
spack-3935e047c612f3c20c2fa7f55f762a2ef529a0c0.zip
Remove deprecated "extra_instructions" option for containers (#40365)
-rw-r--r--lib/spack/docs/containers.rst8
-rw-r--r--lib/spack/spack/container/writers/__init__.py7
-rw-r--r--lib/spack/spack/schema/container.py15
-rw-r--r--lib/spack/spack/test/container/docker.py17
-rw-r--r--share/spack/templates/container/Dockerfile7
-rw-r--r--share/spack/templates/container/singularity.def6
6 files changed, 1 insertions, 59 deletions
diff --git a/lib/spack/docs/containers.rst b/lib/spack/docs/containers.rst
index ec9c02635c..17609d740e 100644
--- a/lib/spack/docs/containers.rst
+++ b/lib/spack/docs/containers.rst
@@ -212,18 +212,12 @@ under the ``container`` attribute of environments:
final:
- libgomp
- # Extra instructions
- extra_instructions:
- final: |
- RUN echo 'export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][gromacs]\[$(tput setaf 2)\]\u\[$(tput sgr0)\]:\w $ "' >> ~/.bashrc
-
# Labels for the image
labels:
app: "gromacs"
mpi: "mpich"
-A detailed description of the options available can be found in the
-:ref:`container_config_options` section.
+A detailed description of the options available can be found in the :ref:`container_config_options` section.
-------------------
Setting Base Images
diff --git a/lib/spack/spack/container/writers/__init__.py b/lib/spack/spack/container/writers/__init__.py
index 4e15ae6f58..dfed52e47e 100644
--- a/lib/spack/spack/container/writers/__init__.py
+++ b/lib/spack/spack/container/writers/__init__.py
@@ -273,13 +273,6 @@ class PathContext(tengine.Context):
return os_pkg_manager
@tengine.context_property
- def extra_instructions(self):
- Extras = namedtuple("Extra", ["build", "final"])
- extras = self.container_config.get("extra_instructions", {})
- build, final = extras.get("build", None), extras.get("final", None)
- return Extras(build=build, final=final)
-
- @tengine.context_property
def labels(self):
return self.container_config.get("labels", {})
diff --git a/lib/spack/spack/schema/container.py b/lib/spack/spack/schema/container.py
index 030b238290..df386c3de4 100644
--- a/lib/spack/spack/schema/container.py
+++ b/lib/spack/spack/schema/container.py
@@ -68,12 +68,6 @@ container_schema = {
"labels": {"type": "object"},
# Use a custom template to render the recipe
"template": {"type": "string", "default": None},
- # Add a custom extra section at the bottom of a stage
- "extra_instructions": {
- "type": "object",
- "additionalProperties": False,
- "properties": {"build": {"type": "string"}, "final": {"type": "string"}},
- },
# Reserved for properties that are specific to each format
"singularity": {
"type": "object",
@@ -89,15 +83,6 @@ container_schema = {
"docker": {"type": "object", "additionalProperties": False, "default": {}},
"depfile": {"type": "boolean", "default": False},
},
- "deprecatedProperties": {
- "properties": ["extra_instructions"],
- "message": (
- "container:extra_instructions has been deprecated and will be removed "
- "in Spack v0.21. Set container:template appropriately to use custom Jinja2 "
- "templates instead."
- ),
- "error": False,
- },
}
properties = {"container": container_schema}
diff --git a/lib/spack/spack/test/container/docker.py b/lib/spack/spack/test/container/docker.py
index d6b6f4488b..5e0b8c3d4e 100644
--- a/lib/spack/spack/test/container/docker.py
+++ b/lib/spack/spack/test/container/docker.py
@@ -82,23 +82,6 @@ def test_strip_is_set_from_config(minimal_configuration):
assert writer.strip is False
-def test_extra_instructions_is_set_from_config(minimal_configuration):
- writer = writers.create(minimal_configuration)
- assert writer.extra_instructions == (None, None)
-
- test_line = "RUN echo Hello world!"
- e = minimal_configuration["spack"]["container"]
- e["extra_instructions"] = {}
- e["extra_instructions"]["build"] = test_line
- writer = writers.create(minimal_configuration)
- assert writer.extra_instructions == (test_line, None)
-
- e["extra_instructions"]["final"] = test_line
- del e["extra_instructions"]["build"]
- writer = writers.create(minimal_configuration)
- assert writer.extra_instructions == (None, test_line)
-
-
def test_custom_base_images(minimal_configuration):
"""Test setting custom base images from configuration file"""
minimal_configuration["spack"]["container"]["images"] = {
diff --git a/share/spack/templates/container/Dockerfile b/share/spack/templates/container/Dockerfile
index 27c2dbf5cf..2fad37affb 100644
--- a/share/spack/templates/container/Dockerfile
+++ b/share/spack/templates/container/Dockerfile
@@ -39,9 +39,6 @@ RUN find -L {{ paths.view }}/* -type f -exec readlink -f '{}' \; | \
RUN cd {{ paths.environment }} && \
spack env activate --sh -d . > activate.sh
-{% if extra_instructions.build %}
-{{ extra_instructions.build }}
-{% endif %}
{% endblock build_stage %}
{% endif %}
@@ -70,10 +67,6 @@ RUN {% if os_package_update %}{{ os_packages_final.update }} \
&& {% endif %}{{ os_packages_final.install }} {{ os_packages_final.list | join | replace('\n', ' ') }} \
&& {{ os_packages_final.clean }}
{% endif %}
-{% if extra_instructions.final %}
-
-{{ extra_instructions.final }}
-{% endif %}
{% endblock final_stage %}
{% for label, value in labels.items() %}
LABEL "{{ label }}"="{{ value }}"
diff --git a/share/spack/templates/container/singularity.def b/share/spack/templates/container/singularity.def
index 4184db92b6..3b8f57dfb1 100644
--- a/share/spack/templates/container/singularity.def
+++ b/share/spack/templates/container/singularity.def
@@ -39,9 +39,6 @@ EOF
grep 'x-executable\|x-archive\|x-sharedlib' | \
awk -F: '{print $1}' | xargs strip
{% endif %}
-{% if extra_instructions.build %}
-{{ extra_instructions.build }}
-{% endif %}
{% endblock build_stage %}
{% if apps %}
{% for application, help_text in apps.items() %}
@@ -80,9 +77,6 @@ Stage: final
{% endif %}
# Modify the environment without relying on sourcing shell specific files at startup
cat {{ paths.environment }}/environment_modifications.sh >> $SINGULARITY_ENVIRONMENT
-{% if extra_instructions.final %}
-{{ extra_instructions.final }}
-{% endif %}
{% endblock final_stage %}
{% if runscript %}